]>
Commit | Line | Data |
---|---|---|
40e384ea MW |
1 | /* |
2 | * Copyright (C) 2010 Martin Willi | |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
40e384ea MW |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
15 | */ | |
16 | ||
17 | /** | |
18 | * @defgroup tls_compression tls_compression | |
0f82a470 | 19 | * @{ @ingroup libtls |
40e384ea MW |
20 | */ |
21 | ||
22 | #ifndef TLS_COMPRESSION_H_ | |
23 | #define TLS_COMPRESSION_H_ | |
24 | ||
40e384ea MW |
25 | #include <library.h> |
26 | ||
6a5c86b7 MW |
27 | typedef struct tls_compression_t tls_compression_t; |
28 | ||
40e384ea | 29 | #include "tls.h" |
e6f3ef13 | 30 | #include "tls_alert.h" |
40e384ea MW |
31 | #include "tls_fragmentation.h" |
32 | ||
33 | /** | |
34 | * TLS record protocol compression layer. | |
35 | */ | |
36 | struct tls_compression_t { | |
37 | ||
38 | /** | |
39 | * Process a compressed TLS record, pass it to upper layers. | |
40 | * | |
41 | * @param type type of the TLS record to process | |
42 | * @param data associated TLS record data | |
43 | * @return | |
44 | * - SUCCESS if TLS negotiation complete | |
45 | * - FAILED if TLS handshake failed | |
46 | * - NEED_MORE if more invocations to process/build needed | |
47 | */ | |
48 | status_t (*process)(tls_compression_t *this, | |
49 | tls_content_type_t type, chunk_t data); | |
50 | ||
51 | /** | |
52 | * Query upper layer for TLS record, build compressed record. | |
53 | * | |
54 | * @param type type of the built TLS record | |
55 | * @param data allocated data of the built TLS record | |
56 | * @return | |
57 | * - SUCCESS if TLS negotiation complete | |
58 | * - FAILED if TLS handshake failed | |
59 | * - NEED_MORE if upper layers have more records to send | |
60 | * - INVALID_STATE if more input records required | |
61 | */ | |
62 | status_t (*build)(tls_compression_t *this, | |
63 | tls_content_type_t *type, chunk_t *data); | |
64 | ||
65 | /** | |
66 | * Destroy a tls_compression_t. | |
67 | */ | |
68 | void (*destroy)(tls_compression_t *this); | |
69 | }; | |
70 | ||
71 | /** | |
72 | * Create a tls_compression instance. | |
73 | * | |
74 | * @param fragmentation fragmentation layer of TLS stack | |
e6f3ef13 | 75 | * @param alert TLS alert handler |
40e384ea MW |
76 | * @return TLS compression layer. |
77 | */ | |
e6f3ef13 MW |
78 | tls_compression_t *tls_compression_create(tls_fragmentation_t *fragmentation, |
79 | tls_alert_t *alert); | |
40e384ea MW |
80 | |
81 | #endif /** TLS_COMPRESSION_H_ @}*/ |