Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6gzip.h
Go to the documentation of this file.
1 
10 #ifndef P6GZIP_H__
11 #define P6GZIP_H__ 1
12 
13 #include "p6datastream.h"
14 #include "p6iohandler.h"
15 
16 namespace P6R {
17 
19  static const P6GZSTREAMFLAGS P6GZSTREAM_NOFLAGS = 0x00000000;
20  static const P6GZSTREAMFLAGS P6GZSTREAM_COMPRESSMASK = 0x000f0000;
21  static const P6GZSTREAMFLAGS P6GZSTREAM_COMPRESS = 0x00000000;
22  static const P6GZSTREAMFLAGS P6GZSTREAM_DECOMPRESS = 0x00010000;
23  #define P6GZCOMPRESSTYPE(f) ((f) & P6GZSTREAM_COMPRESSMASK)
24  #define P6GZCOMPRESSING(f) (P6GZSTREAM_COMPRESS == P6GZCOMPRESSTYPE((f)) ? P6TRUE : P6FALSE)
25  #define P6GZDECOMPRESSING(f) (P6GZSTREAM_DECOMPRESS == P6GZCOMPRESSTYPE((f)) ? P6TRUE : P6FALSE)
26 
28  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPPERMASK = 0x0000000f;
29  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPNONE = 0x00000000;
30  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPZLIB = 0x00000001;
34  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPGZIP = 0x00000002;
37  #define P6GZWRAPPERTYPE(f) ((f) & P6GZSTREAM_WRAPPERMASK)
38  #define P6GZ_WRAPISGZIP(f) (P6GZWRAPPERTYPE((f)) == P6GZSTREAM_WRAPGZIP ? P6TRUE : P6FALSE)
39  #define P6GZ_WRAPISZLIB(f) (P6GZWRAPPERTYPE((f)) == P6GZSTREAM_WRAPZLIB ? P6TRUE : P6FALSE)
40  #define P6GZ_WRAPISNONE(f) (P6GZWRAPPERTYPE((f)) == P6GZSTREAM_WRAPNONE ? P6TRUE : P6FALSE)
41 
43  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATEGYMASK = 0x000000f0;
44  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATDEF = 0x00000000;
45  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATFILTERED= 0x00000010;
46  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATHUFFMAN = 0x00000020;
47  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATRLE = 0x00000040;
48  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATFIXED = 0x00000080;
49  #define P6GZSTRATEGYTYPE(f) ((f) & P6GZSTREAM_STRATEGYMASK)
50 
52  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHMASK = 0x0000ff00;
53  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHDEFAULT = 0x00000000;
54  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHNONE = 0x00000100;
55  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHPARTIAL = 0x00000200;
56  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHSYNC = 0x00000400;
57  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHFULL = 0x00000800;
58  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHFINISH = 0x00001000;
59  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHBLOCK = 0x00002000;
60  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHTREES = 0x00004000;
61  #define P6GZFLUSHTYPE(f) ((f) & P6GZSTREAM_FLUSHMASK)
62 
64  static const P6GZCOMPRESSLEVEL P6GZCL_MIN = 0;
65  static const P6GZCOMPRESSLEVEL P6GZCL_MAX = 9;
66  static const P6GZCOMPRESSLEVEL P6GZCL_DEFAULT = 6;
67 
68 
80  interface p6IZlibSSH : public p6ICom
81  {
82 
99 
122  P6COMMETHOD process(const P6R::P6VOID *pInputData,
123  P6R::P6SIZE cbInputData,
124  P6R::P6VOID *pOutputData,
125  P6R::P6SIZE cbOutputData,
126  P6R::P6SIZE *pcbOutput,
127  P6R::P6BOOL bLast) = 0;
128 
136  P6COMMETHOD close() = 0;
137  };
138 
139  // {2AD59EEB-F169-4472-B235-968244ADE914}
140  #define IF_p6IZlibSSH {0x2AD59EEB,0xF169,0x4472,{0xB2,0x35,0x96,0x82,0x44,0xAD,0xE9,0x14}}
141 
142  // {C20335D0-7C72-467F-BDE9-C0825F07FD47}
143  #define COMP_p6ZlibSSH {0xC20335D0,0x7C72,0x467F,{0xBD,0xE9,0xC0,0x82,0x5F,0x07,0xFD,0x47}}
144 
145 
146 
148  static const P6GZIOFLAGS P6GZIOF_NOFLAGS = 0x00000000;
149  static const P6GZIOFLAGS P6GZIOF_NOHEADER = 0x00000001;
158  interface p6IGzipInflateToStream : public p6ICom
159  {
171 
181  P6COMMETHOD process(P6R::P6VOID *pSource,P6R::P6SIZE cbSource) = 0;
182 
190  P6COMMETHOD end() = 0;
191  };
192 
193  /*{D23B9240-4923-34C9-B3FE-C4B18263FCE5}*/
194  #define IF_p6IGzipInflateToStream {0xD23B9240,0x4923,0x34C9,{0xB3,0xFE,0xC4,0xB1,0x82,0x63,0xFC,0xE5}}
195 
196  /*{187AA4D2-475C-3167-32AD-A48361B3F818}*/
197  #define COMP_p6GzipInflateToStream {0x187AA4D2,0x475C,0x3167,{0x32,0xAD,0xA4,0x83,0x61,0xB3,0xF8,0x18}}
198 
199 
206  interface p6IGzipDeflateToStream : public p6ICom
207  {
219 
229  P6COMMETHOD process(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer) = 0;
230 
238  P6COMMETHOD end() = 0;
239  };
240 
241  /*{E0408340-4DE1-3292-611B-1CB2F30DB592}*/
242  #define IF_p6IGzipDeflateToStream {0xE0408340,0x4DE1,0x3292,{0x61,0x1B,0x1C,0xB2,0xF3,0x0D,0xB5,0x92}}
243 
244  /*{19B5F73C-100A-4514-8E66-266AAC9CBFA0}*/
245  #define COMP_p6GzipDeflateToStream {0x19B5F73C,0x100A,0x4514,{0x8E,0x66,0x26,0x6A,0xAC,0x9C,0xBF,0xA0}}
246 
247 
256  {
267  P6COMMETHOD initialize(P6R::p6IIoReadHandler *pIo,P6R::P6GZIOFLAGS fFlags) = 0;
268 
281  P6COMMETHOD read(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer,P6R::P6SIZE *pcbRead) = 0;
282 
289  P6COMMETHOD end() = 0;
290  };
291 
292  /*{566626EB-44F9-A909-6C18-CAB536293EC1}*/
293  #define IF_p6IGzipInflateFromHandler {0x566626EB,0x44F9,0xA909,{0x6C,0x18,0xCA,0xB5,0x36,0x29,0x3E,0xC1}}
294 
295  /*{0BD83415-4965-1E5F-D65E-DF8416EAC298}*/
296  #define COMP_p6GzipInflateFromHandler {0x0BD83415,0x4965,0x1E5F,{0xD6,0x5E,0xDF,0x84,0x16,0xEA,0xC2,0x98}}
297 
298 
307  {
318  P6COMMETHOD initialize(P6R::p6IIoWriteHandler *pIo,P6R::P6GZIOFLAGS fFlags) = 0;
319 
328  P6COMMETHOD write(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer) = 0;
329 
336  P6COMMETHOD end() = 0;
337  };
338 
339  /*{D8F57EA1-FC0D-4EF3-99C8-B076289F907E}*/
340  #define IF_p6IGzipDeflateToHandler {0xD8F57EA1,0xFC0D,0x4EF3,{0x99,0xC8,0xB0,0x76,0x28,0x9F,0x90,0x7E}}
341 
342  /*{33A7D609-14AB-4522-B97E-435419C8E9DC}*/
343  #define COMP_p6GzipDeflateToHandler {0x33A7D609,0x14AB,0x4522,{0xB9,0x7E,0x43,0x54,0x19,0xC8,0xE9,0xDC}}
344 
345 
355  {
370  P6COMMETHOD initialize(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer,P6R::P6GZIOFLAGS fFlags) = 0;
371 
390  P6COMMETHOD inflate(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer,P6R::P6SIZE *pcbInflated) = 0;
391  };
392 
393  /*{F94DA9AB-CBD6-4E05-847E-37D8E78A8508}*/
394  #define IF_p6IGzipInflateBuffer {0xF94DA9AB,0xCBD6,0x4E05,{0x84,0x7E,0x37,0xD8,0xE7,0x8A,0x85,0x08}}
395 
396  /*{C125EDDE-F846-47D7-8E62-709F54B0205D}*/
397  #define COMP_p6GzipInflateBuffer {0xC125EDDE,0xF846,0x47D7,{0x8E,0x62,0x70,0x9F,0x54,0xB0,0x20,0x5D}}
398 
399 
409  {
426  P6COMMETHOD initialize(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer,P6R::P6INT nLevel,P6R::P6GZIOFLAGS fFlags) = 0;
427 
451  P6COMMETHOD deflate(P6R::P6VOID *pBuffer,P6R::P6SIZE cbBuffer,P6R::P6SIZE *pcbDeflated) = 0;
452  };
453 
454  /*{6A947420-833E-4EF5-9D7B-3E80F0F3C631}*/
455  #define IF_p6IGzipDeflateBuffer {0x6A947420,0x833E,0x4EF5,{0x9D,0x7B,0x3E,0x80,0xF0,0xF3,0xC6,0x31}}
456 
457  /*{94A8B513-5AD4-4917-A8E5-06CC6A32BC4D}*/
458  #define COMP_p6GzipDeflateBuffer {0x94A8B513,0x5AD4,0x4917,{0xA8,0xE5,0x06,0xCC,0x6A,0x32,0xBC,0x4D}}
459 
460 } //namespace
461 
462 #endif
size_t P6SIZE
Definition: p6types.h:62
virtual P6R::P6ERR initialize(P6R::p6IDataStream *pOutStream, P6R::P6GZIOFLAGS fFlags)=0
Initializes the component for use.
virtual P6R::P6ERR initialize(P6GZSTREAMFLAGS fFlags, P6UINT32 nLevel)=0
Initialized the component for use and must be called successfully before calling any other method...
virtual P6R::P6ERR process(const P6R::P6VOID *pInputData, P6R::P6SIZE cbInputData, P6R::P6VOID *pOutputData, P6R::P6SIZE cbOutputData, P6R::P6SIZE *pcbOutput, P6R::P6BOOL bLast)=0
This method will process the provided data according to the flags that were specified in the call to ...
unsigned int P6UINT32
Definition: p6types.h:40
P6UINT32 P6GZSTREAMFLAGS
Definition: p6gzip.h:18
P6UINT32 P6GZIOFLAGS
Definition: p6gzip.h:147
P6INT32 P6GZCOMPRESSLEVEL
Definition: p6gzip.h:63
int P6INT
Definition: p6types.h:58
bool P6BOOL
Boolean type.
Definition: p6types.h:101
virtual P6R::P6ERR process(P6R::P6VOID *pSource, P6R::P6SIZE cbSource)=0
This method will inflate the data provided in pBuffer and write it out using the preset p6IDataStream...
virtual P6R::P6ERR deflate(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer, P6R::P6SIZE *pcbDeflated)=0
The deflate() method must be called repeatedly until eCompleted is returned indicating all the data i...
Inflates the data provided in the specified buffer.
Definition: p6gzip.h:354
virtual P6R::P6ERR initialize(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer, P6R::P6GZIOFLAGS fFlags)=0
Initializes the component for use.
virtual P6R::P6ERR initialize(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer, P6R::P6INT nLevel, P6R::P6GZIOFLAGS fFlags)=0
Initializes the component for use.
virtual P6R::P6ERR end()=0
This method is used to tell the component that there is no more data to deflate so that it can finali...
p6IDataStream interface definitions
virtual P6R::P6ERR write(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer)=0
Deflates the data spcified in pBuffer and writes it to the preset p6IIoWriteHandler.
This interface is implmented by components that support receiving streamed data.
Definition: p6datastream.h:42
int P6INT32
Definition: p6types.h:41
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
Deflates the data provided in the specified buffer.
Definition: p6gzip.h:408
virtual P6R::P6ERR process(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer)=0
This method will deflate the data provided in pBuffer and write it out using the preset p6IDataStream...
virtual P6R::P6ERR end()=0
This method is used to tell the component that there is no more data to inflate so that it can finali...
virtual P6R::P6ERR initialize(P6R::p6IIoReadHandler *pIo, P6R::P6GZIOFLAGS fFlags)=0
Initializes the component for use.
Given an p6IIoReadHandler, this interface reads data from the handler using its read method...
Definition: p6gzip.h:255
This interface inplements compression/decompression that is specific to the SSH protocol.
Definition: p6gzip.h:80
#define P6COMMETHOD
Definition: p6types.h:872
Given an p6IIoWriteHandler, this interace deflates the data provided via the write method...
Definition: p6gzip.h:306
Deflates the data provided when calling the process() method and writes it to the p6IDataStream provi...
Definition: p6gzip.h:206
virtual P6R::P6ERR initialize(P6R::p6IDataStream *pOutStream, P6R::P6GZIOFLAGS fFlags)=0
Initializes the component for use.
void P6VOID
Definition: p6types.h:75
virtual P6R::P6ERR read(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer, P6R::P6SIZE *pcbRead)=0
Attemps to read data from the source p6IIoReadHandler and inflate it into the provided buffer...
virtual P6R::P6ERR initialize(P6R::p6IIoWriteHandler *pIo, P6R::P6GZIOFLAGS fFlags)=0
Initializes the component for use.
virtual P6R::P6ERR close()=0
Terminates the compression stream, freeing any allocated data.
Inflates the data provided to calling the process() method and writes it to the p6IDataStream provide...
Definition: p6gzip.h:158
virtual P6R::P6ERR inflate(P6R::P6VOID *pBuffer, P6R::P6SIZE cbBuffer, P6R::P6SIZE *pcbInflated)=0
The inflate() method is called repeatedly until eCompleted is returned indicating that all the data i...
virtual P6R::P6ERR end()=0
This method is used to tell the component that there is no more data to inflate so that it can finali...
virtual P6R::P6ERR end()=0
This method is used to tell the component that there is no more data to deflate so that it can finali...