Doxygen fix
[strongswan.git] / src / libcharon / plugins / tnccs_20 / state_machine / pb_tnc_state_machine.h
1 /*
2 * Copyright (C) 2010 Andreas Steffen
3 * 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 pb_tnc_state_machine pb_tnc_state_machine
18 * @{ @ingroup tnccs_20
19 */
20
21 #ifndef PB_TNC_STATE_MACHINE_H_
22 #define PB_TNC_STATE_MACHINE_H_
23
24 typedef struct pb_tnc_state_machine_t pb_tnc_state_machine_t;
25 typedef enum pb_tnc_state_t pb_tnc_state_t;
26
27 #include "batch/pb_tnc_batch.h"
28
29 #include <library.h>
30
31 /**
32 * PB-TNC States (state machine) as defined in section 3.2 of RFC 5793
33 */
34 enum pb_tnc_state_t {
35 PB_STATE_INIT,
36 PB_STATE_SERVER_WORKING,
37 PB_STATE_CLIENT_WORKING,
38 PB_STATE_DECIDED,
39 PB_STATE_END,
40 };
41
42 /**
43 * enum name for pb_tnc_state_t.
44 */
45 extern enum_name_t *pb_tnc_state_names;
46
47 /**
48 * Interface for the PB-TNC state machine.
49 */
50 struct pb_tnc_state_machine_t {
51
52 /**
53 * Get the current PB-TNC STATE
54 *
55 * @return current state
56 */
57 pb_tnc_state_t (*get_state)(pb_tnc_state_machine_t *this);
58
59 /**
60 * Compute state transition due to received PB-TNC Batch
61 *
62 * @param type type of received batch
63 * @result TRUE if a valid transition was found, FALSE otherwise
64 */
65 bool (*receive_batch)(pb_tnc_state_machine_t *this, pb_tnc_batch_type_t type);
66
67 /**
68 * Compute state transition due to sent PB-TNC Batch
69 *
70 * @param type type of sent batch
71 * @result TRUE if a valid transition was found, FALSE otherwise
72 */
73 bool (*send_batch)(pb_tnc_state_machine_t *this, pb_tnc_batch_type_t type);
74
75 /**
76 * Informs whether the last received PB-TNC CDATA Batch was empty
77 *
78 * @result TRUE if last received PB-TNC CDATA Batch was empty
79 */
80 bool (*get_empty_cdata)(pb_tnc_state_machine_t *this);
81
82 /**
83 * Store information whether the received PB-TNC CDATA Batch was empty
84 *
85 * @param empty set to TRUE if received PB-TNC CDATA Batch was empty
86 */
87 void (*set_empty_cdata)(pb_tnc_state_machine_t *this, bool empty);
88
89 /**
90 * Destroys a pb_tnc_state_machine_t object.
91 */
92 void (*destroy)(pb_tnc_state_machine_t *this);
93 };
94
95 /**
96 * Create and initialize a PB-TNC state machine
97 *
98 * @param is_server TRUE if PB-TNC server, FALSE if PB-TNC client
99 */
100 pb_tnc_state_machine_t* pb_tnc_state_machine_create(bool is_server);
101
102 #endif /** PB_TNC_STATE_MACHINE_H_ @}*/