MQTT-C
Functions
Platform abstraction layer

Documentation of the types and calls required to port MQTT-C to a new platform. More...

Functions

ssize_t mqtt_pal_sendall (mqtt_pal_socket_handle fd, const void *buf, size_t len, int flags)
 Sends all the bytes in a buffer. More...
 
ssize_t mqtt_pal_recvall (mqtt_pal_socket_handle fd, void *buf, size_t bufsz, int flags)
 Non-blocking receive all the byte available. More...
 

Detailed Description

Documentation of the types and calls required to port MQTT-C to a new platform.

mqtt_pal.h is the only header file included in mqtt.c. Therefore, to port MQTT-C to a new platform the following types, functions, constants, and macros must be defined in mqtt_pal.h:

Additionally, three macro's are required:

Lastly, mqtt_pal_sendall and mqtt_pal_recvall, must be implemented in mqtt_pal.c for sending and receiving data using the platforms socket calls.

Function Documentation

◆ mqtt_pal_recvall()

ssize_t mqtt_pal_recvall ( mqtt_pal_socket_handle  fd,
void *  buf,
size_t  bufsz,
int  flags 
)

Non-blocking receive all the byte available.

Parameters
[in]fdThe file-descriptor (or handle) of the socket.
[in]bufA pointer to the receive buffer.
[in]bufszThe max number of bytes that can be put into buf.
[in]flagsFlags which are passed to the underlying socket.
Returns
The number of bytes received if successful, an MQTTErrors otherwise.

◆ mqtt_pal_sendall()

ssize_t mqtt_pal_sendall ( mqtt_pal_socket_handle  fd,
const void *  buf,
size_t  len,
int  flags 
)

Sends all the bytes in a buffer.

Parameters
[in]fdThe file-descriptor (or handle) of the socket.
[in]bufA pointer to the first byte in the buffer to send.
[in]lenThe number of bytes to send (starting at buf).
[in]flagsFlags which are passed to the underlying socket.
Returns
The number of bytes sent if successful, an MQTTErrors otherwise.