LTKCPP-- LLRP Toolkit C Plus Plus Library
comp.h
00001 
00002 #ifndef HEADER_COMP_H
00003 # define HEADER_COMP_H
00004 
00005 # include <openssl/crypto.h>
00006 
00007 #ifdef  __cplusplus
00008 extern "C" {
00009 #endif
00010 
00011 typedef struct comp_ctx_st COMP_CTX;
00012 
00013 typedef struct comp_method_st {
00014     int type;                   /* NID for compression library */
00015     const char *name;           /* A text string to identify the library */
00016     int (*init) (COMP_CTX *ctx);
00017     void (*finish) (COMP_CTX *ctx);
00018     int (*compress) (COMP_CTX *ctx,
00019                      unsigned char *out, unsigned int olen,
00020                      unsigned char *in, unsigned int ilen);
00021     int (*expand) (COMP_CTX *ctx,
00022                    unsigned char *out, unsigned int olen,
00023                    unsigned char *in, unsigned int ilen);
00024     /*
00025      * The following two do NOTHING, but are kept for backward compatibility
00026      */
00027     long (*ctrl) (void);
00028     long (*callback_ctrl) (void);
00029 } COMP_METHOD;
00030 
00031 struct comp_ctx_st {
00032     COMP_METHOD *meth;
00033     unsigned long compress_in;
00034     unsigned long compress_out;
00035     unsigned long expand_in;
00036     unsigned long expand_out;
00037     CRYPTO_EX_DATA ex_data;
00038 };
00039 
00040 COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
00041 void COMP_CTX_free(COMP_CTX *ctx);
00042 int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
00043                         unsigned char *in, int ilen);
00044 int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
00045                       unsigned char *in, int ilen);
00046 COMP_METHOD *COMP_rle(void);
00047 COMP_METHOD *COMP_zlib(void);
00048 void COMP_zlib_cleanup(void);
00049 
00050 # ifdef HEADER_BIO_H
00051 #  ifdef ZLIB
00052 BIO_METHOD *BIO_f_zlib(void);
00053 #  endif
00054 # endif
00055 
00056 /* BEGIN ERROR CODES */
00057 /*
00058  * The following lines are auto generated by the script mkerr.pl. Any changes
00059  * made after this point may be overwritten when the script is next run.
00060  */
00061 void ERR_load_COMP_strings(void);
00062 
00063 /* Error codes for the COMP functions. */
00064 
00065 /* Function codes. */
00066 # define COMP_F_BIO_ZLIB_FLUSH                            99
00067 # define COMP_F_BIO_ZLIB_NEW                              100
00068 # define COMP_F_BIO_ZLIB_READ                             101
00069 # define COMP_F_BIO_ZLIB_WRITE                            102
00070 
00071 /* Reason codes. */
00072 # define COMP_R_ZLIB_DEFLATE_ERROR                        99
00073 # define COMP_R_ZLIB_INFLATE_ERROR                        100
00074 # define COMP_R_ZLIB_NOT_SUPPORTED                        101
00075 
00076 #ifdef  __cplusplus
00077 }
00078 #endif
00079 #endif