2 * Copyright (C) 2011-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_scanner_state.h"
20 typedef struct private_imc_scanner_state_t private_imc_scanner_state_t
;
23 * Private data of an imc_scanner_state_t object.
25 struct private_imc_scanner_state_t
{
28 * Public members of imc_scanner_state_t
30 imc_scanner_state_t
public;
35 TNC_ConnectionID connection_id
;
38 * TNCCS connection state
40 TNC_ConnectionState state
;
43 * Does the TNCCS connection support long message types?
48 * Does the TNCCS connection support exclusive delivery?
53 * Maximum PA-TNC message size for this TNCCS connection
55 u_int32_t max_msg_len
;
58 METHOD(imc_state_t
, get_connection_id
, TNC_ConnectionID
,
59 private_imc_scanner_state_t
*this)
61 return this->connection_id
;
64 METHOD(imc_state_t
, has_long
, bool,
65 private_imc_scanner_state_t
*this)
67 return this->has_long
;
70 METHOD(imc_state_t
, has_excl
, bool,
71 private_imc_scanner_state_t
*this)
73 return this->has_excl
;
76 METHOD(imc_state_t
, set_flags
, void,
77 private_imc_scanner_state_t
*this, bool has_long
, bool has_excl
)
79 this->has_long
= has_long
;
80 this->has_excl
= has_excl
;
83 METHOD(imc_state_t
, set_max_msg_len
, void,
84 private_imc_scanner_state_t
*this, u_int32_t max_msg_len
)
86 this->max_msg_len
= max_msg_len
;
89 METHOD(imc_state_t
, get_max_msg_len
, u_int32_t
,
90 private_imc_scanner_state_t
*this)
92 return this->max_msg_len
;
95 METHOD(imc_state_t
, change_state
, void,
96 private_imc_scanner_state_t
*this, TNC_ConnectionState new_state
)
98 this->state
= new_state
;
101 METHOD(imc_state_t
, destroy
, void,
102 private_imc_scanner_state_t
*this)
108 * Described in header.
110 imc_state_t
*imc_scanner_state_create(TNC_ConnectionID connection_id
)
112 private_imc_scanner_state_t
*this;
117 .get_connection_id
= _get_connection_id
,
118 .has_long
= _has_long
,
119 .has_excl
= _has_excl
,
120 .set_flags
= _set_flags
,
121 .set_max_msg_len
= _set_max_msg_len
,
122 .get_max_msg_len
= _get_max_msg_len
,
123 .change_state
= _change_state
,
127 .state
= TNC_CONNECTION_STATE_CREATE
,
128 .connection_id
= connection_id
,
131 return &this->public.interface
;