2
* Copyright (C) 2012 Tobias Brunner
3
* Copyright (C) 2012 Andreas Steffen
4
* Hochschule fuer Technik Rapperswil
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation; either version 2 of the License, or (at your
9
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17
#include "imc_android_state.h"
19
#include <tncif_names.h>
21
#include <utils/debug.h>
23
typedef struct private_imc_android_state_t private_imc_android_state_t;
26
* Private data of an imc_state_t object.
28
struct private_imc_android_state_t {
33
imc_android_state_t public;
38
TNC_ConnectionID connection_id;
41
* TNCCS connection state
43
TNC_ConnectionState state;
46
* Assessment/Evaluation Result
48
TNC_IMV_Evaluation_Result result;
51
* Does the TNCCS connection support long message types?
56
* Does the TNCCS connection support exclusive delivery?
61
* Maximum PA-TNC message size for this TNCCS connection
63
u_int32_t max_msg_len;
66
* TCG Platform Trust Service (PTS)
71
METHOD(imc_state_t, get_connection_id, TNC_ConnectionID,
72
private_imc_android_state_t *this)
74
return this->connection_id;
77
METHOD(imc_state_t, has_long, bool,
78
private_imc_android_state_t *this)
80
return this->has_long;
83
METHOD(imc_state_t, has_excl, bool,
84
private_imc_android_state_t *this)
86
return this->has_excl;
89
METHOD(imc_state_t, set_flags, void,
90
private_imc_android_state_t *this, bool has_long, bool has_excl)
92
this->has_long = has_long;
93
this->has_excl = has_excl;
96
METHOD(imc_state_t, set_max_msg_len, void,
97
private_imc_android_state_t *this, u_int32_t max_msg_len)
99
this->max_msg_len = max_msg_len;
102
METHOD(imc_state_t, get_max_msg_len, u_int32_t,
103
private_imc_android_state_t *this)
105
return this->max_msg_len;
108
METHOD(imc_state_t, change_state, void,
109
private_imc_android_state_t *this, TNC_ConnectionState new_state)
111
this->state = new_state;
114
METHOD(imc_state_t, set_result, void,
115
private_imc_android_state_t *this, TNC_IMCID id, TNC_IMV_Evaluation_Result result)
117
this->result = result;
120
METHOD(imc_state_t, get_result, bool,
121
private_imc_android_state_t *this, TNC_IMCID id, TNC_IMV_Evaluation_Result *result)
125
*result = this->result;
127
return this->result != TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
130
METHOD(imc_state_t, destroy, void,
131
private_imc_android_state_t *this)
133
this->pts->destroy(this->pts);
137
METHOD(imc_android_state_t, get_pts, pts_t*,
138
private_imc_android_state_t *this)
144
* Described in header.
146
imc_state_t *imc_android_state_create(TNC_ConnectionID connection_id)
148
private_imc_android_state_t *this;
153
.get_connection_id = _get_connection_id,
154
.has_long = _has_long,
155
.has_excl = _has_excl,
156
.set_flags = _set_flags,
157
.set_max_msg_len = _set_max_msg_len,
158
.get_max_msg_len = _get_max_msg_len,
159
.change_state = _change_state,
160
.set_result = _set_result,
161
.get_result = _get_result,
166
.state = TNC_CONNECTION_STATE_CREATE,
167
.result = TNC_IMV_EVALUATION_RESULT_DONT_KNOW,
168
.connection_id = connection_id,
169
.pts = pts_create(TRUE),
172
return &this->public.interface;