73 #include <arpa/inet.h> 76 #define MQTT_PAL_HTONS(s) htons(s) 77 #define MQTT_PAL_NTOHS(s) ntohs(s) 79 #define MQTT_PAL_TIME() time(NULL) 81 typedef time_t mqtt_pal_time_t;
82 typedef pthread_mutex_t mqtt_pal_mutex_t;
84 #define MQTT_PAL_MUTEX_INIT(mtx_ptr) pthread_mutex_init(mtx_ptr, NULL) 85 #define MQTT_PAL_MUTEX_LOCK(mtx_ptr) pthread_mutex_lock(mtx_ptr) 86 #define MQTT_PAL_MUTEX_UNLOCK(mtx_ptr) pthread_mutex_unlock(mtx_ptr) 88 #ifndef MQTT_USE_CUSTOM_SOCKET_HANDLE 90 #include <openssl/bio.h> 91 typedef BIO* mqtt_pal_socket_handle;
93 typedef int mqtt_pal_socket_handle;
109 ssize_t
mqtt_pal_sendall(mqtt_pal_socket_handle fd,
const void* buf,
size_t len,
int flags);
122 ssize_t
mqtt_pal_recvall(mqtt_pal_socket_handle fd,
void* buf,
size_t bufsz,
int flags);
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.
ssize_t mqtt_pal_recvall(mqtt_pal_socket_handle fd, void *buf, size_t bufsz, int flags)
Non-blocking receive all the byte available.