2 * Copyright (C) 2010 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
17 #include "pb_experimental_msg.h"
19 typedef struct private_pb_experimental_msg_t private_pb_experimental_msg_t
;
22 * Private data of a pb_experimental_msg_t object.
25 struct private_pb_experimental_msg_t
{
27 * Public pb_experimental_msg_t interface.
29 pb_experimental_msg_t
public;
42 METHOD(pb_tnc_msg_t
, get_type
, pen_type_t
,
43 private_pb_experimental_msg_t
*this)
48 METHOD(pb_tnc_msg_t
, get_encoding
, chunk_t
,
49 private_pb_experimental_msg_t
*this)
51 return this->encoding
;
54 METHOD(pb_tnc_msg_t
, build
, void,
55 private_pb_experimental_msg_t
*this)
57 /* nothing to do since message contents equal encoding */
60 METHOD(pb_tnc_msg_t
, process
, status_t
,
61 private_pb_experimental_msg_t
*this, uint32_t *offset
)
66 METHOD(pb_tnc_msg_t
, destroy
, void,
67 private_pb_experimental_msg_t
*this)
69 free(this->encoding
.ptr
);
76 pb_tnc_msg_t
*pb_experimental_msg_create_from_data(chunk_t data
)
78 private_pb_experimental_msg_t
*this;
83 .get_type
= _get_type
,
84 .get_encoding
= _get_encoding
,
90 .type
= { PEN_IETF
, PB_MSG_EXPERIMENTAL
},
91 .encoding
= chunk_clone(data
),
94 return &this->public.pb_interface
;
100 pb_tnc_msg_t
*pb_experimental_msg_create(chunk_t body
)
102 return pb_experimental_msg_create_from_data(body
);