|
PAL
A Platform Abstraction Layer connects the mbed-client with the underlying platform.
|
Typedefs | |
| typedef struct pal_in_addr | pal_in_addr_t |
| typedef struct pal_socketAddressInternal | pal_socketAddressInternal_t |
| typedef struct pal_socketAddressInternal6 | pal_socketAddressInternal6_t |
| typedef struct pal_in_addr pal_in_addr_t |
| typedef struct pal_socketAddressInternal6 pal_socketAddressInternal6_t |
| typedef struct pal_socketAddressInternal pal_socketAddressInternal_t |
| palStatus_t pal_bind | ( | palSocket_t | socket, |
| palSocketAddress_t * | myAddress, | ||
| palSocketLength_t | addressLength | ||
| ) |
bind a given socket to a local address
| [in] | socket | the socket to bind |
| [in] | myAddress | the address to which to bind |
| [in] | addressLength | the length of the address passed in myAddress |
| palStatus_t pal_close | ( | palSocket_t * | socket | ) |
close a network socket
| [in,out] | socket | release and zero socket pointed to by given pointer. |
| palStatus_t pal_getNetInterfaceInfo | ( | uint32_t | interfaceNum, |
| palNetInterfaceInfo_t * | interfaceInfo | ||
| ) |
get information regarding the socket at the index/interface number given (this number is returned when registering the socket)
| [in] | interfaceNum | the number of the interface to get information for. |
| [out] | interfaceInfo | will be set to the information for the given interface number. |
| palStatus_t pal_getNumberOfNetInterfaces | ( | uint32_t * | numInterfaces | ) |
get the number of current network interfaces
| [out] | numInterfaces | will hold the number of interfaces after a successful call |
| palStatus_t pal_getSockAddrIPV4Addr | ( | const palSocketAddress_t * | address, |
| palIpV4Addr_t | ipV4Addr | ||
| ) |
get an ipV4 address from a palSocketAddress_t
| [in] | address | the address to set |
| [out] | ipV4Addr | the address that is set in the address |
| palStatus_t pal_getSockAddrIPV6Addr | ( | const palSocketAddress_t * | address, |
| palIpV6Addr_t | ipV6Addr | ||
| ) |
get an ipV6 address from a palSocketAddress_t
| [in] | address | the address to set |
| [out] | ipV6Addr | the address that is set in the address |
| palStatus_t pal_getSockAddrPort | ( | const palSocketAddress_t * | address, |
| uint16_t * | port | ||
| ) |
get a port from a palSocketAddress_t
| [in] | address | the address to set |
| [out] | port | the port that is set in the address |
| palStatus_t pal_getSocketOptions | ( | palSocket_t | socket, |
| palSocketOptionName_t | optionName, | ||
| void * | optionValue, | ||
| palSocketLength_t * | optionLength | ||
| ) |
get options for a given network socket
| [in] | socket | the socket for which to get options |
| [in] | optionName | for which we are setting the option (see enum PAL_NET_SOCKET_OPTION for supported types) |
| [out] | optionValue | the buffer holding the option value returned by the function |
| [in,out] | optionLength | the size of the buffer provided for optionValue when calling the function after the call it will contain the length of data actually written to the optionValue buffer. |
| 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 the given socket
| [in] | socket | the socket to receive from [we expect sockets passed to this function to be of type PAL_SOCK_DGRAM ( the implementation may support other types as well) ] |
| [out] | buffer | the buffer for the payload data |
| [in] | length | of the buffer for the payload data |
| [out] | from | the address which sent the payload |
| [in,out] | fromLength | the length of the 'from' address, after completion will contain the amount of data actually written to the from address |
| [out] | bytesReceived | after the call will contain the actual amount of payload data received to the buffer |
| 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 a single interface is added.
| [in] | networkInterfaceContext | of the network interface to be added (OS specific , e.g. in MbedOS this is the NetworkInterface object pointer for the network adapter [note: we assume connect has already been called on this]) - if not available use NULL . |
| [out] | InterfaceIndex | will contain the index assigned to the interface in case it has been assigned successfully. this index can be used when creating a socket to bind the socket to the interface. |
| 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 the given address using the given socket
| [in] | socket | the socket to use for sending the payload [we expect sockets passed to this function to be of type PAL_SOCK_DGRAM ( the implementation may support other types as well) ] |
| [in] | buffer | the buffer for the payload data |
| [in] | length | of the buffer for the payload data |
| [in] | to | the address to which to payload should be sent |
| [in] | toLength | the length of the 'to' address |
| [out] | bytesSent | after the call will contain the actual amount of payload data sent |
| palStatus_t pal_setSockAddrIPV4Addr | ( | palSocketAddress_t * | address, |
| palIpV4Addr_t | ipV4Addr | ||
| ) |
set an ipV4 address to a palSocketAddress_t and also set the addressType to ipv4
| [in,out] | address | the address to set |
| [in] | ipV4Addr | the address value to set |
| palStatus_t pal_setSockAddrIPV6Addr | ( | palSocketAddress_t * | address, |
| palIpV6Addr_t | ipV6Addr | ||
| ) |
set an ipV6 address to a palSocketAddress_t and also set the addressType to ipv6
| [in,out] | address | the address to set |
| [in] | ipV6Addr | the address value to set |
| palStatus_t pal_setSockAddrPort | ( | palSocketAddress_t * | address, |
| uint16_t | port | ||
| ) |
set a port to a palSocketAddress_t setting it can be done either directly or via the palSetSockAddrIPV4Addr or palSetSockAddrIPV6Addr functions
| [in,out] | address | the address to set |
| [in] | port | the port number to set |
| palStatus_t pal_setSocketOptions | ( | palSocket_t | socket, |
| int | optionName, | ||
| const void * | optionValue, | ||
| palSocketLength_t | optionLength | ||
| ) |
set options for a given network socket
| [in] | socket | the socket for which to get options |
| [in] | optionName | for which we are setting the option (see enum PAL_NET_SOCKET_OPTION for supported types) |
| [in] | optionValue | the buffer holding the option value to set for the given option |
| [in] | optionLength | the size of the buffer provided for optionValue |
| palStatus_t pal_socket | ( | palSocketDomain_t | domain, |
| palSocketType_t | type, | ||
| bool | nonBlockingSocket, | ||
| uint32_t | interfaceNum, | ||
| palSocket_t * | socket | ||
| ) |
get a network socket
| [in] | domain | the domain for the created socket (see palSocketDomain_t for supported types) |
| [in] | type | the type for the created socket (see palSocketType_t for supported types) |
| [in] | nonBlockingSocket | if true the socket created is created as non-blocking (i.e. with O_NONBLOCK set) |
| [in] | interfaceNum | the number of the network interface used for this socket (info in interfaces supported via pal_getNumberOfNetInterfaces and pal_getNetInterfaceInfo ), choose PAL_NET_DEFAULT_INTERFACE for default interface. |
| [out] | socket | socket is returned through this output parameter |
| palStatus_t pal_socketMiniSelect | ( | const palSocket_t | socketsToCheck[PAL_NET_SOCKET_SELECT_MAX_SOCKETS], |
| uint32_t | numberOfSockets, | ||
| pal_timeVal_t * | timeout, | ||
| uint8_t | palSocketStatus[PAL_NET_SOCKET_SELECT_MAX_SOCKETS], | ||
| uint32_t * | numberOfSocketsSet | ||
| ) |
check if one or more (up to PAL_NET_SOCKET_SELECT_MAX_SOCKETS) sockets given has data available for reading/writing/error, the function will block until data is available for one of the given sockets or the timeout expires. To use the function: set the sockets you want to check in the socketsToCheck array and set a timeout, when it returns the socketStatus output will indicate the status of each socket passed in.
| [in] | socketsToCheck | on input: the array of up to 8 sockets handles to check. |
| [in] | numberOfSockets | the number of sockets set in the input socketsToCheck array. |
| [in] | timeout | the amount of time till timeout if no socket activity is detected |
| [out] | socketStatus | will provide information on each socket in the input array indicating which event was set (none, rx, tx, err) check for desired event using macros. |
| [out] | numberOfSocketsSet | is the total number of sockets set in all three data sets (tx, rx, err)after the function completes |
1.8.11