2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * @defgroup tls_compression tls_compression
21 #ifndef TLS_COMPRESSION_H_
22 #define TLS_COMPRESSION_H_
26 typedef struct tls_compression_t tls_compression_t
;
29 #include "tls_alert.h"
30 #include "tls_fragmentation.h"
33 * TLS record protocol compression layer.
35 struct tls_compression_t
{
38 * Process a compressed TLS record, pass it to upper layers.
40 * @param type type of the TLS record to process
41 * @param data associated TLS record data
43 * - SUCCESS if TLS negotiation complete
44 * - FAILED if TLS handshake failed
45 * - NEED_MORE if more invocations to process/build needed
47 status_t (*process
)(tls_compression_t
*this,
48 tls_content_type_t type
, chunk_t data
);
51 * Query upper layer for TLS record, build compressed record.
53 * @param type type of the built TLS record
54 * @param data allocated data of the built TLS record
56 * - SUCCESS if TLS negotiation complete
57 * - FAILED if TLS handshake failed
58 * - NEED_MORE if upper layers have more records to send
59 * - INVALID_STATE if more input records required
61 status_t (*build
)(tls_compression_t
*this,
62 tls_content_type_t
*type
, chunk_t
*data
);
65 * Destroy a tls_compression_t.
67 void (*destroy
)(tls_compression_t
*this);
71 * Create a tls_compression instance.
73 * @param fragmentation fragmentation layer of TLS stack
74 * @param alert TLS alert handler
75 * @return TLS compression layer.
77 tls_compression_t
*tls_compression_create(tls_fragmentation_t
*fragmentation
,
80 #endif /** TLS_COMPRESSION_H_ @}*/