summaryrefslogtreecommitdiff
path: root/src/libimcv/imv/imv_state.h
blob: d11d15e0df9d190a87c0f6a2977c03214585e16e (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
 * Copyright (C) 2011-2014 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 imv_state_t imv_state
 * @{ @ingroup libimcv_imv
 */

#ifndef IMV_STATE_H_
#define IMV_STATE_H_

#include "imv_session.h"

#include <tncifimv.h>

#include <library.h>

typedef struct imv_state_t imv_state_t;

/**
 * Internal state of an IMV connection instance
 */
struct imv_state_t {

	/**
	 * Get the TNCCS connection ID attached to the state
	 *
	 * @return				TNCCS connection ID of the state
	 */
	 TNC_ConnectionID (*get_connection_id)(imv_state_t *this);

	/**
	 * Checks if long message types are supported for this TNCCS connection
	 *
	 * @return				TRUE if set, FALSE otherwise
	 */
	bool (*has_long)(imv_state_t *this);

	/**
	 * Checks if the exclusive delivery is supported for this TNCCS connection
	 *
	 * @return				TRUE if set, FALSE otherwise
	 */
	bool (*has_excl)(imv_state_t *this);

	/**
	 * Sets the long message types and exclusive flags for this TNCCS connection
	 *
	 * @param has_long		TNCCS connection supports long message types
	 * @param has_excl		TNCCS connection supports exclusive delivery
	 * @return				TRUE if set, FALSE otherwise
	 */
	void (*set_flags)(imv_state_t *this, bool has_long, bool has_excl);

	/**
	 * Set the maximum size of a PA-TNC message for this TNCCS connection
	 *
	 * @param max_msg_len	maximum size of a PA-TNC message
	 */
	void (*set_max_msg_len)(imv_state_t *this, uint32_t max_msg_len);

	/**
	 * Get the maximum size of a PA-TNC message for this TNCCS connection
	 *
	 * @return				maximum size of a PA-TNC message
	 */
	uint32_t (*get_max_msg_len)(imv_state_t *this);

	/**
	 * Set flags for completed actions
	 *
	 * @param flags			Flags to be set
	 */
	void (*set_action_flags)(imv_state_t *this, uint32_t flags);

	/**
	 * Get flags set for completed actions
	 *
	 * @return				Flags set for completed actions
	 */
	uint32_t (*get_action_flags)(imv_state_t *this);

	/**
	 * Set session associated with TNCCS Connection
	 *
	 * @param session		Session associated with TNCCS Connection
	 */
	void (*set_session)(imv_state_t *this, imv_session_t *session);

	/**
	 * Get session associated with TNCCS Connection
	 *
	 * @return				Session associated with TNCCS Connection
	 */
	imv_session_t* (*get_session)(imv_state_t *this);

	/**
	 * Change the connection state
	 *
	 * @param new_state		new connection state
	 */
	void (*change_state)(imv_state_t *this, TNC_ConnectionState new_state);

	/**
	 * Get IMV action recommendation and evaluation result
	 *
	 * @param rec			IMV action recommendation
	 * @param eval			IMV evaluation result
	 *
	 */
	void (*get_recommendation)(imv_state_t *this,
							   TNC_IMV_Action_Recommendation *rec,
							   TNC_IMV_Evaluation_Result *eval);

	/**
	 * Set IMV action recommendation and evaluation result
	 *
	 * @param rec			IMV action recommendation
	 * @param eval			IMV evaluation result
	 *
	 */
	void (*set_recommendation)(imv_state_t *this,
							   TNC_IMV_Action_Recommendation rec,
							   TNC_IMV_Evaluation_Result eval);

	/**
	 * Update IMV action recommendation and evaluation result
	 *
	 * @param rec			IMV action recommendation
	 * @param eval			IMV evaluation result
	 *
	 */
	void (*update_recommendation)(imv_state_t *this,
								  TNC_IMV_Action_Recommendation rec,
								  TNC_IMV_Evaluation_Result eval);

	/**
	 * Get reason string based on the preferred language
	 *
	 * @param language_enumerator	language enumerator
	 * @param reason_string			reason string
	 * @param reason_language		language of the returned reason string
	 * @return						TRUE if a reason string was found
	 */
	bool (*get_reason_string)(imv_state_t *this,
							  enumerator_t *language_enumerator,
							  chunk_t *reason_string, char **reason_language);

	/**
	 * Get remediation instructions based on the preferred language
	 *
	 * @param language_enumerator	language enumerator
	 * @param string				remediation instruction string
	 * @param lang_code				language of the remediation instructions
	 * @param uri					remediation URI
	 * @return						TRUE if remediation instructions were found
	 */
	bool (*get_remediation_instructions)(imv_state_t *this,
										 enumerator_t *language_enumerator,
										 chunk_t *string, char **lang_code,
										 char **uri);

	/**
	 * Destroys an imv_state_t object
	 */
	void (*destroy)(imv_state_t *this);
};

#endif /** IMV_STATE_H_ @}*/