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 #ifdef __cplusplus
17 namespace P6R {
18 extern "C" {
19 #endif
20 
22  static const P6GZSTREAMFLAGS P6GZSTREAM_NOFLAGS = 0x00000000;
23  static const P6GZSTREAMFLAGS P6GZSTREAM_COMPRESSMASK = 0x000f0000;
24  static const P6GZSTREAMFLAGS P6GZSTREAM_COMPRESS = 0x00000000;
25  static const P6GZSTREAMFLAGS P6GZSTREAM_DECOMPRESS = 0x00010000;
26  #define P6GZCOMPRESSTYPE(f) ((f) & P6GZSTREAM_COMPRESSMASK)
27  #define P6GZCOMPRESSING(f) (P6GZSTREAM_COMPRESS == P6GZCOMPRESSTYPE((f)) ? P6TRUE : P6FALSE)
28  #define P6GZDECOMPRESSING(f) (P6GZSTREAM_DECOMPRESS == P6GZCOMPRESSTYPE((f)) ? P6TRUE : P6FALSE)
29 
31  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPPERMASK = 0x0000000f;
32  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPNONE = 0x00000000;
33  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPZLIB = 0x00000001;
37  static const P6GZSTREAMFLAGS P6GZSTREAM_WRAPGZIP = 0x00000002;
40  #define P6GZWRAPPERTYPE(f) ((f) & P6GZSTREAM_WRAPPERMASK)
41  #define P6GZ_WRAPISGZIP(f) (P6GZWRAPPERTYPE((f)) == P6GZSTREAM_WRAPGZIP ? P6TRUE : P6FALSE)
42  #define P6GZ_WRAPISZLIB(f) (P6GZWRAPPERTYPE((f)) == P6GZSTREAM_WRAPZLIB ? P6TRUE : P6FALSE)
43  #define P6GZ_WRAPISNONE(f) (P6GZWRAPPERTYPE((f)) == P6GZSTREAM_WRAPNONE ? P6TRUE : P6FALSE)
44 
46  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATEGYMASK = 0x000000f0;
47  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATDEF = 0x00000000;
48  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATFILTERED= 0x00000010;
49  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATHUFFMAN = 0x00000020;
50  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATRLE = 0x00000040;
51  static const P6GZSTREAMFLAGS P6GZSTREAM_STRATFIXED = 0x00000080;
52  #define P6GZSTRATEGYTYPE(f) ((f) & P6GZSTREAM_STRATEGYMASK)
53 
55  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHMASK = 0x0000ff00;
56  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHDEFAULT = 0x00000000;
57  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHNONE = 0x00000100;
58  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHPARTIAL = 0x00000200;
59  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHSYNC = 0x00000400;
60  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHFULL = 0x00000800;
61  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHFINISH = 0x00001000;
62  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHBLOCK = 0x00002000;
63  static const P6GZSTREAMFLAGS P6GZSTREAM_FLUSHTREES = 0x00004000;
64  #define P6GZFLUSHTYPE(f) ((f) & P6GZSTREAM_FLUSHMASK)
65 
67  static const P6GZCOMPRESSLEVEL P6GZCL_MIN P6PURE;
68  static const P6GZCOMPRESSLEVEL P6GZCL_MAX = 9;
69  static const P6GZCOMPRESSLEVEL P6GZCL_DEFAULT = 6;
70 
71 
83  #undef INTERFACE
84  #define INTERFACE p6IZlibSSH
86  {
103  P6DECLCOMMETHOD(initialize)(P6THIS_ P6GZSTREAMFLAGS fFlags,P6UINT32 nLevel) P6PURE;
104 
127  P6DECLCOMMETHOD(process)(P6THIS_ const P6VOID *pInputData,
128  P6SIZE cbInputData,
129  P6VOID *pOutputData,
130  P6SIZE cbOutputData,
131  P6SIZE *pcbOutput,
132  P6BOOL bLast) P6PURE;
133 
141  P6DECLCOMMETHOD(close)(P6THIS) P6PURE;
142  };
143 
144  // {2AD59EEB-F169-4472-B235-968244ADE914}
145  #define IF_p6IZlibSSH {0x2AD59EEB,0xF169,0x4472,{0xB2,0x35,0x96,0x82,0x44,0xAD,0xE9,0x14}}
146 
147  // {C20335D0-7C72-467F-BDE9-C0825F07FD47}
148  #define COMP_p6ZlibSSH {0xC20335D0,0x7C72,0x467F,{0xBD,0xE9,0xC0,0x82,0x5F,0x07,0xFD,0x47}}
149 
150 
151 
153  static const P6GZIOFLAGS P6GZIOF_NOFLAGS = 0x00000000;
154  static const P6GZIOFLAGS P6GZIOF_NOHEADER = 0x00000001;
163  #undef INTERFACE
164  #define INTERFACE p6IGzipInflateToStream
166  {
178  P6DECLCOMMETHOD(initialize)(P6THIS_ p6IDataStream *pOutStream,P6GZIOFLAGS fFlags) P6PURE;
179 
189  P6DECLCOMMETHOD(process)(P6THIS_ P6VOID *pSource,P6SIZE cbSource) P6PURE;
190 
198  P6DECLCOMMETHOD(end)(P6THIS) P6PURE;
199  };
200 
201  /*{D23B9240-4923-34C9-B3FE-C4B18263FCE5}*/
202  #define IF_p6IGzipInflateToStream {0xD23B9240,0x4923,0x34C9,{0xB3,0xFE,0xC4,0xB1,0x82,0x63,0xFC,0xE5}}
203 
204  /*{187AA4D2-475C-3167-32AD-A48361B3F818}*/
205  #define COMP_p6GzipInflateToStream {0x187AA4D2,0x475C,0x3167,{0x32,0xAD,0xA4,0x83,0x61,0xB3,0xF8,0x18}}
206 
207 
214  #undef INTERFACE
215  #define INTERFACE p6IGzipDeflateToStream
217  {
229  P6DECLCOMMETHOD(initialize)(P6THIS_ p6IDataStream *pOutStream,P6GZIOFLAGS fFlags) P6PURE;
230 
240  P6DECLCOMMETHOD(process)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer) P6PURE;
241 
249  P6DECLCOMMETHOD(end)(P6THIS) P6PURE;
250  };
251 
252  /*{E0408340-4DE1-3292-611B-1CB2F30DB592}*/
253  #define IF_p6IGzipDeflateToStream {0xE0408340,0x4DE1,0x3292,{0x61,0x1B,0x1C,0xB2,0xF3,0x0D,0xB5,0x92}}
254 
255  /*{19B5F73C-100A-4514-8E66-266AAC9CBFA0}*/
256  #define COMP_p6GzipDeflateToStream {0x19B5F73C,0x100A,0x4514,{0x8E,0x66,0x26,0x6A,0xAC,0x9C,0xBF,0xA0}}
257 
258 
266  #undef INTERFACE
267  #define INTERFACE p6IGzipInflateFromHandler
269  {
281  P6DECLCOMMETHOD(initialize)(P6THIS_ p6IIoReadHandler *pIo,P6GZIOFLAGS fFlags) P6PURE;
282 
295  P6DECLCOMMETHOD(read)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer,P6SIZE *pcbRead) P6PURE;
296 
303  P6DECLCOMMETHOD(end)(P6THIS) P6PURE;
304  };
305 
306  /*{566626EB-44F9-A909-6C18-CAB536293EC1}*/
307  #define IF_p6IGzipInflateFromHandler {0x566626EB,0x44F9,0xA909,{0x6C,0x18,0xCA,0xB5,0x36,0x29,0x3E,0xC1}}
308 
309  /*{0BD83415-4965-1E5F-D65E-DF8416EAC298}*/
310  #define COMP_p6GzipInflateFromHandler {0x0BD83415,0x4965,0x1E5F,{0xD6,0x5E,0xDF,0x84,0x16,0xEA,0xC2,0x98}}
311 
312 
320  #undef INTERFACE
321  #define INTERFACE p6IGzipDeflateToHandler
323  {
335  P6DECLCOMMETHOD(initialize)(P6THIS_ p6IIoWriteHandler *pIo,P6GZIOFLAGS fFlags) P6PURE;
336 
345  P6DECLCOMMETHOD(write)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer) P6PURE;
346 
353  P6DECLCOMMETHOD(end)(P6THIS) P6PURE;
354  };
355 
356  /*{D8F57EA1-FC0D-4EF3-99C8-B076289F907E}*/
357  #define IF_p6IGzipDeflateToHandler {0xD8F57EA1,0xFC0D,0x4EF3,{0x99,0xC8,0xB0,0x76,0x28,0x9F,0x90,0x7E}}
358 
359  /*{33A7D609-14AB-4522-B97E-435419C8E9DC}*/
360  #define COMP_p6GzipDeflateToHandler {0x33A7D609,0x14AB,0x4522,{0xB9,0x7E,0x43,0x54,0x19,0xC8,0xE9,0xDC}}
361 
362 
371  #undef INTERFACE
372  #define INTERFACE p6IGzipInflateBuffer
374  {
390  P6DECLCOMMETHOD(initialize)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer,P6GZIOFLAGS fFlags) P6PURE;
391 
410  P6DECLCOMMETHOD(inflate)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer,P6SIZE *pcbInflated) P6PURE;
411  };
412 
413  /*{F94DA9AB-CBD6-4E05-847E-37D8E78A8508}*/
414  #define IF_p6IGzipInflateBuffer {0xF94DA9AB,0xCBD6,0x4E05,{0x84,0x7E,0x37,0xD8,0xE7,0x8A,0x85,0x08}}
415 
416  /*{C125EDDE-F846-47D7-8E62-709F54B0205D}*/
417  #define COMP_p6GzipInflateBuffer {0xC125EDDE,0xF846,0x47D7,{0x8E,0x62,0x70,0x9F,0x54,0xB0,0x20,0x5D}}
418 
419 
428  #undef INTERFACE
429  #define INTERFACE p6IGzipDeflateBuffer
431  {
449  P6DECLCOMMETHOD(initialize)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer,P6INT nLevel,P6GZIOFLAGS fFlags) P6PURE;
450 
474  P6DECLCOMMETHOD(deflate)(P6THIS_ P6VOID *pBuffer,P6SIZE cbBuffer,P6SIZE *pcbDeflated) P6PURE;
475  };
476 
477  /*{6A947420-833E-4EF5-9D7B-3E80F0F3C631}*/
478  #define IF_p6IGzipDeflateBuffer {0x6A947420,0x833E,0x4EF5,{0x9D,0x7B,0x3E,0x80,0xF0,0xF3,0xC6,0x31}}
479 
480  /*{94A8B513-5AD4-4917-A8E5-06CC6A32BC4D}*/
481  #define COMP_p6GzipDeflateBuffer {0x94A8B513,0x5AD4,0x4917,{0xA8,0xE5,0x06,0xCC,0x6A,0x32,0xBC,0x4D}}
482 
483 #ifdef __cplusplus
484 } /* extern "C" */
485 } //namespace
486 #endif
487 
488 #endif
size_t P6SIZE
Definition: p6types.h:90
uint32_t P6UINT32
Definition: p6types.h:77
#define P6DECLAREICOM
Definition: p6defs.h:191
P6UINT32 P6GZSTREAMFLAGS
Definition: p6gzip.h:21
P6UINT32 P6GZIOFLAGS
Definition: p6gzip.h:152
#define P6PURE
Definition: p6defs.h:192
P6INT32 P6GZCOMPRESSLEVEL
Definition: p6gzip.h:66
int P6INT
Definition: p6types.h:84
unsigned char P6BOOL
Boolean type.
Definition: p6types.h:133
Inflates the data provided in the specified buffer.
Definition: p6gzip.h:373
p6IDataStream interface definitions
This interface is implmented by components that support receiving streamed data.
Definition: p6datastream.h:44
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:97
Deflates the data provided in the specified buffer.
Definition: p6gzip.h:430
Given an p6IIoReadHandler, this interface reads data from the handler using its read method...
Definition: p6gzip.h:268
This interface inplements compression/decompression that is specific to the SSH protocol.
Definition: p6gzip.h:85
#define P6DECLCOMMETHOD(method)
Definition: p6defs.h:189
#define P6THIS_
Definition: p6defs.h:193
Given an p6IIoWriteHandler, this interace deflates the data provided via the write method...
Definition: p6gzip.h:322
Deflates the data provided when calling the process() method and writes it to the p6IDataStream provi...
Definition: p6gzip.h:216
void P6VOID
Definition: p6types.h:109
int32_t P6INT32
Definition: p6types.h:76
#define P6THIS
Definition: p6defs.h:194
Inflates the data provided to calling the process() method and writes it to the p6IDataStream provide...
Definition: p6gzip.h:165
#define P6DECLAREIF_(iface, baseif)
Definition: p6defs.h:188