402fd14b38113d45e1171a73aed44e9ee96dd7a1
[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 * get the value size of a dummy attribute to send to IMV
56 *
57 * @return size of the dummy attribute value to send to IMV
58 */
59 int (*get_dummy_size)(imc_test_state_t *this);
60
61 /**
62 * Test and reset the first handshake flag
63 *
64 * @return TRUE if first handshake
65 */
66 bool (*is_first_handshake)(imc_test_state_t *this);
67
68 /**
69 * Test and reset the retry handshake flag
70 *
71 * @return TRUE if a handshake retry should be done
72 */
73 bool (*do_handshake_retry)(imc_test_state_t *this);
74
75 };
76
77 /**
78 * Create an imc_test_state_t instance
79 *
80 * @param id connection ID
81 * @param command command to send to IMV
82 * @param dummy_size size of the dummy attribute to send (only if > 0)
83 * @param retry TRUE if a handshake retry should be done
84 */
85 imc_state_t* imc_test_state_create(TNC_ConnectionID id, char* command,
86 int dummy_size, bool retry);
87
88 #endif /** IMC_TEST_STATE_H_ @}*/