]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libimcv/ita/ita_attr_angel.c
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libimcv / ita / ita_attr_angel.c
CommitLineData
6ac6dbd3 1/*
e77df5a1 2 * Copyright (C) 2012-2014 Andreas Steffen
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
6ac6dbd3
AS
5 *
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>.
10 *
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
14 * for more details.
15 */
16
17#include "ita_attr.h"
18#include "ita_attr_angel.h"
19
20#include <bio/bio_reader.h>
21#include <bio/bio_writer.h>
22#include <collections/linked_list.h>
23#include <pen/pen.h>
24#include <utils/debug.h>
25
26typedef struct private_ita_attr_angel_t private_ita_attr_angel_t;
27
28/**
29 * Private data of an ita_attr_angel_t object.
30 */
31struct private_ita_attr_angel_t {
32
33 /**
34 * Public members of ita_attr_angel_t
35 */
36 ita_attr_angel_t public;
37
38 /**
39 * Vendor-specific attribute type
40 */
41 pen_type_t type;
42
43 /**
44 * Noskip flag
45 */
46 bool noskip_flag;
47
48 /**
49 * Reference count
50 */
51 refcount_t ref;
52};
53
54METHOD(pa_tnc_attr_t, get_type, pen_type_t,
55 private_ita_attr_angel_t *this)
56{
57 return this->type;
58}
59
60METHOD(pa_tnc_attr_t, get_value, chunk_t,
61 private_ita_attr_angel_t *this)
62{
63 return chunk_empty;
64}
65
66METHOD(pa_tnc_attr_t, get_noskip_flag, bool,
67 private_ita_attr_angel_t *this)
68{
69 return this->noskip_flag;
70}
71
72METHOD(pa_tnc_attr_t, set_noskip_flag,void,
73 private_ita_attr_angel_t *this, bool noskip)
74{
75 this->noskip_flag = noskip;
76}
77
78METHOD(pa_tnc_attr_t, build, void,
79 private_ita_attr_angel_t *this)
80{
81 /* nothing to build */
82}
83
84METHOD(pa_tnc_attr_t, process, status_t,
b12c53ce 85 private_ita_attr_angel_t *this, uint32_t *offset)
6ac6dbd3
AS
86{
87 return SUCCESS;
88}
89
97ec4cb0
AS
90METHOD(pa_tnc_attr_t, add_segment, void,
91 private_ita_attr_angel_t *this, chunk_t segment)
92{
93 /* nothing to add */
94}
95
6ac6dbd3
AS
96METHOD(pa_tnc_attr_t, get_ref, pa_tnc_attr_t*,
97 private_ita_attr_angel_t *this)
98{
99 ref_get(&this->ref);
100 return &this->public.pa_tnc_attribute;
101}
102
103METHOD(pa_tnc_attr_t, destroy, void,
104 private_ita_attr_angel_t *this)
105{
106 if (ref_put(&this->ref))
107 {
108 free(this);
109 }
110}
111
112/**
113 * Described in header.
114 */
115pa_tnc_attr_t *ita_attr_angel_create(bool start)
116{
117 private_ita_attr_angel_t *this;
118
119 INIT(this,
120 .public = {
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,
126 .build = _build,
127 .process = _process,
97ec4cb0 128 .add_segment = _add_segment,
6ac6dbd3
AS
129 .get_ref = _get_ref,
130 .destroy = _destroy,
131 },
132 },
133 .type = { PEN_ITA, start ? ITA_ATTR_START_ANGEL : ITA_ATTR_STOP_ANGEL },
134 .ref = 1,
135 );
136
137 return &this->public.pa_tnc_attribute;
138}
139
140/**
141 * Described in header.
142 */
e77df5a1 143pa_tnc_attr_t *ita_attr_angel_create_from_data(bool start)
6ac6dbd3
AS
144{
145 private_ita_attr_angel_t *this;
146
147 INIT(this,
148 .public = {
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,
154 .build = _build,
155 .process = _process,
97ec4cb0 156 .add_segment = _add_segment,
6ac6dbd3
AS
157 .get_ref = _get_ref,
158 .destroy = _destroy,
159 },
160 },
161 .type = { PEN_ITA, start ? ITA_ATTR_START_ANGEL : ITA_ATTR_STOP_ANGEL },
162 .ref = 1,
163 );
164
165 return &this->public.pa_tnc_attribute;
166}
167
168