added generic TLS application data handler and specific EAP-TTLS instantiation
[strongswan.git] / src / libtls / tls_application.h
1 /*
2 * Copyright (C) 2010 Andreas Steffen
3 * Copyright (C) 2010 HSR Hochschule fuer Technik Rapperswil
4 *
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>.
9 *
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
13 * for more details.
14 */
15
16 /**
17 * @defgroup tls_handshake tls_handshake
18 * @{ @ingroup libtls
19 */
20
21 #ifndef TLS_APPLICATION_H_
22 #define TLS_APPLICATION_H_
23
24 typedef struct tls_application_t tls_application_t;
25
26 #include "tls.h"
27 #include "tls_reader.h"
28 #include "tls_writer.h"
29
30 /**
31 * TLS application data interface.
32 */
33 struct tls_application_t {
34
35 /**
36 * Process received TLS application data.
37 *
38 * @param reader TLS data buffer
39 * @return
40 * - SUCCESS if application completed
41 * - FAILED if application data processing failed
42 * - NEED_MORE if another invocation of process/build needed
43 */
44 status_t (*process)(tls_application_t *this, tls_reader_t *reader);
45
46 /**
47 * Build TLS application data to send out.
48 *
49 * @param writer TLS data buffer to write to
50 * @return
51 * - SUCCESS if application completed
52 * - FAILED if application data build failed
53 * - NEED_MORE if more data ready for delivery
54 * - INVALID_STATE if more input to process() required
55 */
56 status_t (*build)(tls_application_t *this, tls_writer_t *writer);
57
58 /**
59 * Destroy a tls_application_t.
60 */
61 void (*destroy)(tls_application_t *this);
62 };
63
64 #endif /** TLS_APPLICATION_H_ @}*/