SocketBuffer.c File Reference

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 <memory.h>
#include "Heap.h"
Include dependency graph for SocketBuffer.c:

Functions

int socketcompare (void *a, void *b)
 List callback function for comparing socket_queues by socket.
void 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.
void SocketBuffer_initialize (void)
 Initialize the socketBuffer module.
void SocketBuffer_terminate (void)
 Terminate the socketBuffer module.
void SocketBuffer_cleanup (int socket)
 Cleanup any buffers for a specific socket.
char * SocketBuffer_getQueuedData (int socket, size_t bytes, size_t *actual_len)
 Get any queued data for a specific socket.
int SocketBuffer_getQueuedChar (int socket, char *c)
 Get any queued character for a specific socket.
void SocketBuffer_interrupted (int socket, size_t actual_len)
 A socket read was interrupted so we need to queue data.
char * SocketBuffer_complete (int socket)
 A socket read has now completed so we can get rid of the queue.
void SocketBuffer_queueChar (int socket, char c)
 A socket operation had now completed so we can get rid of the queue.
void SocketBuffer_pendingWrite (int socket, int count, iobuf *iovecs, int *frees, size_t total, size_t bytes)
 A socket write was interrupted so store the remaining data.
pending_writesSocketBuffer_getWrite (int socket)
 Get any queued write data for a specific socket.
int SocketBuffer_writeComplete (int socket)
 A socket write has now completed so we can get rid of the queue.
pending_writesSocketBuffer_updateWrite (int socket, char *topic, char *payload)
 Update the queued write data for a socket in the case of QoS 0 messages.

Variables

static socket_queuedef_queue
 Default input queue buffer.
static Listqueues
 List of queued input buffers.
static List writes
 List of queued write buffers.

Detailed Description

Socket buffering related functions.

Some other related functions are in the Socket module


Function Documentation

int pending_socketcompare ( void *  a,
void *  b 
)

List callback function for comparing pending_writes by socket.

Parameters:
a first integer value
b second integer value
Returns:
boolean indicating whether a and b are equal
void SocketBuffer_cleanup ( int  socket  ) 

Cleanup any buffers for a specific socket.

Parameters:
socket the socket to clean up

Here is the call graph for this function:

char* SocketBuffer_complete ( int  socket  ) 

A socket read has now completed so we can get rid of the queue.

Parameters:
socket the socket for which the operation is now complete
Returns:
pointer to the default queue data

Here is the call graph for this function:

int SocketBuffer_getQueuedChar ( int  socket,
char *  c 
)

Get any queued character for a specific socket.

Parameters:
socket the socket to get queued data for
c the character returned if any
Returns:
completion code

Here is the call graph for this function:

char* SocketBuffer_getQueuedData ( int  socket,
size_t  bytes,
size_t *  actual_len 
)

Get any queued data for a specific socket.

Parameters:
socket the socket to get queued data for
bytes the number of bytes of data to retrieve
actual_len the actual length returned
Returns:
the actual data

Here is the call graph for this function:

pending_writes* SocketBuffer_getWrite ( int  socket  ) 

Get any queued write data for a specific socket.

Parameters:
socket the socket to get queued data for
Returns:
pointer to the queued data or NULL

Here is the call graph for this function:

void SocketBuffer_interrupted ( int  socket,
size_t  actual_len 
)

A socket read was interrupted so we need to queue data.

Parameters:
socket the socket to get queued data for
actual_len the actual length of data that was read

Here is the call graph for this function:

void SocketBuffer_pendingWrite ( int  socket,
int  count,
iobuf *  iovecs,
int *  frees,
size_t  total,
size_t  bytes 
)

A socket write was interrupted so store the remaining data.

Parameters:
socket the socket for which the write was interrupted
count the number of iovec buffers
iovecs buffer array
total total data length to be written
bytes actual data length that was written

Here is the call graph for this function:

void SocketBuffer_queueChar ( int  socket,
char  c 
)

A socket operation had now completed so we can get rid of the queue.

Parameters:
socket the socket for which the operation is now complete
c the character to queue

Here is the call graph for this function:

pending_writes* SocketBuffer_updateWrite ( int  socket,
char *  topic,
char *  payload 
)

Update the queued write data for a socket in the case of QoS 0 messages.

Parameters:
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
Returns:
pointer to the updated queued data structure, or NULL

Here is the call graph for this function:

int SocketBuffer_writeComplete ( int  socket  ) 

A socket write has now completed so we can get rid of the queue.

Parameters:
socket the socket for which the operation is now complete
Returns:
completion code, boolean - was the queue removed?

Here is the call graph for this function:

int socketcompare ( void *  a,
void *  b 
)

List callback function for comparing socket_queues by socket.

Parameters:
a first integer value
b second integer value
Returns:
boolean indicating whether a and b are equal
 All Data Structures Files Functions Variables Typedefs Defines

Generated on 30 Jul 2017 for MQTT C Client Libraries Internals by  doxygen 1.6.1