4 * @brief Generic payload interface
10 * Copyright (C) 2005 Jan Hutter, Martin Willi
11 * Hochschule fuer Technik Rapperswil
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 #include "encodings.h"
29 #include "../definitions.h"
33 * Payload-Types of a IKEv2-Message
36 * Header and substructures are also defined as
37 * payload types with values from PRIVATE USE space.
39 typedef enum payload_type_e payload_type_t
;
51 SECURITY_ASSOCIATION
= 33,
71 CERTIFICATE_REQUEST
= 38,
95 TRAFFIC_SELECTOR_INITIATOR
= 44,
99 TRAFFIC_SELECTOR_RESPONDER
= 45,
111 EXTENSIBLE_AUTHENTICATION
= 48,
114 * Header has value 140 of PRIVATE USE space
116 * This payload type is not send over wire and just
117 * used internally to handle IKEv2-Header like a payload.
124 * build string mapping array for payload_type_t
126 extern mapping_t payload_type_t_mappings
[];
130 * @brief Generic interface for all payload types (inclusive
131 * header and substructures)
135 typedef struct payload_s payload_t
;
139 * @brief Destroys a payload and all included substructures.
141 * @param this payload to destroy
143 * SUCCESS in any case
145 status_t (*destroy
) (payload_t
*this);
148 * @brief Get encoding rules for this payload
150 * @param this calling object
151 * @param[out] rules location to store pointer of first rule
152 * @param[out] rule_count location to store number of rules
154 * SUCCESS in any case
156 status_t (*get_encoding_rules
) (payload_t
*this, encoding_rule_t
**rules
, size_t *rule_count
);
159 * @brief get type of payload
161 * @param this calling object
162 * @return type of this payload
164 payload_type_t (*get_type
) (payload_t
*this);
167 * @brief get type of next payload or zero if this is the last one
169 * @param this calling object
170 * @return type of next payload
172 payload_type_t (*get_next_type
) (payload_t
*this);
175 * @brief get length of payload
177 * @param this calling object
178 * @return length of this payload
180 size_t (*get_length
) (payload_t
*this);
184 * @brief Create an empty payload.
186 * Useful for the parser, who wants a generic constructor for all payloads.
187 * It supports all payload_t methods.
189 * @param type type of the payload to create
191 * - created payload, or
195 payload_t
*payload_create(payload_type_t type
);
197 #endif /*PAYLOAD_H_*/