1285SN/A
2461SN/A#ifndef HEADER_COMP_H
3285SN/A# define HEADER_COMP_H
4285SN/A
5285SN/A# include <openssl/crypto.h>
6285SN/A
7285SN/A# ifdef OPENSSL_NO_COMP
8285SN/A#  error COMP is disabled.
9285SN/A# endif
10285SN/A
11285SN/A#ifdef  __cplusplus
12285SN/Aextern "C" {
13285SN/A#endif
14285SN/A
15285SN/Atypedef struct comp_ctx_st COMP_CTX;
16285SN/A
17285SN/Atypedef struct comp_method_st {
18285SN/A    int type;                   /* NID for compression library */
19285SN/A    const char *name;           /* A text string to identify the library */
20285SN/A    int (*init) (COMP_CTX *ctx);
21285SN/A    void (*finish) (COMP_CTX *ctx);
22285SN/A    int (*compress) (COMP_CTX *ctx,
23285SN/A                     unsigned char *out, unsigned int olen,
24285SN/A                     unsigned char *in, unsigned int ilen);
25285SN/A    int (*expand) (COMP_CTX *ctx,
26285SN/A                   unsigned char *out, unsigned int olen,
27285SN/A                   unsigned char *in, unsigned int ilen);
28285SN/A    /*
29285SN/A     * The following two do NOTHING, but are kept for backward compatibility
30285SN/A     */
31285SN/A    long (*ctrl) (void);
32285SN/A    long (*callback_ctrl) (void);
33285SN/A} COMP_METHOD;
34285SN/A
35285SN/Astruct comp_ctx_st {
36285SN/A    COMP_METHOD *meth;
37285SN/A    unsigned long compress_in;
38285SN/A    unsigned long compress_out;
39285SN/A    unsigned long expand_in;
40285SN/A    unsigned long expand_out;
41285SN/A    CRYPTO_EX_DATA ex_data;
42285SN/A};
43285SN/A
44285SN/ACOMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
45285SN/Avoid COMP_CTX_free(COMP_CTX *ctx);
46285SN/Aint COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
47285SN/A                        unsigned char *in, int ilen);
48285SN/Aint COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
49285SN/A                      unsigned char *in, int ilen);
50285SN/ACOMP_METHOD *COMP_rle(void);
51285SN/ACOMP_METHOD *COMP_zlib(void);
52285SN/Avoid COMP_zlib_cleanup(void);
53285SN/A
54285SN/A# ifdef HEADER_BIO_H
55285SN/A#  ifdef ZLIB
56285SN/ABIO_METHOD *BIO_f_zlib(void);
57285SN/A#  endif
58285SN/A# endif
59285SN/A
60285SN/A/* BEGIN ERROR CODES */
61285SN/A/*
62285SN/A * The following lines are auto generated by the script mkerr.pl. Any changes
63285SN/A * made after this point may be overwritten when the script is next run.
64285SN/A */
65285SN/Avoid ERR_load_COMP_strings(void);
66285SN/A
67285SN/A/* Error codes for the COMP functions. */
68285SN/A
69285SN/A/* Function codes. */
70285SN/A# define COMP_F_BIO_ZLIB_FLUSH                            99
71285SN/A# define COMP_F_BIO_ZLIB_NEW                              100
72285SN/A# define COMP_F_BIO_ZLIB_READ                             101
73285SN/A# define COMP_F_BIO_ZLIB_WRITE                            102
74285SN/A
75285SN/A/* Reason codes. */
76285SN/A# define COMP_R_ZLIB_DEFLATE_ERROR                        99
77285SN/A# define COMP_R_ZLIB_INFLATE_ERROR                        100
78285SN/A# define COMP_R_ZLIB_NOT_SUPPORTED                        101
79285SN/A
80285SN/A#ifdef  __cplusplus
81285SN/A}
82285SN/A#endif
83285SN/A#endif
84285SN/A