bd14e37055239806da81ca1e21534d3b563c54bb
[strongswan.git] / src / libimcv / plugins / imc_test / imc_test_state.h
1 /*
2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 /**
16 *
17 * @defgroup imc_test_state_t imc_test_state
18 * @{ @ingroup imc_test_state
19 */
20
21 #ifndef IMC_TEST_STATE_H_
22 #define IMC_TEST_STATE_H_
23
24 #include <tncifimc.h>
25 #include <imc/imc_state.h>
26 #include <library.h>
27
28 typedef struct imc_test_state_t imc_test_state_t;
29
30 /**
31 * Internal state of an imc_test_t connection instance
32 */
33 struct imc_test_state_t {
34
35 /**
36 * imc_state_t interface
37 */
38 imc_state_t interface;
39
40 /**
41 * get the command to send to IMV
42 *
43 * @return commmand to send to IMV
44 */
45 char* (*get_command)(imc_test_state_t *this);
46
47 /**
48 * set the command to send to IMV
49 *
50 * @param command commmand to send to IMV
51 */
52 void (*set_command)(imc_test_state_t *this, char *command);
53
54 /**
55 * Test and reset the first handshake flag
56 *
57 * @return TRUE if first handshake
58 */
59 bool (*is_first_handshake)(imc_test_state_t *this);
60
61 /**
62 * Test and reset the retry handshake flag
63 *
64 * @return TRUE if a handshake retry should be done
65 */
66 bool (*do_handshake_retry)(imc_test_state_t *this);
67
68 /**
69 * Add and additional IMC ID
70 *
71 * @param id Additional IMC ID
72 */
73 void (*add_id)(imc_test_state_t *this, TNC_IMCID id);
74
75 /**
76 * Create an enumerator for additional IMC IDs
77 */
78 enumerator_t* (*create_id_enumerator)(imc_test_state_t *this);
79 };
80
81 /**
82 * Create an imc_test_state_t instance
83 *
84 * @param id connection ID
85 * @param command command to send to IMV
86 * @param retry TRUE if a handshake retry should be done
87 */
88 imc_state_t* imc_test_state_create(TNC_ConnectionID id, char* command,
89 bool retry);
90
91 #endif /** IMC_TEST_STATE_H_ @}*/