1
2 module deimos.openssl.comp;
3
4 import deimos.openssl._d_util;
5
6 import deimos.openssl.bio; // Needed for BIO_METHOD.
7
8 public import deimos.openssl.crypto;
9
10 extern (C):
11 nothrow:
12
13 alias comp_ctx_st COMP_CTX;
14
15 struct comp_method_st {
16 int type; /* NID for compression library */
17 const(char)* name; /* A text string to identify the library */
18 ExternC!(int function(COMP_CTX* ctx)) init_;
19 ExternC!(void function(COMP_CTX* ctx)) finish;
20 ExternC!(int function(COMP_CTX* ctx,
21 ubyte* out_, uint olen,
22 ubyte* in_, uint ilen)) compress;
23 ExternC!(int function(COMP_CTX* ctx,
24 ubyte* out_, uint olen,
25 ubyte* in_, uint ilen)) expand;
26 /* The following two do NOTHING, but are kept for backward compatibility */
27 ExternC!(c_long function()) ctrl;
28 ExternC!(c_long function()) callback_ctrl;
29 }
30 alias comp_method_st COMP_METHOD;
31
32 struct comp_ctx_st
33 {
34 COMP_METHOD* meth;
35 c_ulong compress_in;
36 c_ulong compress_out;
37 c_ulong expand_in;
38 c_ulong expand_out;
39
40 CRYPTO_EX_DATA ex_data;
41 };
42
43
44 COMP_CTX* COMP_CTX_new(COMP_METHOD* meth);
45 void COMP_CTX_free(COMP_CTX* ctx);
46 int COMP_compress_block(COMP_CTX* ctx, ubyte* out_, int olen,
47 ubyte* in_, int ilen);
48 int COMP_expand_block(COMP_CTX* ctx, ubyte* out_, int olen,
49 ubyte* in_, int ilen);
50 COMP_METHOD* COMP_rle();
51 COMP_METHOD* COMP_zlib();
52 void COMP_zlib_cleanup();
53
54 // #ifdef ZLIB
55 BIO_METHOD* BIO_f_zlib();
56 // #endif
57
58 /* BEGIN ERROR CODES */
59 /* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62 void ERR_load_COMP_strings();
63
64 /* Error codes for the COMP functions. */
65
66 /* Function codes. */
67 enum COMP_F_BIO_ZLIB_FLUSH = 99;
68 enum COMP_F_BIO_ZLIB_NEW = 100;
69 enum COMP_F_BIO_ZLIB_READ = 101;
70 enum COMP_F_BIO_ZLIB_WRITE = 102;
71
72 /* Reason codes. */
73 enum COMP_R_ZLIB_DEFLATE_ERROR = 99;
74 enum COMP_R_ZLIB_INFLATE_ERROR = 100;
75 enum COMP_R_ZLIB_NOT_SUPPORTED = 101;