summaryrefslogtreecommitdiff
path: root/src/libimcv/plugins/imc_test/imc_test_state.h
blob: 402fd14b38113d45e1171a73aed44e9ee96dd7a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

/**
 *
 * @defgroup imc_test_state_t imc_test_state
 * @{ @ingroup imc_test_state
 */

#ifndef IMC_TEST_STATE_H_
#define IMC_TEST_STATE_H_

#include <tncifimc.h>
#include <imc/imc_state.h>
#include <library.h>

typedef struct imc_test_state_t imc_test_state_t;

/**
 * Internal state of an imc_test_t connection instance
 */
struct imc_test_state_t {

	/**
	 * imc_state_t interface
	 */
	imc_state_t interface;

	/**
	 * get the command to send to IMV
	 *
	 * @return				commmand to send to IMV
	 */
	char* (*get_command)(imc_test_state_t *this);

	/**
	 * set the command to send to IMV
	 *
	 * @param command		commmand to send to IMV
	 */
	void (*set_command)(imc_test_state_t *this, char *command);

	/**
	 * get the value size of a dummy attribute to send to IMV
	 *
	 * @return				size of the dummy attribute value to send to IMV
	 */
	int (*get_dummy_size)(imc_test_state_t *this);

	/**
	 * Test and reset the first handshake flag
	 *
	 * @return				TRUE if first handshake
	 */
	bool (*is_first_handshake)(imc_test_state_t *this);

	/**
	 * Test and reset the retry handshake flag
	 *
	 * @return				TRUE if a handshake retry should be done
	 */
	bool (*do_handshake_retry)(imc_test_state_t *this);

};

/**
 * Create an imc_test_state_t instance
 *
 * @param id			connection ID
 * @param command		command to send to IMV
 * @param dummy_size	size of the dummy attribute to send (only if > 0)
 * @param retry			TRUE if a handshake retry should be done
 */
imc_state_t* imc_test_state_create(TNC_ConnectionID id, char* command,
								   int dummy_size, bool retry);

#endif /** IMC_TEST_STATE_H_ @}*/