Added add_segment() method to IETF attributes
[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 * @defgroup imc_test imc_test
17 * @ingroup libimcv_plugins
18 *
19 * @defgroup imc_test_state_t imc_test_state
20 * @{ @ingroup imc_test
21 */
22
23 #ifndef IMC_TEST_STATE_H_
24 #define IMC_TEST_STATE_H_
25
26 #include <tncifimc.h>
27 #include <imc/imc_state.h>
28 #include <library.h>
29
30 typedef struct imc_test_state_t imc_test_state_t;
31
32 /**
33 * Internal state of an imc_test_t connection instance
34 */
35 struct imc_test_state_t {
36
37 /**
38 * imc_state_t interface
39 */
40 imc_state_t interface;
41
42 /**
43 * get the command to send to IMV
44 *
45 * @return commmand to send to IMV
46 */
47 char* (*get_command)(imc_test_state_t *this);
48
49 /**
50 * set the command to send to IMV
51 *
52 * @param command commmand to send to IMV
53 */
54 void (*set_command)(imc_test_state_t *this, char *command);
55
56 /**
57 * get the value size of a dummy attribute to send to IMV
58 *
59 * @return size of the dummy attribute value to send to IMV
60 */
61 int (*get_dummy_size)(imc_test_state_t *this);
62
63 /**
64 * Test and reset the first handshake flag
65 *
66 * @return TRUE if first handshake
67 */
68 bool (*is_first_handshake)(imc_test_state_t *this);
69
70 /**
71 * Test and reset the retry handshake flag
72 *
73 * @return TRUE if a handshake retry should be done
74 */
75 bool (*do_handshake_retry)(imc_test_state_t *this);
76
77 };
78
79 /**
80 * Create an imc_test_state_t instance
81 *
82 * @param id connection ID
83 * @param command command to send to IMV
84 * @param dummy_size size of the dummy attribute to send (only if > 0)
85 * @param retry TRUE if a handshake retry should be done
86 */
87 imc_state_t* imc_test_state_create(TNC_ConnectionID id, char* command,
88 int dummy_size, bool retry);
89
90 #endif /** IMC_TEST_STATE_H_ @}*/