From 668f9fcba9cbc67d09410a25e77dc217df45ee2a Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 6 Dec 2005 11:51:13 +0000 Subject: - better management of unknown_payload, with critical check - message code cleanup --- Source/charon/encoding/payloads/unknown_payload.h | 57 +++++++---------------- 1 file changed, 18 insertions(+), 39 deletions(-) (limited to 'Source/charon/encoding/payloads/unknown_payload.h') diff --git a/Source/charon/encoding/payloads/unknown_payload.h b/Source/charon/encoding/payloads/unknown_payload.h index ea365871b..2558ce719 100644 --- a/Source/charon/encoding/payloads/unknown_payload.h +++ b/Source/charon/encoding/payloads/unknown_payload.h @@ -27,73 +27,52 @@ #include /** - * Length of a default payload header. + * Header length of the unknown payload. * * @ingroup payloads */ -#define DEFAULT_PAYLOAD_HEADER_LENGTH 4 +#define UNKNOWN_PAYLOAD_HEADER_LENGTH 4 typedef struct unknown_payload_t unknown_payload_t; /** - * Object representing an unknown IKEv2 payload. + * @brief Payload which can't be processed further. * - * @ingroup payloads + * When the parser finds an unknown payload, he builds an instance of + * this class. This allows further processing of this payload, such as + * a check for the critical bit in the header. + * + * @b Constructors: + * - unknown_payload_create() * + * @ingroup payloads */ struct unknown_payload_t { + /** * The payload_t interface. */ payload_t payload_interface; /** - * @brief Set the Data of the unknown payload. - * - * Data are getting cloned. - * - * @param this calling unknown_payload_t object - * @param data data following the header as chunk_t - */ - void (*set_data) (unknown_payload_t *this, chunk_t data); - - /** - * @brief Get the data of the message. - * - * Returned data are a copy of the internal one. - * - * @param this calling unknown_payload_t object - * @return data as chunk_t - */ - chunk_t (*get_data_clone) (unknown_payload_t *this); - - /** - * @brief Get the data of the message. + * @brief Get the raw data of this payload, without + * the generic payload header. * - * Returned data are NOT copied. + * Returned data are NOT copied and must not be freed. * * @param this calling unknown_payload_t object * @return data as chunk_t */ chunk_t (*get_data) (unknown_payload_t *this); - - /** - * @brief Set the real Type of this payload. - * - * @param this calling unknown_payload_t object - * @param type real type of this payload. - */ - - void (*set_real_type) (unknown_payload_t *this,payload_type_t type); /** - * @brief Get the real Type of this payload. + * @brief Get the critical flag. * - * @param this calling unknown_payload_t object - * @return real type of this payload. + * @param this calling unknown_payload_t object + * @return TRUE if payload is critical, FALSE if not */ - payload_type_t (*get_real_type) (unknown_payload_t *this); + bool (*is_critical) (unknown_payload_t *this); /** * @brief Destroys an unknown_payload_t object. -- cgit v1.2.3