PAL A Platform Abstraction Layer connects the mbed-client with the underlying platform.

- Main Page
- Data Structures
- Files

- File List
- Globals

Macros | Functions
pal_plat_socket_lwip.cpp File Reference
`#include "pal_common.h"`
`#include "pal_plat_socket.h"`
`#include "/tmp/mbedos/mbed-os/features/net/FEATURE_IPV4/lwip-interface/lwip/include/lwip/sockets.h"`

## Macros
#define | PAL_POSIX_ERROR_CODE (-1)

## Functions
palStatus_t | pal_plat_sockets_init (void *context)
palStatus_t | pal_plat_socket (palSocketDomain_t domain, palSocketType_t type, bool nonBlockingSocket, int interfaceNum, palSocket_t *socket)
palStatus_t | pal_plat_getSocketOptions (palSocket_t socket, palSocketOptionName_t optionName, void *optionValue, palSocketLength_t *optionLength)
palStatus_t | pal_plat_setSocketOptions (palSocket_t socket, int optionName, const void *optionValue, palSocketLength_t optionLength)
palStatus_t | pal_plat_bind (palSocket_t socket, palSocketAddress_t *myAddress, palSocketLength_t addressLength)
palStatus_t | pal_plat_receiveFrom (palSocket_t socket, void *buffer, size_t length, palSocketAddress_t *from, palSocketLength_t *fromLength, size_t *bytesReceived)
palStatus_t | pal_plat_sendTo (palSocket_t socket, const void *buffer, size_t length, const palSocketAddress_t *to, palSocketLength_t toLength, size_t *bytesSent)
palStatus_t | pal_plat_close (palSocket_t *socket)
palStatus_t | pal_plat_getNumberOfNetInterfaces (uint32_t *numInterfaces)
palStatus_t | pal_plat_getNetInterfaceInfo (uint32_t interfaceNum, palNetInterfaceInfo_t *interfaceInfo)
palStatus_t | pal_plat_socketMiniSelect (const palSocket_t socketsToCheck[PAL_NET_SOCKET_SELECT_MAX_SOCKETS], unsigned int numberOfSockets, pal_timeVal_t *timeout, palSocketStatus_t socketStatus, int *numberOfSocketsSet)

## Macro Definition Documentation

#define PAL_POSIX_ERROR_CODE (-1)

## Function Documentation

palStatus_t pal_plat_bind | ( | palSocket_t | socket,
|  | palSocketAddress_t * | myAddress,
|  | palSocketLength_t | addressLength
| ) |  |

Bind a given 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
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_close | ( | palSocket_t * | socket | ) |

Close a network socket. NOTE: recieves palSocket_t* and not palSocket_t so that it can zero the socket to avoid re-use.

Parameters

  [in,out] | socket | Release and zero socket pointed to by given pointer.

Returns
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_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).

Parameters

  [in] | interfaceNum | The number of the interface to get information for.
  [out] | interfaceInfo | The information for the given interface number.

Returns
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_getNumberOfNetInterfaces | ( | uint32_t * | numInterfaces | ) |

Get the number of current network interfaces (interfaces that have been registered through).

Parameters

  [out] | numInterfaces | The number of interfaces after a successful call.

Returns
  The status as in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_getSocketOptions | ( | palSocket_t | socket,
|  | palSocketOptionName_t | optionName,
|  | void * | optionValue,
|  | palSocketLength_t * | optionLength
| ) |  |

Get options for a given network socket. Only a few options are supported (see palSocketOptionName_t for supported options).

Parameters

  [in] | socket | The socket for which to get options.
  [in] | optionName | The name for which to set 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 contains the length of data actually written to the optionValue buffer.

Returns
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_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.

Parameters

  [in] | socket | The socket to receive from [sockets passed to this function should be of type PAL_SOCK_DGRAM (the 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 [optional - if not required pass NULL].
  [in,out] | fromLength | The length of the 'from' address. When completed, this contains the amount of data actually written to the from address [optional - if not required pass NULL].
  [out] | bytesReceived | The actual amount of payload data received to the buffer.

Returns
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_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.

Parameters

  [in] | socket | The socket to use for sending the payload [sockets passed to this function should be of type PAL_SOCK_DGRAM (the 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
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_setSocketOptions | ( | palSocket_t | socket,
|  | int | optionName,
|  | const void * | optionValue,
|  | palSocketLength_t | optionLength
| ) |  |

Set options for a given network socket. Only a few options are supported (see palSocketOptionName_t for supported options).

Parameters

  [in] | socket | The socket for which to get options.
  [in] | optionName | The name for which to set 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.

Returns
  The status in the form of PalStatus_t; PAL_SUCCESS (0) in case of success, a specific negative error code in case of failure.

palStatus_t pal_plat_socket | ( | palSocketDomain_t | domain,
|  | palSocketType_t | type,
|  | bool | nonBlockingSocket,
|  | int | interfaceNum,
|  | palSocket_t * | socket
| ) |  |

palStatus_t pal_plat_socketMiniSelect | ( | const palSocket_t | socketsToCheck[PAL_NET_SOCKET_SELECT_MAX_SOCKETS],
|  | unsigned int | numberOfSockets,
|  | pal_timeVal_t * | timeout,
|  | palSocketStatus_t | socketStatus,
|  | int * | numberOfSocketsSet
| ) |  |

palStatus_t pal_plat_sockets_init | ( | void * | context | ) |