![]() |
MQTT C Client Libraries Internals
|
Socket buffering related functions. More...
#include "SocketBuffer.h"#include "LinkedList.h"#include "Log.h"#include "Messages.h"#include "StackTrace.h"#include <stdlib.h>#include <stdio.h>#include <string.h>#include "Heap.h"
Functions | |
| int | socketcompare (void *a, void *b) |
| List callback function for comparing socket_queues by socket. More... | |
| int | SocketBuffer_newDefQ (void) |
| Create a new default queue when one has just been used. | |
| void | SocketBuffer_freeDefQ (void) |
| Free the default queue memory. | |
| int | pending_socketcompare (void *a, void *b) |
| List callback function for comparing pending_writes by socket. More... | |
| int | SocketBuffer_initialize (void) |
| Initialize the socketBuffer module. | |
| void | SocketBuffer_terminate (void) |
| Terminate the socketBuffer module. | |
| void | SocketBuffer_cleanup (SOCKET socket) |
| Cleanup any buffers for a specific socket. More... | |
| char * | SocketBuffer_getQueuedData (SOCKET socket, size_t bytes, size_t *actual_len) |
| Get any queued data for a specific socket. More... | |
| int | SocketBuffer_getQueuedChar (SOCKET socket, char *c) |
| Get any queued character for a specific socket. More... | |
| void | SocketBuffer_interrupted (SOCKET socket, size_t actual_len) |
| A socket read was interrupted so we need to queue data. More... | |
| char * | SocketBuffer_complete (SOCKET socket) |
| A socket read has now completed so we can get rid of the queue. More... | |
| void | SocketBuffer_queueChar (SOCKET socket, char c) |
| Queued a Charactor to a specific socket. More... | |
| int | SocketBuffer_pendingWrite (SOCKET socket, int count, iobuf *iovecs, int *frees, size_t total, size_t bytes) |
| A socket write was interrupted so store the remaining data. More... | |
| pending_writes * | SocketBuffer_getWrite (SOCKET socket) |
| Get any queued write data for a specific socket. More... | |
| int | SocketBuffer_writeComplete (SOCKET socket) |
| A socket write has now completed so we can get rid of the queue. More... | |
| pending_writes * | SocketBuffer_updateWrite (SOCKET socket, char *topic, char *payload) |
| Update the queued write data for a socket in the case of QoS 0 messages. More... | |
Variables | |
| static socket_queue * | def_queue |
| Default input queue buffer. | |
| static List * | queues |
| List of queued input buffers. | |
| static List | writes |
| List of queued write buffers. | |
Socket buffering related functions.
Some other related functions are in the Socket module
| int pending_socketcompare | ( | void * | a, |
| void * | b | ||
| ) |
List callback function for comparing pending_writes by socket.
| a | first integer value |
| b | second integer value |
| void SocketBuffer_cleanup | ( | SOCKET | socket | ) |
Cleanup any buffers for a specific socket.
| socket | the socket to clean up |

| char* SocketBuffer_complete | ( | SOCKET | socket | ) |
A socket read has now completed so we can get rid of the queue.
| socket | the socket for which the operation is now complete |

| int SocketBuffer_getQueuedChar | ( | SOCKET | socket, |
| char * | c | ||
| ) |
Get any queued character for a specific socket.
| socket | the socket to get queued data for |
| c | the character returned if any |

| char* SocketBuffer_getQueuedData | ( | SOCKET | socket, |
| size_t | bytes, | ||
| size_t * | actual_len | ||
| ) |
Get any queued data for a specific socket.
| socket | the socket to get queued data for |
| bytes | the number of bytes of data to retrieve |
| actual_len | the actual length returned |

| pending_writes* SocketBuffer_getWrite | ( | SOCKET | socket | ) |
Get any queued write data for a specific socket.
| socket | the socket to get queued data for |

| void SocketBuffer_interrupted | ( | SOCKET | socket, |
| size_t | actual_len | ||
| ) |
A socket read was interrupted so we need to queue data.
| socket | the socket to get queued data for |
| actual_len | the actual length of data that was read |

| int SocketBuffer_pendingWrite | ( | SOCKET | socket, |
| int | count, | ||
| iobuf * | iovecs, | ||
| int * | frees, | ||
| size_t | total, | ||
| size_t | bytes | ||
| ) |
A socket write was interrupted so store the remaining data.
| socket | the socket for which the write was interrupted |
| count | the number of iovec buffers |
| iovecs | buffer array |
| frees | a set of flags indicating which of the iovecs array should be freed |
| total | total data length to be written |
| bytes | actual data length that was written |

| void SocketBuffer_queueChar | ( | SOCKET | socket, |
| char | c | ||
| ) |
Queued a Charactor to a specific socket.
| socket | the socket for which to queue char for |
| c | the character to queue |

| pending_writes* SocketBuffer_updateWrite | ( | SOCKET | socket, |
| char * | topic, | ||
| char * | payload | ||
| ) |
Update the queued write data for a socket in the case of QoS 0 messages.
| socket | the socket for which the operation is now complete |
| topic | the topic of the QoS 0 write |
| payload | the payload of the QoS 0 write |

| int SocketBuffer_writeComplete | ( | SOCKET | socket | ) |
A socket write has now completed so we can get rid of the queue.
| socket | the socket for which the operation is now complete |

| int socketcompare | ( | void * | a, |
| void * | b | ||
| ) |
List callback function for comparing socket_queues by socket.
| a | first integer value |
| b | second integer value |