155714Skris
255714Skris#ifndef HEADER_COMP_H
3296341Sdelphij# define HEADER_COMP_H
455714Skris
5296341Sdelphij# include <openssl/crypto.h>
668651Skris
755714Skris#ifdef  __cplusplus
855714Skrisextern "C" {
955714Skris#endif
1055714Skris
11160814Ssimontypedef struct comp_ctx_st COMP_CTX;
12160814Ssimon
13296341Sdelphijtypedef struct comp_method_st {
14296341Sdelphij    int type;                   /* NID for compression library */
15296341Sdelphij    const char *name;           /* A text string to identify the library */
16296341Sdelphij    int (*init) (COMP_CTX *ctx);
17296341Sdelphij    void (*finish) (COMP_CTX *ctx);
18296341Sdelphij    int (*compress) (COMP_CTX *ctx,
19296341Sdelphij                     unsigned char *out, unsigned int olen,
20296341Sdelphij                     unsigned char *in, unsigned int ilen);
21296341Sdelphij    int (*expand) (COMP_CTX *ctx,
22296341Sdelphij                   unsigned char *out, unsigned int olen,
23296341Sdelphij                   unsigned char *in, unsigned int ilen);
24296341Sdelphij    /*
25296341Sdelphij     * The following two do NOTHING, but are kept for backward compatibility
26296341Sdelphij     */
27296341Sdelphij    long (*ctrl) (void);
28296341Sdelphij    long (*callback_ctrl) (void);
29296341Sdelphij} COMP_METHOD;
3055714Skris
31296341Sdelphijstruct comp_ctx_st {
32296341Sdelphij    COMP_METHOD *meth;
33296341Sdelphij    unsigned long compress_in;
34296341Sdelphij    unsigned long compress_out;
35296341Sdelphij    unsigned long expand_in;
36296341Sdelphij    unsigned long expand_out;
37296341Sdelphij    CRYPTO_EX_DATA ex_data;
38296341Sdelphij};
3955714Skris
4055714SkrisCOMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
4155714Skrisvoid COMP_CTX_free(COMP_CTX *ctx);
4255714Skrisint COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
43296341Sdelphij                        unsigned char *in, int ilen);
4455714Skrisint COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
45296341Sdelphij                      unsigned char *in, int ilen);
46296341SdelphijCOMP_METHOD *COMP_rle(void);
47296341SdelphijCOMP_METHOD *COMP_zlib(void);
48194206Ssimonvoid COMP_zlib_cleanup(void);
4955714Skris
50296341Sdelphij# ifdef HEADER_BIO_H
51296341Sdelphij#  ifdef ZLIB
52194206SsimonBIO_METHOD *BIO_f_zlib(void);
53296341Sdelphij#  endif
54296341Sdelphij# endif
55194206Ssimon
5655714Skris/* BEGIN ERROR CODES */
57296341Sdelphij/*
58296341Sdelphij * The following lines are auto generated by the script mkerr.pl. Any changes
5955714Skris * made after this point may be overwritten when the script is next run.
6055714Skris */
6189837Skrisvoid ERR_load_COMP_strings(void);
6255714Skris
6355714Skris/* Error codes for the COMP functions. */
6455714Skris
6555714Skris/* Function codes. */
66296341Sdelphij# define COMP_F_BIO_ZLIB_FLUSH                            99
67296341Sdelphij# define COMP_F_BIO_ZLIB_NEW                              100
68296341Sdelphij# define COMP_F_BIO_ZLIB_READ                             101
69296341Sdelphij# define COMP_F_BIO_ZLIB_WRITE                            102
7055714Skris
7155714Skris/* Reason codes. */
72296341Sdelphij# define COMP_R_ZLIB_DEFLATE_ERROR                        99
73296341Sdelphij# define COMP_R_ZLIB_INFLATE_ERROR                        100
74296341Sdelphij# define COMP_R_ZLIB_NOT_SUPPORTED                        101
7555714Skris
7655714Skris#ifdef  __cplusplus
7755714Skris}
7855714Skris#endif
7955714Skris#endif
80