2 * Copyright (C) 2012-2014 Andreas Steffen
4 * Copyright (C) secunet Security Networks AG
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
18 #include "ita_attr_angel.h"
20 #include <bio/bio_reader.h>
21 #include <bio/bio_writer.h>
22 #include <collections/linked_list.h>
24 #include <utils/debug.h>
26 typedef struct private_ita_attr_angel_t private_ita_attr_angel_t
;
29 * Private data of an ita_attr_angel_t object.
31 struct private_ita_attr_angel_t
{
34 * Public members of ita_attr_angel_t
36 ita_attr_angel_t
public;
39 * Vendor-specific attribute type
54 METHOD(pa_tnc_attr_t
, get_type
, pen_type_t
,
55 private_ita_attr_angel_t
*this)
60 METHOD(pa_tnc_attr_t
, get_value
, chunk_t
,
61 private_ita_attr_angel_t
*this)
66 METHOD(pa_tnc_attr_t
, get_noskip_flag
, bool,
67 private_ita_attr_angel_t
*this)
69 return this->noskip_flag
;
72 METHOD(pa_tnc_attr_t
, set_noskip_flag
,void,
73 private_ita_attr_angel_t
*this, bool noskip
)
75 this->noskip_flag
= noskip
;
78 METHOD(pa_tnc_attr_t
, build
, void,
79 private_ita_attr_angel_t
*this)
81 /* nothing to build */
84 METHOD(pa_tnc_attr_t
, process
, status_t
,
85 private_ita_attr_angel_t
*this, uint32_t *offset
)
90 METHOD(pa_tnc_attr_t
, add_segment
, void,
91 private_ita_attr_angel_t
*this, chunk_t segment
)
96 METHOD(pa_tnc_attr_t
, get_ref
, pa_tnc_attr_t
*,
97 private_ita_attr_angel_t
*this)
100 return &this->public.pa_tnc_attribute
;
103 METHOD(pa_tnc_attr_t
, destroy
, void,
104 private_ita_attr_angel_t
*this)
106 if (ref_put(&this->ref
))
113 * Described in header.
115 pa_tnc_attr_t
*ita_attr_angel_create(bool start
)
117 private_ita_attr_angel_t
*this;
121 .pa_tnc_attribute
= {
122 .get_type
= _get_type
,
123 .get_value
= _get_value
,
124 .get_noskip_flag
= _get_noskip_flag
,
125 .set_noskip_flag
= _set_noskip_flag
,
128 .add_segment
= _add_segment
,
133 .type
= { PEN_ITA
, start
? ITA_ATTR_START_ANGEL
: ITA_ATTR_STOP_ANGEL
},
137 return &this->public.pa_tnc_attribute
;
141 * Described in header.
143 pa_tnc_attr_t
*ita_attr_angel_create_from_data(bool start
)
145 private_ita_attr_angel_t
*this;
149 .pa_tnc_attribute
= {
150 .get_type
= _get_type
,
151 .get_value
= _get_value
,
152 .get_noskip_flag
= _get_noskip_flag
,
153 .set_noskip_flag
= _set_noskip_flag
,
156 .add_segment
= _add_segment
,
161 .type
= { PEN_ITA
, start
? ITA_ATTR_START_ANGEL
: ITA_ATTR_STOP_ANGEL
},
165 return &this->public.pa_tnc_attribute
;