socket/xmlBlasterZlib.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------
00002 Name:      xmlBlasterZlib.h
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   SOCKET internal header (not included directly by clients)
00006 Author:    "Marcel Ruff" <xmlBlaster@marcelruff.info>
00007 See:       http://www.gzip.org/zlib/
00008 -----------------------------------------------------------------------------*/
00009 #ifndef XMLBLASTER_ZLIB_H
00010 #define XMLBLASTER_ZLIB_H
00011 
00012 #ifdef __cplusplus
00013 #ifndef XMLBLASTER_C_COMPILE_AS_CPP /* 'g++ -DXMLBLASTER_C_COMPILE_AS_CPP ...' allows to compile the lib as C++ code */
00014 extern "C" {
00015 #endif
00016 #endif
00017 
00018 #include <util/basicDefs.h>
00019 #if XMLBLASTER_ZLIB==1
00020 #  include <zlib.h>
00021 #endif
00022 
00023 #define XMLBLASTER_ZLIB_WRITE_COMPBUFFER_LEN 20000
00024 
00034 typedef struct XmlBlasterZlibWriteBuffers {
00035    int debug;             
00036 #if XMLBLASTER_ZLIB==1
00037    z_stream c_stream;     
00038    Bytef compBuffer[XMLBLASTER_ZLIB_WRITE_COMPBUFFER_LEN]; 
00039 #endif
00040 } XmlBlasterZlibWriteBuffers;
00041 
00042 
00043 #define XMLBLASTER_ZLIB_READ_COMPBUFFER_LEN 20000
00044 
00053 typedef struct XmlBlasterZlibReadBuffers {
00054    int debug;             
00055 #if XMLBLASTER_ZLIB==1
00056    z_stream c_stream;     
00057    Bytef compBuffer[XMLBLASTER_ZLIB_READ_COMPBUFFER_LEN]; 
00058    Bytef *currCompBufferP; 
00059    uInt currCompBytes;     
00060 #endif
00061 } XmlBlasterZlibReadBuffers;
00062 
00063 
00068 /*Dll_Export*/extern int xmlBlaster_initZlibWriter(XmlBlasterZlibWriteBuffers *zlibWriteBufP);
00069 
00077 extern ssize_t xmlBlaster_writenCompressed(XmlBlasterZlibWriteBuffers *zlibWriteBufP, const int fd, const char * const ptr, size_t const nbytes);
00078 
00082 extern int xmlBlaster_endZlibWriter(XmlBlasterZlibWriteBuffers *zlibWriteBufP);
00083 
00088 extern int xmlBlaster_initZlibReader(XmlBlasterZlibReadBuffers *zlibReadBufP);
00089 
00098 extern ssize_t xmlBlaster_readnCompressed(XmlBlasterZlibReadBuffers *zlibReadBufP, int fd, char *ptr, size_t nbytes, XmlBlasterNumReadFunc fpNumRead, void *userP2);
00099 
00104 extern int xmlBlaster_endZlibReader(XmlBlasterZlibReadBuffers *zlibReadBufP);
00105 
00106 #ifdef __cplusplus
00107 #ifndef XMLBLASTER_C_COMPILE_AS_CPP
00108 } /* extern "C" */
00109 #endif
00110 #endif
00111 
00112 #endif /* XMLBLASTER_ZLIB_H */
00113