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