Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FXAS21002 FXOS8700Q
pal_network.h File Reference
PAL network. This file contains the network APIs and it is a part of the PAL service API. More...
Go to the source code of this file.
Typedefs | |
typedef uint32_t | palSocketLength_t |
The length of data. | |
typedef void * | palSocket_t |
PAL socket handle type. | |
typedef struct palSocketAddress | palSocketAddress_t |
Address data structure with enough room to support IPV4 and IPV6. | |
typedef void(* | palAsyncSocketCallback_t )(void *) |
The type of the callback function passed when creating asynchronous sockets. | |
typedef void(* | palGetAddressInfoAsyncCallback_t )(const char *url, palSocketAddress_t *address, palSocketLength_t *addressLength, palStatus_t status, void *callbackArgument) |
Prototype of the callback function invoked when querying address info asynchronously using `pal_getAddressInfoAsync`. | |
typedef int32_t | palDNSQuery_t |
PAL DNS query handle. Can be used to cancel the asynchronous DNS query. | |
typedef struct pal_asyncAddressInfo | pal_asyncAddressInfo_t |
Structure used by pal_getAddressInfoAsync. | |
Enumerations | |
enum | palSocketDomain_t { , PAL_AF_INET = 2, PAL_AF_INET6 = 10 } |
Network domains supported by PAL. More... | |
enum | palSocketType_t { PAL_SOCK_STREAM = 1, PAL_SOCK_STREAM_SERVER = 99, PAL_SOCK_DGRAM = 2 } |
Socket types supported by PAL. More... | |
enum | palSocketOptionName_t { PAL_SO_REUSEADDR = 0x0004, PAL_SO_KEEPALIVE = 0x0008, PAL_SO_KEEPIDLE = 0x0009, PAL_SO_KEEPINTVL = 0x0010, PAL_SO_SNDTIMEO = 0x1005, PAL_SO_RCVTIMEO = 0x1006 } |
Socket options supported by PAL. More... | |
Functions | |
palStatus_t | pal_registerNetworkInterface (void *networkInterfaceContext, uint32_t *interfaceIndex) |
Register a network interface for use with PAL sockets. | |
palStatus_t | pal_unregisterNetworkInterface (uint32_t interfaceIndex) |
Unregister a network interface. | |
palStatus_t | pal_setSockAddrPort (palSocketAddress_t *address, uint16_t port) |
Set a port to an address data structure. | |
palStatus_t | pal_setSockAddrIPV4Addr (palSocketAddress_t *address, palIpV4Addr_t ipV4Addr) |
Set an IPv4 address to an address data structure and set `addressType` as IPv4. | |
palStatus_t | pal_getSockAddrIPV4Addr (const palSocketAddress_t *address, palIpV4Addr_t ipV4Addr) |
Get an IPv4 address from an address data structure. | |
palStatus_t | pal_setSockAddrIPV6Addr (palSocketAddress_t *address, palIpV6Addr_t ipV6Addr) |
Set an IPv6 address to an address data structure and set the `addressType` as IPv6. | |
palStatus_t | pal_getSockAddrIPV6Addr (const palSocketAddress_t *address, palIpV6Addr_t ipV6Addr) |
Get an IPv6 address from an address data structure. | |
palStatus_t | pal_getSockAddrPort (const palSocketAddress_t *address, uint16_t *port) |
Get a port from an address data structure. | |
palStatus_t | pal_socket (palSocketDomain_t domain, palSocketType_t type, bool nonBlockingSocket, uint32_t interfaceNum, palSocket_t *socket) |
Create a network socket. | |
palStatus_t | pal_setSocketOptions (palSocket_t socket, int optionName, const void *optionValue, palSocketLength_t optionLength) |
Set the value for a socket option on a network socket. | |
palStatus_t | pal_isNonBlocking (palSocket_t socket, bool *isNonBlocking) |
Check if a socket is non-blocking. | |
palStatus_t | pal_bind (palSocket_t socket, palSocketAddress_t *myAddress, palSocketLength_t addressLength) |
Bind a socket to a local address. | |
palStatus_t | pal_receiveFrom (palSocket_t socket, void *buffer, size_t length, palSocketAddress_t *from, palSocketLength_t *fromLength, size_t *bytesReceived) |
Receive a payload from a specific socket. | |
palStatus_t | pal_sendTo (palSocket_t socket, const void *buffer, size_t length, const palSocketAddress_t *to, palSocketLength_t toLength, size_t *bytesSent) |
Send a payload to an address using a specific socket. | |
palStatus_t | pal_close (palSocket_t *socket) |
Close a network socket. | |
palStatus_t | pal_getNumberOfNetInterfaces (uint32_t *numInterfaces) |
Get the number of current network interfaces. | |
palStatus_t | pal_getNetInterfaceInfo (uint32_t interfaceNum, palNetInterfaceInfo_t *interfaceInfo) |
Get information regarding the socket at the interface index number given. This number is returned when registering the socket. | |
palStatus_t | pal_listen (palSocket_t socket, int backlog) |
Use a specific socket to listen for incoming connections. This may also limit the queue of incoming connections. | |
palStatus_t | pal_accept (palSocket_t socket, palSocketAddress_t *address, palSocketLength_t *addressLen, palSocket_t *acceptedSocket) |
Accept a connection on a specific socket. | |
palStatus_t | pal_connect (palSocket_t socket, const palSocketAddress_t *address, palSocketLength_t addressLen) |
Open a connection from a socket to a specific address. | |
palStatus_t | pal_recv (palSocket_t socket, void *buf, size_t len, size_t *recievedDataSize) |
Receive data from a connected socket. | |
palStatus_t | pal_send (palSocket_t socket, const void *buf, size_t len, size_t *sentDataSize) |
Send a buffer via a connected socket. | |
palStatus_t | pal_asynchronousSocket (palSocketDomain_t domain, palSocketType_t type, bool nonBlockingSocket, uint32_t interfaceNum, palAsyncSocketCallback_t callback, palSocket_t *socket) |
Get an asynchronous network socket. | |
palStatus_t | pal_asynchronousSocketWithArgument (palSocketDomain_t domain, palSocketType_t type, bool nonBlockingSocket, uint32_t interfaceNum, palAsyncSocketCallback_t callback, void *callbackArgument, palSocket_t *socket) |
Get an asynchronous network socket that passes the provided `callbackArgument` to a specified callback when it is triggered. | |
palStatus_t | pal_getAddressInfo (const char *url, palSocketAddress_t *address, palSocketLength_t *addressLength) |
This function translates a URL to `palSocketAddress_t` which can be used with PAL sockets. | |
palStatus_t | pal_getAddressInfoAsync (const char *url, palSocketAddress_t *address, palSocketLength_t *addressLength, palGetAddressInfoAsyncCallback_t callback, void *callbackArgument) |
This function translates a URL to `palSocketAddress_t` which can be used with PAL sockets. | |
palStatus_t | pal_getAddressInfoAsync (const char *url, palSocketAddress_t *address, palGetAddressInfoAsyncCallback_t callback, void *callbackArgument, palDNSQuery_t *queryHandle) |
This function translates a URL to `palSocketAddress_t` which can be used with PAL sockets. | |
palStatus_t | pal_cancelAddressInfoAsync (palDNSQuery_t queryHandle) |
This function is a cancellation for `pal_getAddressInfoAsync`. |
Detailed Description
PAL network. This file contains the network APIs and it is a part of the PAL service API.
It provides network functionalities for UDP and TCP sockets and connections.
**PAL network socket API**
PAL network socket configuration options: + Set PAL_NET_TCP_AND_TLS_SUPPORT
to true if TCP is supported by the platform and is required. + Set PAL_NET_ASYNCHRONOUS_SOCKET_API
to true if asynchronous socket API is supported by the platform and is required. This is currently mandatory. + Set PAL_NET_DNS_SUPPORT
to true if DNS URL lookup API is supported.
Definition in file pal_network.h.
Typedef Documentation
typedef struct pal_asyncAddressInfo pal_asyncAddressInfo_t |
Structure used by pal_getAddressInfoAsync.
- Parameters:
-
[in] url The user-provided URL (or IP address string) to be translated. [out] address The address for the output of the translation. [in] callback The user-provided callback. [in] callbackArgument The user callback argument of `pal_GetAddressInfoAsyncCallback_t`. [out] queryHandle Handler ID, which can be used for a cancellation request.
typedef void(* palAsyncSocketCallback_t)(void *) |
The type of the callback function passed when creating asynchronous sockets.
- Parameters:
-
[in] argument The user provided argument passed to the callback function.
Definition at line 301 of file pal_network.h.
typedef int32_t palDNSQuery_t |
PAL DNS query handle. Can be used to cancel the asynchronous DNS query.
Definition at line 366 of file pal_network.h.
typedef void(* palGetAddressInfoAsyncCallback_t)(const char *url, palSocketAddress_t *address, palStatus_t status, void *callbackArgument) |
Prototype of the callback function invoked when querying address info asynchronously using `pal_getAddressInfoAsync`.
- Parameters:
-
[in] url The user-provided URL (or IP address string) that was requested to be translated. [in] address The address for the output of the translation. [in] addressLength The length of the address for the output of the translation in bytes. [in] status The status of the operation - PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure. [in] callbackArgument The user callback argument. [in] url The user-provided URL (or IP address string) to be translated. [out] address The address for the output of the translation. [out] status The status of the operation - PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure. [in] callbackArgument The user callback argument.
Definition at line 350 of file pal_network.h.
typedef void* palSocket_t |
PAL socket handle type.
Definition at line 45 of file pal_network.h.
typedef struct palSocketAddress palSocketAddress_t |
Address data structure with enough room to support IPV4 and IPV6.
typedef uint32_t palSocketLength_t |
The length of data.
Definition at line 44 of file pal_network.h.
Enumeration Type Documentation
enum palSocketDomain_t |
Network domains supported by PAL.
Definition at line 61 of file pal_network.h.
Socket options supported by PAL.
- Enumerator:
Definition at line 77 of file pal_network.h.
enum palSocketType_t |
Socket types supported by PAL.
- Enumerator:
PAL_SOCK_STREAM Stream socket.
PAL_SOCK_STREAM_SERVER Stream socket.
PAL_SOCK_DGRAM Datagram socket.
Definition at line 68 of file pal_network.h.
Function Documentation
palStatus_t pal_accept | ( | palSocket_t | socket, |
palSocketAddress_t * | address, | ||
palSocketLength_t * | addressLen, | ||
palSocket_t * | acceptedSocket | ||
) |
Accept a connection on a specific socket.
- Parameters:
-
[in] socket The socket on which to accept the connection. The socket must be already created and bound, and listen must have been called on it. The socket passed to this function should usually be of type `PAL_SOCK_STREAM_SERVER`, though your specific the implementation may support other types as well. [out] address The source address of the incoming connection. [in,out] addressLen The length of `address` on input, the length of the data returned on output. [out] acceptedSocket The socket of the accepted connection.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 336 of file pal_network.c.
palStatus_t pal_asynchronousSocket | ( | palSocketDomain_t | domain, |
palSocketType_t | type, | ||
bool | nonBlockingSocket, | ||
uint32_t | interfaceNum, | ||
palAsyncSocketCallback_t | callback, | ||
palSocket_t * | socket | ||
) |
Get an asynchronous network socket.
- Parameters:
-
[in] domain The domain for the created socket. See enum `palSocketDomain_t` for supported types. [in] type The type for the socket. See enum `palSocketType_t` for supported types. [in] nonBlockingSocket If `true`, the socket is non-blocking. [in] interfaceNum The number of the network interface used for this socket. Select `PAL_NET_DEFAULT_INTERFACE` for the default interface. [in] callback A callback function that is called when any supported event happens in the given asynchronous socket. See `palAsyncSocketCallback_t` enum for the types of events supported. [out] socket The socket is returned through this output parameter.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 384 of file pal_network.c.
palStatus_t pal_asynchronousSocketWithArgument | ( | palSocketDomain_t | domain, |
palSocketType_t | type, | ||
bool | nonBlockingSocket, | ||
uint32_t | interfaceNum, | ||
palAsyncSocketCallback_t | callback, | ||
void * | callbackArgument, | ||
palSocket_t * | socket | ||
) |
Get an asynchronous network socket that passes the provided `callbackArgument` to a specified callback when it is triggered.
- Parameters:
-
[in] domain The domain for the created socket. See enum `palSocketDomain_t` for supported types. [in] type The type for the created socket. See enum `palSocketType_t` for supported types. [in] nonBlockingSocket If `true`, the socket is created as non-blocking. [in] interfaceNum The number of the network interface used for this socket. Select `PAL_NET_DEFAULT_INTERFACE` for the default interface. [in] callback A callback function that is called when any supported event happens in the given asynchronous socket. [in] callbackArgument The argument with which the specified callback function is called. [out] socket The socket is returned through this output parameter.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 393 of file pal_network.c.
palStatus_t pal_bind | ( | palSocket_t | socket, |
palSocketAddress_t * | myAddress, | ||
palSocketLength_t | addressLength | ||
) |
Bind a socket to a local address.
- Parameters:
-
[in] socket The socket to bind. [in] myAddress The address to bind to. [in] addressLength The length of the address passed in `myAddress`.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 262 of file pal_network.c.
palStatus_t pal_cancelAddressInfoAsync | ( | palDNSQuery_t | queryHandle ) |
This function is a cancellation for `pal_getAddressInfoAsync`.
- Parameters:
-
[in] queryHandle Id of the ongoing DNS query.
Definition at line 491 of file pal_network.c.
palStatus_t pal_close | ( | palSocket_t * | socket ) |
Close a network socket.
- Parameters:
-
[in,out] socket The socket to be closed.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
- Note:
- Receives `palSocket_t*`, not `palSocket_t`, so that it can zero the socket to avoid re-use.
Definition at line 295 of file pal_network.c.
palStatus_t pal_connect | ( | palSocket_t | socket, |
const palSocketAddress_t * | address, | ||
palSocketLength_t | addressLen | ||
) |
Open a connection from a socket to a specific address.
- Parameters:
-
[in] socket The socket to use for a connection to the address. The socket passed to this function should usually be of type `PAL_SOCK_STREAM`, though your specific implementation may support other types as well. [in] address The destination address of the connection. [in] addressLen The length of the `address` field.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 347 of file pal_network.c.
palStatus_t pal_getAddressInfo | ( | const char * | url, |
palSocketAddress_t * | address, | ||
palSocketLength_t * | addressLength | ||
) |
This function translates a URL to `palSocketAddress_t` which can be used with PAL sockets.
Supports both IP address as a string, and URLs (using DNS lookup).
- Parameters:
-
[in] url The URL (or IP address string) to be translated to a `palSocketAddress_t`. [out] address The address for the output of the translation.
Definition at line 406 of file pal_network.c.
palStatus_t pal_getAddressInfoAsync | ( | const char * | url, |
palSocketAddress_t * | address, | ||
palSocketLength_t * | addressLength, | ||
palGetAddressInfoAsyncCallback_t | callback, | ||
void * | callbackArgument | ||
) |
This function translates a URL to `palSocketAddress_t` which can be used with PAL sockets.
Supports both IP address as a string, and URL (using DNS lookup).
- Note:
- This function is non-blocking.
- Parameters:
-
[in] url The user-provided URL (or IP address string) to be translated. [out] address The address for the output of the translation. [out] addressLength The length of the address for the output of the translation in bytes. [in] callback The user-provided callback to be invoked once the function has completed. [in] callbackArgument The user-provided callback argument which will be passed back to the callback function.
Definition at line 430 of file pal_network.c.
palStatus_t pal_getAddressInfoAsync | ( | const char * | url, |
palSocketAddress_t * | address, | ||
palGetAddressInfoAsyncCallback_t | callback, | ||
void * | callbackArgument, | ||
palDNSQuery_t * | queryHandle | ||
) |
This function translates a URL to `palSocketAddress_t` which can be used with PAL sockets.
Supports both IP address as a string, and URL (using DNS lookup).
- Note:
- The function is non-blocking.
- Parameters:
-
[in] url The user-provided URL (or IP address string) to be translated. [out] address The address for the output of the translation. [in] callback The user-provided callback to be invoked once the function has completed. [out] queryHandle DNS query handler. Caller must take care of allocation. If not used, then set as `NULL`.
Definition at line 463 of file pal_network.c.
palStatus_t pal_getNetInterfaceInfo | ( | uint32_t | interfaceNum, |
palNetInterfaceInfo_t * | interfaceInfo | ||
) |
Get information regarding the socket at the interface index number given. This number is returned when registering the socket.
- Parameters:
-
[in] interfaceNum The number of the interface to get information for. [out] interfaceInfo The information for the given interface number.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 317 of file pal_network.c.
palStatus_t pal_getNumberOfNetInterfaces | ( | uint32_t * | numInterfaces ) |
Get the number of current network interfaces.
- Parameters:
-
[out] numInterfaces The number of interfaces.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 306 of file pal_network.c.
palStatus_t pal_getSockAddrIPV4Addr | ( | const palSocketAddress_t * | address, |
palIpV4Addr_t | ipV4Addr | ||
) |
Get an IPv4 address from an address data structure.
- Parameters:
-
[in] address The address data structure to query. [out] ipV4Addr The IPv4 address to get.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 122 of file pal_network.c.
palStatus_t pal_getSockAddrIPV6Addr | ( | const palSocketAddress_t * | address, |
palIpV6Addr_t | ipV6Addr | ||
) |
Get an IPv6 address from an address data structure.
- Parameters:
-
[in] address The address data structure to query. [out] ipV6Addr The address to get.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 154 of file pal_network.c.
palStatus_t pal_getSockAddrPort | ( | const palSocketAddress_t * | address, |
uint16_t * | port | ||
) |
Get a port from an address data structure.
- Parameters:
-
[in] address The address data structure to query. [out] port The port to get.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 198 of file pal_network.c.
palStatus_t pal_isNonBlocking | ( | palSocket_t | socket, |
bool * | isNonBlocking | ||
) |
Check if a socket is non-blocking.
- Parameters:
-
[in] socket The socket to check. [out] isNonBlocking `True` if the socket is non-blocking, otherwise `false`.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 253 of file pal_network.c.
palStatus_t pal_listen | ( | palSocket_t | socket, |
int | backlog | ||
) |
Use a specific socket to listen for incoming connections. This may also limit the queue of incoming connections.
- Parameters:
-
[in] socket The socket to listen to. The sockets passed to this function should usually be of type `PAL_SOCK_STREAM_SERVER`, though your specific implementation may support other types as well. [in] backlog The amount of pending connections that can be saved for the socket.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 329 of file pal_network.c.
palStatus_t pal_receiveFrom | ( | palSocket_t | socket, |
void * | buffer, | ||
size_t | length, | ||
palSocketAddress_t * | from, | ||
palSocketLength_t * | fromLength, | ||
size_t * | bytesReceived | ||
) |
Receive a payload from a specific socket.
- Parameters:
-
[in] socket The socket to receive from. The socket passed to this function should usually be of type `PAL_SOCK_DGRAM`, though your specific implementation may support other types as well. [out] buffer The buffer for the payload data. [in] length The length of the buffer for the payload data. [out] from The address that sent the payload. [in,out] fromLength The length of `from` on input, the length of the data returned on output. [out] bytesReceived The actual amount of payload data received in the buffer.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 273 of file pal_network.c.
palStatus_t pal_recv | ( | palSocket_t | socket, |
void * | buf, | ||
size_t | len, | ||
size_t * | recievedDataSize | ||
) |
Receive data from a connected socket.
- Parameters:
-
[in] socket The connected socket on which to receive data. The socket passed to this function should usually be of type `PAL_SOCK_STREAM`, though your specific implementation may support other types as well. [out] buf The output buffer for the message data. [in] len The length of the input data buffer. [out] recievedDataSize The length of the data actually received.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 358 of file pal_network.c.
palStatus_t pal_registerNetworkInterface | ( | void * | networkInterfaceContext, |
uint32_t * | interfaceIndex | ||
) |
Register a network interface for use with PAL sockets.
Must be called before other socket functions. Most APIs will not work before an interface is added.
- Parameters:
-
[in] networkInterfaceContext The network interface to be added. This value is OS-specific. [out] interfaceIndex Contains the index assigned to the interface in case it has been assigned successfully. When creating a socket, this index can be used to bind the socket to the interface.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
- Note:
- In mbed OS the
networkInterfaceContext
is the `NetworkInterface` object pointer for the network adapter, assuming that connect has already been called on this interface object. -
In Linux the
networkInterfaceContext
is the string name of the network interface (e.g.eth0
). -
If a context is not applicable on a target configuration, use
NULL
.
Definition at line 62 of file pal_network.c.
palStatus_t pal_send | ( | palSocket_t | socket, |
const void * | buf, | ||
size_t | len, | ||
size_t * | sentDataSize | ||
) |
Send a buffer via a connected socket.
- Parameters:
-
[in] socket The connected socket on which to send data. The socket passed to this function should usually be of type `PAL_SOCK_STREAM`, though your specific implementation may support other types as well. [in] buf The output buffer for the message data. [in] len The length of the input data buffer. [out] sentDataSize The length of the data sent.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 368 of file pal_network.c.
palStatus_t pal_sendTo | ( | palSocket_t | socket, |
const void * | buffer, | ||
size_t | length, | ||
const palSocketAddress_t * | to, | ||
palSocketLength_t | toLength, | ||
size_t * | bytesSent | ||
) |
Send a payload to an address using a specific socket.
- Parameters:
-
[in] socket The socket to use for sending the payload. The socket passed to this function should usually be of type `PAL_SOCK_DGRAM`, though your specific implementation may support other types as well. [in] buffer The buffer for the payload data. [in] length The length of the buffer for the payload data. [in] to The address to which the payload should be sent. [in] toLength The length of the `to` address. [out] bytesSent The actual amount of payload data sent.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 284 of file pal_network.c.
palStatus_t pal_setSockAddrIPV4Addr | ( | palSocketAddress_t * | address, |
palIpV4Addr_t | ipV4Addr | ||
) |
Set an IPv4 address to an address data structure and set `addressType` as IPv4.
- Parameters:
-
[in,out] address The address data structure to configure. [in] ipV4Addr The address value to set.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 112 of file pal_network.c.
palStatus_t pal_setSockAddrIPV6Addr | ( | palSocketAddress_t * | address, |
palIpV6Addr_t | ipV6Addr | ||
) |
Set an IPv6 address to an address data structure and set the `addressType` as IPv6.
- Parameters:
-
[in,out] address The address data structure to configure. [in] ipV6Addr The address value to set.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 171 of file pal_network.c.
palStatus_t pal_setSockAddrPort | ( | palSocketAddress_t * | address, |
uint16_t | port | ||
) |
Set a port to an address data structure.
- Parameters:
-
[in,out] address The address data structure to configure. [in] port The port number to set.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
- Note:
- To set the socket correctly, the `addressType` field of the address must be set correctly. You can set it either directly, or using the `pal_setSockAddrIPV4Addr` or `pal_setSockAddrIPV6Addr` functions.
Definition at line 76 of file pal_network.c.
palStatus_t pal_setSocketOptions | ( | palSocket_t | socket, |
int | optionName, | ||
const void * | optionValue, | ||
palSocketLength_t | optionLength | ||
) |
Set the value for a socket option on a network socket.
- Parameters:
-
[in] socket The socket to configure. [in] optionName The identification of the socket option to set. See palSocketOptionName_t
for supported options.[in] optionValue The buffer holding the option value to set for the option. [in] optionLength The size of the buffer provided for `optionValue`.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 243 of file pal_network.c.
palStatus_t pal_socket | ( | palSocketDomain_t | domain, |
palSocketType_t | type, | ||
bool | nonBlockingSocket, | ||
uint32_t | interfaceNum, | ||
palSocket_t * | socket | ||
) |
Create a network socket.
- Parameters:
-
[in] domain The domain for the created socket. See `palSocketDomain_t` for supported types. [in] type The type of the created socket. See `palSocketType_t` for supported types. [in] nonBlockingSocket If true, the socket is created as non-blocking. [in] interfaceNum The number of the network interface to be used for this socket. Select `PAL_NET_DEFAULT_INTERFACE` for the default interface. [out] socket The created socket is returned through this output parameter.
- Returns:
- PAL_SUCCESS (0) in case of success, or a specific negative error code in case of failure.
Definition at line 233 of file pal_network.c.
palStatus_t pal_unregisterNetworkInterface | ( | uint32_t | interfaceIndex ) |
Unregister a network interface.
- Parameters:
-
interfaceIndex Index of the network interface to be removed.
- Returns:
- PAL_SUCCESS (0) in case of success or a specific negative error code in case of failure.
Definition at line 70 of file pal_network.c.
Generated on Tue Jul 12 2022 20:21:04 by
