Eliminated p11common.c.
[gnutls.git] / lib / gnutls_compress.h
blob151e54f6b7fda78e3d142bf8c6ae77ca9121cd44
1 /*
2 * Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
22 #ifndef GNUTLS_COMPRESS_H
23 #define GNUTLS_COMPRESS_H
25 /* Algorithm handling. */
26 int _gnutls_supported_compression_methods (gnutls_session_t session,
27 uint8_t * comp, size_t max_comp);
28 int _gnutls_compression_is_ok (gnutls_compression_method_t algorithm);
29 int _gnutls_compression_get_num (gnutls_compression_method_t algorithm);
30 gnutls_compression_method_t _gnutls_compression_get_id (int num);
32 #ifdef HAVE_LIBZ
33 #include <zlib.h>
34 #endif
36 #define GNUTLS_COMP_FAILED NULL
38 typedef struct comp_hd_st
40 void *handle;
41 gnutls_compression_method_t algo;
42 } comp_hd_st;
44 int _gnutls_comp_init (comp_hd_st*, gnutls_compression_method_t, int d);
45 void _gnutls_comp_deinit (comp_hd_st* handle, int d);
47 int _gnutls_decompress (comp_hd_st* handle, uint8_t * compressed,
48 size_t compressed_size, uint8_t * plain,
49 size_t max_plain_size);
50 int _gnutls_compress (comp_hd_st*, const uint8_t * plain, size_t plain_size,
51 uint8_t * compressed, size_t max_comp_size);
53 struct gnutls_compression_entry
55 const char *name;
56 gnutls_compression_method_t id;
57 /* the number reserved in TLS for the specific compression method */
58 int num;
60 /* used in zlib compressor */
61 int window_bits;
62 int mem_level;
63 int comp_level;
65 typedef struct gnutls_compression_entry gnutls_compression_entry;
67 #endif