socket/xmlBlasterZlib.h File Reference

#include <util/basicDefs.h>
#include <zlib.h>

Include dependency graph for xmlBlasterZlib.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  XmlBlasterZlibWriteBuffers
 Helper struct to compress a byte buffer before putting it into the socket. More...
struct  XmlBlasterZlibReadBuffers
 Helper struct to uncompress a byte buffer coming from the socket connection. More...

Defines

#define XMLBLASTER_ZLIB_WRITE_COMPBUFFER_LEN   20000
#define XMLBLASTER_ZLIB_READ_COMPBUFFER_LEN   20000

Functions

int xmlBlaster_initZlibWriter (XmlBlasterZlibWriteBuffers *zlibWriteBufP)
 Call only once for a socket connection stream.
ssize_t xmlBlaster_writenCompressed (XmlBlasterZlibWriteBuffers *zlibWriteBufP, int fd, char *ptr, size_tnbytes)
 Compress given bytes with zlib and write them to the socket.
int xmlBlaster_endZlibWriter (XmlBlasterZlibWriteBuffers *zlibWriteBufP)
 
See also:
xmlBlasterZlib.h

int xmlBlaster_initZlibReader (XmlBlasterZlibReadBuffers *zlibReadBufP)
 Call only once for a socket connection stream.
ssize_t xmlBlaster_readnCompressed (XmlBlasterZlibReadBuffers *zlibReadBufP, int fd, char *ptr, size_t nbytes, XmlBlasterNumReadFunc fpNumRead, void *userP2)
 Read compressed data from the socket and uncompress it.
int xmlBlaster_endZlibReader (XmlBlasterZlibReadBuffers *zlibReadBufP)
 Cleanup after socket is closed.


Define Documentation

#define XMLBLASTER_ZLIB_READ_COMPBUFFER_LEN   20000

Definition at line 43 of file xmlBlasterZlib.h.

Referenced by xmlBlaster_readnCompressed().

#define XMLBLASTER_ZLIB_WRITE_COMPBUFFER_LEN   20000

Definition at line 23 of file xmlBlasterZlib.h.

Referenced by xmlBlaster_writenCompressed().


Function Documentation

int xmlBlaster_endZlibReader ( XmlBlasterZlibReadBuffers zlibReadBufP  ) 

Cleanup after socket is closed.

Parameters:
zlibReadBufP Struct holding necessary variables to use zlib

Definition at line 281 of file xmlBlasterZlib.c.

References XmlBlasterZlibReadBuffers::c_stream.

Referenced by freeXmlBlasterConnectionUnparsed().

int xmlBlaster_endZlibWriter ( XmlBlasterZlibWriteBuffers zlibWriteBufP  ) 

See also:
xmlBlasterZlib.h

Definition at line 149 of file xmlBlasterZlib.c.

References XmlBlasterZlibWriteBuffers::c_stream, XmlBlasterZlibWriteBuffers::debug, and dumpZlib().

Referenced by freeXmlBlasterConnectionUnparsed().

Here is the call graph for this function:

int xmlBlaster_initZlibReader ( XmlBlasterZlibReadBuffers zlibReadBufP  ) 

Call only once for a socket connection stream.

Returns:
Z_OK==0 or error from inflateInit()

Definition at line 166 of file xmlBlasterZlib.c.

References XmlBlasterZlibReadBuffers::c_stream, XmlBlasterZlibReadBuffers::compBuffer, XmlBlasterZlibReadBuffers::currCompBufferP, XmlBlasterZlibReadBuffers::currCompBytes, and XmlBlasterZlibReadBuffers::debug.

Referenced by initConnection().

int xmlBlaster_initZlibWriter ( XmlBlasterZlibWriteBuffers zlibWriteBufP  ) 

Call only once for a socket connection stream.

Returns:
Z_OK==0 or error from deflateInit()

Definition at line 68 of file xmlBlasterZlib.c.

References XmlBlasterZlibWriteBuffers::c_stream, and XmlBlasterZlibWriteBuffers::debug.

Referenced by initConnection().

ssize_t xmlBlaster_readnCompressed ( XmlBlasterZlibReadBuffers zlibReadBufP,
int  fd,
char *  ptr,
size_t  nbytes,
XmlBlasterNumReadFunc  fpNumRead,
void *  userP2 
)

Read compressed data from the socket and uncompress it.

Parameters:
zlibReadBufP Struct holding necessary variables to use zlib
fd The socket descriptor
ptr The empty buffer which gets filled with raw bytes from socket (out parameter)
nbytes The max. size of 'ptr'
Returns:
number of bytes read, -1 is EOF

Definition at line 193 of file xmlBlasterZlib.c.

References XmlBlasterZlibReadBuffers::c_stream, XmlBlasterZlibReadBuffers::compBuffer, XmlBlasterZlibReadBuffers::currCompBufferP, XmlBlasterZlibReadBuffers::currCompBytes, XmlBlasterZlibReadBuffers::debug, dumpZlib(), and XMLBLASTER_ZLIB_READ_COMPBUFFER_LEN.

Referenced by readnCompressed().

Here is the call graph for this function:

ssize_t xmlBlaster_writenCompressed ( XmlBlasterZlibWriteBuffers zlibWriteBufP,
int  fd,
char *  ptr,
size_tnbytes   
)

Compress given bytes with zlib and write them to the socket.

Parameters:
fd The socket descriptor
ptr The buffer with raw bytes
nbytes The number of bytes in 'ptr'
Returns:
Number of bytes written

Definition at line 92 of file xmlBlasterZlib.c.

References XmlBlasterZlibWriteBuffers::c_stream, XmlBlasterZlibWriteBuffers::compBuffer, XmlBlasterZlibWriteBuffers::debug, dumpZlib(), writen(), and XMLBLASTER_ZLIB_WRITE_COMPBUFFER_LEN.

Referenced by writenCompressed().

Here is the call graph for this function: