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
17 #include "ita_attr_dummy.h"
21 #include <utils/debug.h>
23 typedef struct private_ita_attr_dummy_t private_ita_attr_dummy_t
;
26 * Private data of an ita_attr_dummy_t object.
28 struct private_ita_attr_dummy_t
{
31 * Public members of ita_attr_dummy_t
33 ita_attr_dummy_t
public;
36 * Vendor-specific attribute type
51 * Size of the attribute value
61 METHOD(pa_tnc_attr_t
, get_type
, pen_type_t
,
62 private_ita_attr_dummy_t
*this)
67 METHOD(pa_tnc_attr_t
, get_value
, chunk_t
,
68 private_ita_attr_dummy_t
*this)
73 METHOD(pa_tnc_attr_t
, get_noskip_flag
, bool,
74 private_ita_attr_dummy_t
*this)
76 return this->noskip_flag
;
79 METHOD(pa_tnc_attr_t
, set_noskip_flag
,void,
80 private_ita_attr_dummy_t
*this, bool noskip
)
82 this->noskip_flag
= noskip
;
85 METHOD(pa_tnc_attr_t
, build
, void,
86 private_ita_attr_dummy_t
*this)
92 this->value
= chunk_alloc(this->size
);
93 memset(this->value
.ptr
, 0xdd, this->value
.len
);
96 METHOD(pa_tnc_attr_t
, process
, status_t
,
97 private_ita_attr_dummy_t
*this, u_int32_t
*offset
)
99 this->size
= this->value
.len
;
104 METHOD(pa_tnc_attr_t
, get_ref
, pa_tnc_attr_t
*,
105 private_ita_attr_dummy_t
*this)
108 return &this->public.pa_tnc_attribute
;
111 METHOD(pa_tnc_attr_t
, destroy
, void,
112 private_ita_attr_dummy_t
*this)
114 if (ref_put(&this->ref
))
116 free(this->value
.ptr
);
121 METHOD(ita_attr_dummy_t
, get_size
, int,
122 private_ita_attr_dummy_t
*this)
128 * Described in header.
130 pa_tnc_attr_t
*ita_attr_dummy_create(int size
)
132 private_ita_attr_dummy_t
*this;
136 .pa_tnc_attribute
= {
137 .get_type
= _get_type
,
138 .get_value
= _get_value
,
139 .get_noskip_flag
= _get_noskip_flag
,
140 .set_noskip_flag
= _set_noskip_flag
,
146 .get_size
= _get_size
,
148 .type
= { PEN_ITA
, ITA_ATTR_DUMMY
},
153 return &this->public.pa_tnc_attribute
;
157 * Described in header.
159 pa_tnc_attr_t
*ita_attr_dummy_create_from_data(chunk_t data
)
161 private_ita_attr_dummy_t
*this;
165 .pa_tnc_attribute
= {
166 .get_type
= _get_type
,
167 .get_value
= _get_value
,
173 .get_size
= _get_size
,
175 .type
= { PEN_ITA
, ITA_ATTR_DUMMY
},
176 .value
= chunk_clone(data
),
180 return &this->public.pa_tnc_attribute
;