2 * Copyright (C) 2012 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
16 #include "imc_os_state.h"
18 #include <tncif_names.h>
22 typedef struct private_imc_os_state_t private_imc_os_state_t
;
25 * Private data of an imc_os_state_t object.
27 struct private_imc_os_state_t
{
30 * Public members of imc_os_state_t
32 imc_os_state_t
public;
37 TNC_ConnectionID connection_id
;
40 * TNCCS connection state
42 TNC_ConnectionState state
;
45 * Assessment/Evaluation Result
47 TNC_IMV_Evaluation_Result result
;
50 * Does the TNCCS connection support long message types?
55 * Does the TNCCS connection support exclusive delivery?
60 * Maximum PA-TNC message size for this TNCCS connection
62 u_int32_t max_msg_len
;
65 METHOD(imc_state_t
, get_connection_id
, TNC_ConnectionID
,
66 private_imc_os_state_t
*this)
68 return this->connection_id
;
71 METHOD(imc_state_t
, has_long
, bool,
72 private_imc_os_state_t
*this)
74 return this->has_long
;
77 METHOD(imc_state_t
, has_excl
, bool,
78 private_imc_os_state_t
*this)
80 return this->has_excl
;
83 METHOD(imc_state_t
, set_flags
, void,
84 private_imc_os_state_t
*this, bool has_long
, bool has_excl
)
86 this->has_long
= has_long
;
87 this->has_excl
= has_excl
;
90 METHOD(imc_state_t
, set_max_msg_len
, void,
91 private_imc_os_state_t
*this, u_int32_t max_msg_len
)
93 this->max_msg_len
= max_msg_len
;
96 METHOD(imc_state_t
, get_max_msg_len
, u_int32_t
,
97 private_imc_os_state_t
*this)
99 return this->max_msg_len
;
102 METHOD(imc_state_t
, change_state
, void,
103 private_imc_os_state_t
*this, TNC_ConnectionState new_state
)
105 this->state
= new_state
;
108 METHOD(imc_state_t
, set_result
, void,
109 private_imc_os_state_t
*this, TNC_IMCID id
,
110 TNC_IMV_Evaluation_Result result
)
112 this->result
= result
;
115 METHOD(imc_state_t
, get_result
, bool,
116 private_imc_os_state_t
*this, TNC_IMCID id
,
117 TNC_IMV_Evaluation_Result
*result
)
121 *result
= this->result
;
123 return this->result
!= TNC_IMV_EVALUATION_RESULT_DONT_KNOW
;
126 METHOD(imc_state_t
, destroy
, void,
127 private_imc_os_state_t
*this)
133 * Described in header.
135 imc_state_t
*imc_os_state_create(TNC_ConnectionID connection_id
)
137 private_imc_os_state_t
*this;
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
,
154 .state
= TNC_CONNECTION_STATE_CREATE
,
155 .result
= TNC_IMV_EVALUATION_RESULT_DONT_KNOW
,
156 .connection_id
= connection_id
,
159 return &this->public.interface
;