406c428aaeed7ee6e993e7607d9f22b8ef1ca4df
[dragonfly.git] / crypto / openssl / crypto / comp / comp.h
1
2 #ifndef HEADER_COMP_H
3 # define HEADER_COMP_H
4
5 # include <openssl/crypto.h>
6
7 #ifdef  __cplusplus
8 extern "C" {
9 #endif
10
11 typedef struct comp_ctx_st COMP_CTX;
12
13 typedef struct comp_method_st {
14     int type;                   /* NID for compression library */
15     const char *name;           /* A text string to identify the library */
16     int (*init) (COMP_CTX *ctx);
17     void (*finish) (COMP_CTX *ctx);
18     int (*compress) (COMP_CTX *ctx,
19                      unsigned char *out, unsigned int olen,
20                      unsigned char *in, unsigned int ilen);
21     int (*expand) (COMP_CTX *ctx,
22                    unsigned char *out, unsigned int olen,
23                    unsigned char *in, unsigned int ilen);
24     /*
25      * The following two do NOTHING, but are kept for backward compatibility
26      */
27     long (*ctrl) (void);
28     long (*callback_ctrl) (void);
29 } COMP_METHOD;
30
31 struct comp_ctx_st {
32     COMP_METHOD *meth;
33     unsigned long compress_in;
34     unsigned long compress_out;
35     unsigned long expand_in;
36     unsigned long expand_out;
37     CRYPTO_EX_DATA ex_data;
38 };
39
40 COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
41 void COMP_CTX_free(COMP_CTX *ctx);
42 int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
43                         unsigned char *in, int ilen);
44 int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
45                       unsigned char *in, int ilen);
46 COMP_METHOD *COMP_rle(void);
47 COMP_METHOD *COMP_zlib(void);
48 void COMP_zlib_cleanup(void);
49
50 # ifdef HEADER_BIO_H
51 #  ifdef ZLIB
52 BIO_METHOD *BIO_f_zlib(void);
53 #  endif
54 # endif
55
56 /* BEGIN ERROR CODES */
57 /*
58  * The following lines are auto generated by the script mkerr.pl. Any changes
59  * made after this point may be overwritten when the script is next run.
60  */
61 void ERR_load_COMP_strings(void);
62
63 /* Error codes for the COMP functions. */
64
65 /* Function codes. */
66 # define COMP_F_BIO_ZLIB_FLUSH                            99
67 # define COMP_F_BIO_ZLIB_NEW                              100
68 # define COMP_F_BIO_ZLIB_READ                             101
69 # define COMP_F_BIO_ZLIB_WRITE                            102
70
71 /* Reason codes. */
72 # define COMP_R_ZLIB_DEFLATE_ERROR                        99
73 # define COMP_R_ZLIB_INFLATE_ERROR                        100
74 # define COMP_R_ZLIB_NOT_SUPPORTED                        101
75
76 #ifdef  __cplusplus
77 }
78 #endif
79 #endif