Fixed Doxygen comments after scanning complete src directory
[strongswan.git] / src / libimcv / plugins / imc_scanner / imc_scanner_state.c
1 /*
2 * Copyright (C) 2011-2012 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include "imc_scanner_state.h"
17
18 #include <tncif_names.h>
19
20 #include <utils/debug.h>
21
22 typedef struct private_imc_scanner_state_t private_imc_scanner_state_t;
23
24 /**
25 * Private data of an imc_scanner_state_t object.
26 */
27 struct private_imc_scanner_state_t {
28
29 /**
30 * Public members of imc_scanner_state_t
31 */
32 imc_scanner_state_t public;
33
34 /**
35 * TNCCS connection ID
36 */
37 TNC_ConnectionID connection_id;
38
39 /**
40 * TNCCS connection state
41 */
42 TNC_ConnectionState state;
43
44 /**
45 * Assessment/Evaluation Result
46 */
47 TNC_IMV_Evaluation_Result result;
48
49 /**
50 * Does the TNCCS connection support long message types?
51 */
52 bool has_long;
53
54 /**
55 * Does the TNCCS connection support exclusive delivery?
56 */
57 bool has_excl;
58
59 /**
60 * Maximum PA-TNC message size for this TNCCS connection
61 */
62 u_int32_t max_msg_len;
63 };
64
65 METHOD(imc_state_t, get_connection_id, TNC_ConnectionID,
66 private_imc_scanner_state_t *this)
67 {
68 return this->connection_id;
69 }
70
71 METHOD(imc_state_t, has_long, bool,
72 private_imc_scanner_state_t *this)
73 {
74 return this->has_long;
75 }
76
77 METHOD(imc_state_t, has_excl, bool,
78 private_imc_scanner_state_t *this)
79 {
80 return this->has_excl;
81 }
82
83 METHOD(imc_state_t, set_flags, void,
84 private_imc_scanner_state_t *this, bool has_long, bool has_excl)
85 {
86 this->has_long = has_long;
87 this->has_excl = has_excl;
88 }
89
90 METHOD(imc_state_t, set_max_msg_len, void,
91 private_imc_scanner_state_t *this, u_int32_t max_msg_len)
92 {
93 this->max_msg_len = max_msg_len;
94 }
95
96 METHOD(imc_state_t, get_max_msg_len, u_int32_t,
97 private_imc_scanner_state_t *this)
98 {
99 return this->max_msg_len;
100 }
101
102 METHOD(imc_state_t, change_state, void,
103 private_imc_scanner_state_t *this, TNC_ConnectionState new_state)
104 {
105 this->state = new_state;
106 }
107
108 METHOD(imc_state_t, set_result, void,
109 private_imc_scanner_state_t *this, TNC_IMCID id,
110 TNC_IMV_Evaluation_Result result)
111 {
112 this->result = result;
113 }
114
115 METHOD(imc_state_t, get_result, bool,
116 private_imc_scanner_state_t *this, TNC_IMCID id,
117 TNC_IMV_Evaluation_Result *result)
118 {
119 if (result)
120 {
121 *result = this->result;
122 }
123 return this->result != TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
124 }
125
126 METHOD(imc_state_t, destroy, void,
127 private_imc_scanner_state_t *this)
128 {
129 free(this);
130 }
131
132 /**
133 * Described in header.
134 */
135 imc_state_t *imc_scanner_state_create(TNC_ConnectionID connection_id)
136 {
137 private_imc_scanner_state_t *this;
138
139 INIT(this,
140 .public = {
141 .interface = {
142 .get_connection_id = _get_connection_id,
143 .has_long = _has_long,
144 .has_excl = _has_excl,
145 .set_flags = _set_flags,
146 .set_max_msg_len = _set_max_msg_len,
147 .get_max_msg_len = _get_max_msg_len,
148 .change_state = _change_state,
149 .set_result = _set_result,
150 .get_result = _get_result,
151 .destroy = _destroy,
152 },
153 },
154 .state = TNC_CONNECTION_STATE_CREATE,
155 .result = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
156 .connection_id = connection_id,
157 );
158
159 return &this->public.interface;
160 }
161
162