documented fix
[gnutls.git] / lib / gnutls_compress.h
blob35af229d5c9aed4db84d058434f57547fc39e7b6
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2010 Free
3 * Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GnuTLS.
9 * The GnuTLS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 * USA
25 #ifndef GNUTLS_COMPRESS_H
26 #define GNUTLS_COMPRESS_H
28 int _gnutls_m_plaintext2compressed (gnutls_session_t session,
29 gnutls_datum_t * compressed,
30 const gnutls_datum_t * plaintext,
31 const record_parameters_st * params);
32 int _gnutls_m_compressed2plaintext (gnutls_session_t session,
33 gnutls_datum_t * plain,
34 const gnutls_datum_t * compressed,
35 const record_parameters_st * params);
37 /* Algorithm handling. */
38 int _gnutls_supported_compression_methods (gnutls_session_t session,
39 uint8_t ** comp);
40 int _gnutls_compression_is_ok (gnutls_compression_method_t algorithm);
41 int _gnutls_compression_get_num (gnutls_compression_method_t algorithm);
42 gnutls_compression_method_t _gnutls_compression_get_id (int num);
44 #ifdef HAVE_LIBZ
45 #include <zlib.h>
46 #endif
48 #define GNUTLS_COMP_FAILED NULL
50 typedef struct comp_hd_t_STRUCT
52 void *handle;
53 gnutls_compression_method_t algo;
54 } *comp_hd_t;
56 comp_hd_t _gnutls_comp_init (gnutls_compression_method_t, int d);
57 void _gnutls_comp_deinit (comp_hd_t handle, int d);
59 int _gnutls_decompress (comp_hd_t handle, opaque * compressed,
60 size_t compressed_size, opaque ** plain,
61 size_t max_record_size);
62 int _gnutls_compress (comp_hd_t, const opaque * plain, size_t plain_size,
63 opaque ** compressed, size_t max_comp_size);
65 struct gnutls_compression_entry
67 const char *name;
68 gnutls_compression_method_t id;
69 /* the number reserved in TLS for the specific compression method */
70 int num;
72 /* used in zlib compressor */
73 int window_bits;
74 int mem_level;
75 int comp_level;
77 typedef struct gnutls_compression_entry gnutls_compression_entry;
79 #endif