Update LibreSSL from version 2.4.4 => 2.9.1
[dragonfly.git] / crypto / libressl / include / openssl / comp.h
1 /* $OpenBSD: comp.h,v 1.8 2014/11/03 16:58:28 tedu Exp $ */
2
3 #ifndef HEADER_COMP_H
4 #define HEADER_COMP_H
5
6 #include <openssl/crypto.h>
7
8 #ifdef  __cplusplus
9 extern "C" {
10 #endif
11
12 typedef struct comp_ctx_st COMP_CTX;
13
14 typedef struct comp_method_st {
15         int type;               /* NID for compression library */
16         const char *name;       /* A text string to identify the library */
17         int (*init)(COMP_CTX *ctx);
18         void (*finish)(COMP_CTX *ctx);
19         int (*compress)(COMP_CTX *ctx, unsigned char *out, unsigned int olen,
20             unsigned char *in, unsigned int ilen);
21         int (*expand)(COMP_CTX *ctx, unsigned char *out, unsigned int olen,
22             unsigned char *in, unsigned int ilen);
23         /* The following two do NOTHING, but are kept for backward compatibility */
24         long (*ctrl)(void);
25         long (*callback_ctrl)(void);
26 } COMP_METHOD;
27
28 struct comp_ctx_st {
29         COMP_METHOD *meth;
30         unsigned long compress_in;
31         unsigned long compress_out;
32         unsigned long expand_in;
33         unsigned long expand_out;
34
35         CRYPTO_EX_DATA  ex_data;
36 };
37
38
39 COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
40 void COMP_CTX_free(COMP_CTX *ctx);
41 int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
42     unsigned char *in, int ilen);
43 int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
44     unsigned char *in, int ilen);
45 COMP_METHOD *COMP_rle(void );
46 COMP_METHOD *COMP_zlib(void );
47 void COMP_zlib_cleanup(void);
48
49 #ifdef HEADER_BIO_H
50 #ifdef ZLIB
51 BIO_METHOD *BIO_f_zlib(void);
52 #endif
53 #endif
54
55 void ERR_load_COMP_strings(void);
56
57 /* Error codes for the COMP functions. */
58
59 /* Function codes. */
60 #define COMP_F_BIO_ZLIB_FLUSH                            99
61 #define COMP_F_BIO_ZLIB_NEW                              100
62 #define COMP_F_BIO_ZLIB_READ                             101
63 #define COMP_F_BIO_ZLIB_WRITE                            102
64
65 /* Reason codes. */
66 #define COMP_R_ZLIB_DEFLATE_ERROR                        99
67 #define COMP_R_ZLIB_INFLATE_ERROR                        100
68 #define COMP_R_ZLIB_NOT_SUPPORTED                        101
69
70 #ifdef  __cplusplus
71 }
72 #endif
73 #endif