2 * Copyright (C) 2011-2015 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 pa_tnc_msg pa_tnc_msg
24 typedef struct pa_tnc_msg_t pa_tnc_msg_t
;
26 #define PA_TNC_VERSION 0x01
27 #define PA_TNC_HEADER_SIZE 8
29 #include "pa_tnc_attr.h"
34 * Interface for the RFC 5792 PA-TNC Posture Attribute protocol.
40 * Get the encoding of the PA-TNC message
42 * @return encoded PA-TNC message
44 chunk_t (*get_encoding
)(pa_tnc_msg_t
*this);
47 * Get the remaining space in octets left in the PA-TNC message
49 * @return remaining space or 0 if max_msg_len is not set
51 size_t (*get_space
)(pa_tnc_msg_t
*this);
54 * Add a PA-TNC attribute
56 * @param attr PA-TNC attribute to be added
57 * @return TRUE if attribute fit into message and was added
59 bool (*add_attribute
)(pa_tnc_msg_t
*this, pa_tnc_attr_t
* attr
);
62 * Build the PA-TNC message
64 * @return TRUE if PA-TNC message was built successfully
66 bool (*build
)(pa_tnc_msg_t
*this);
69 * Process the PA-TNC message
71 * @return return processing status
73 status_t (*process
)(pa_tnc_msg_t
*this);
76 * Process all IETF standard error PA-TNC attributes
78 * @param non_fatal_types list of non fatal unsupported attribute types
79 * @return TRUE if at least one fatal error processed
81 bool (*process_ietf_std_errors
)(pa_tnc_msg_t
*this,
82 linked_list_t
*non_fatal_types
);
85 * Enumerates over all PA-TNC attributes
87 * @return return attribute enumerator
89 enumerator_t
* (*create_attribute_enumerator
)(pa_tnc_msg_t
*this);
92 * Enumerates over all parsing errors
94 * @return return error enumerator
96 enumerator_t
* (*create_error_enumerator
)(pa_tnc_msg_t
*this);
99 * Destroys a pa_tnc_msg_t object.
101 void (*destroy
)(pa_tnc_msg_t
*this);
105 * Create an empty PA-TNC message
107 pa_tnc_msg_t
* pa_tnc_msg_create(size_t max_msg_len
);
110 * Create an unprocessed PA-TNC message from received data
112 * @param data PA-TNC message data
114 pa_tnc_msg_t
* pa_tnc_msg_create_from_data(chunk_t data
);
116 #endif /** PA_TNC_MSG_H_ @}*/