1 /* $OpenBSD: comp.h,v 1.8 2014/11/03 16:58:28 tedu Exp $ */
6 #include <openssl/crypto.h>
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 */
25 long (*callback_ctrl
)(void);
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);
51 BIO_METHOD
*BIO_f_zlib(void);
55 void ERR_load_COMP_strings(void);
57 /* Error codes for the COMP functions. */
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
66 #define COMP_R_ZLIB_DEFLATE_ERROR 99
67 #define COMP_R_ZLIB_INFLATE_ERROR 100
68 #define COMP_R_ZLIB_NOT_SUPPORTED 101