2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 #include "imv_test_state.h"
19 typedef struct private_imv_test_state_t private_imv_test_state_t
;
22 * Private data of an imv_test_state_t object.
24 struct private_imv_test_state_t
{
27 * Public members of imv_test_state_t
29 imv_test_state_t
public;
34 TNC_ConnectionID connection_id
;
37 * TNCCS connection state
39 TNC_ConnectionState state
;
42 * IMV action recommendation
44 TNC_IMV_Action_Recommendation rec
;
47 * IMV evaluation result
49 TNC_IMV_Evaluation_Result eval
;
52 * IMC-IMV round-trip count
58 METHOD(imv_state_t
, get_connection_id
, TNC_ConnectionID
,
59 private_imv_test_state_t
*this)
61 return this->connection_id
;
64 METHOD(imv_state_t
, change_state
, void,
65 private_imv_test_state_t
*this, TNC_ConnectionState new_state
)
67 this->state
= new_state
;
70 METHOD(imv_state_t
, get_recommendation
, void,
71 private_imv_test_state_t
*this, TNC_IMV_Action_Recommendation
*rec
,
72 TNC_IMV_Evaluation_Result
*eval
)
78 METHOD(imv_state_t
, set_recommendation
, void,
79 private_imv_test_state_t
*this, TNC_IMV_Action_Recommendation rec
,
80 TNC_IMV_Evaluation_Result eval
)
86 METHOD(imv_state_t
, destroy
, void,
87 private_imv_test_state_t
*this)
92 METHOD(imv_test_state_t
, another_round
, bool,
93 private_imv_test_state_t
*this)
95 return (this->rounds
-- > 0);
99 * Described in header.
101 imv_state_t
*imv_test_state_create(TNC_ConnectionID connection_id
, int rounds
)
103 private_imv_test_state_t
*this;
108 .get_connection_id
= _get_connection_id
,
109 .change_state
= _change_state
,
110 .get_recommendation
= _get_recommendation
,
111 .set_recommendation
= _set_recommendation
,
114 .another_round
= _another_round
,
116 .state
= TNC_CONNECTION_STATE_CREATE
,
117 .rec
= TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION
,
118 .eval
= TNC_IMV_EVALUATION_RESULT_DONT_KNOW
,
119 .connection_id
= connection_id
,
123 return &this->public.interface
;