import libcrypto (LibreSSL 2.5.2)
[unleashed.git] / lib / libcrypto / comp / comp.h
blobfe7397f8ea45236c4e07878bde0cf52c99842135
1 /* $OpenBSD: comp.h,v 1.8 2014/11/03 16:58:28 tedu Exp $ */
3 #ifndef HEADER_COMP_H
4 #define HEADER_COMP_H
6 #include <openssl/crypto.h>
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
12 typedef struct comp_ctx_st COMP_CTX;
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;
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;
35 CRYPTO_EX_DATA ex_data;
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);
49 #ifdef HEADER_BIO_H
50 #ifdef ZLIB
51 BIO_METHOD *BIO_f_zlib(void);
52 #endif
53 #endif
55 void ERR_load_COMP_strings(void);
57 /* Error codes for the COMP functions. */
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
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
70 #ifdef __cplusplus
72 #endif
73 #endif