2 * Copyright (C) 2010 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 * @defgroup pb_tnc_msg pb_tnc_msg
18 * @{ @ingroup tnccs_20
24 typedef enum pb_tnc_msg_type_t pb_tnc_msg_type_t
;
25 typedef struct pb_tnc_msg_info_t pb_tnc_msg_info_t
;
26 typedef struct pb_tnc_msg_t pb_tnc_msg_t
;
30 #define PB_TNC_VERSION 2
33 * PB-TNC Message Types as defined in section 4.3 of RFC 5793
35 enum pb_tnc_msg_type_t
{
36 PB_MSG_EXPERIMENTAL
= 0,
38 PB_MSG_ASSESSMENT_RESULT
= 2,
39 PB_MSG_ACCESS_RECOMMENDATION
= 3,
40 PB_MSG_REMEDIATION_PARAMETERS
= 4,
42 PB_MSG_LANGUAGE_PREFERENCE
= 6,
43 PB_MSG_REASON_STRING
= 7,
48 * enum name for pb_tnc_msg_type_t.
50 extern enum_name_t
*pb_tnc_msg_type_names
;
53 * Information entry describing a PB-TNC Message Type
55 struct pb_tnc_msg_info_t
{
59 signed char has_noskip_flag
;
62 #define TRUE_OR_FALSE 2
65 * Information on PB-TNC Message Types
67 extern pb_tnc_msg_info_t pb_tnc_msg_infos
[];
70 * Generic interface for all PB-TNC message types.
72 * To handle all messages in a generic way, this interface
73 * must be implemented by each message type.
78 * Get the PB-TNC Message Type
80 * @return PB-TNC Message Type
82 pb_tnc_msg_type_t (*get_type
)(pb_tnc_msg_t
*this);
85 * Get the encoding of the PB-TNC Message Value
87 * @return encoded PB-TNC Message Value
89 chunk_t (*get_encoding
)(pb_tnc_msg_t
*this);
92 * Build the PB-TNC Message Value
94 void (*build
)(pb_tnc_msg_t
*this);
97 * Process the PB-TNC Message Value
99 * @param relative offset where an error occurred
100 * @return return processing status
102 status_t (*process
)(pb_tnc_msg_t
*this, u_int32_t
*offset
);
105 * Get a new reference to the message.
107 * @return this, with an increased refcount
109 pb_tnc_msg_t
* (*get_ref
)(pb_tnc_msg_t
*this);
112 * Destroys a pb_tnc_msg_t object.
114 void (*destroy
)(pb_tnc_msg_t
*this);
118 * Create an unprocessed PB-TNC message
120 * Useful for the parser which wants a generic constructor for all
121 * pb_tnc_message_t types.
123 * @param type PB-TNC message type
124 * @param value PB-TNC message value
126 pb_tnc_msg_t
* pb_tnc_msg_create_from_data(pb_tnc_msg_type_t type
, chunk_t value
);
128 #endif /** PB_TNC_MSG_H_ @}*/