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 a value 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.
122 * PROPOSAL_SUBSTRUCTURE has a value of PRIVATE USE space
124 * This payload type is not send over wire and just
125 * used internally to handle a proposal substructure like a payload.
127 PROPOSAL_SUBSTRUCTURE
= 141,
130 * TRANSFORM_SUBSTRUCTURE has a value of PRIVATE USE space
132 * This payload type is not send over wire and just
133 * used internally to handle a transform substructure like a payload.
135 TRANSFORM_SUBSTRUCTURE
= 142,
138 * TRANSFORM_ATTRIBUTE has a value of PRIVATE USE space
140 * This payload type is not send over wire and just
141 * used internally to handle a transform attribute like a payload.
143 TRANSFORM_ATTRIBUTE
= 143,
148 * build string mapping array for payload_type_t
150 extern mapping_t payload_type_m
[];
154 * @brief Generic interface for all payload types (inclusive
155 * header and substructures)
159 typedef struct payload_s payload_t
;
163 * @brief Destroys a payload and all included substructures.
165 * @param this payload to destroy
167 * SUCCESS in any case
169 status_t (*destroy
) (payload_t
*this);
172 * @brief Get encoding rules for this payload
174 * @param this calling object
175 * @param[out] rules location to store pointer of first rule
176 * @param[out] rule_count location to store number of rules
178 * SUCCESS in any case
180 status_t (*get_encoding_rules
) (payload_t
*this, encoding_rule_t
**rules
, size_t *rule_count
);
183 * @brief get type of payload
185 * @param this calling object
186 * @return type of this payload
188 payload_type_t (*get_type
) (payload_t
*this);
191 * @brief get type of next payload or zero if this is the last one
193 * @param this calling object
194 * @return type of next payload
196 payload_type_t (*get_next_type
) (payload_t
*this);
199 * @brief set type of next payload
201 * @param this calling object
202 * @param type type of next payload
203 * @return SUCCESS in any case
205 status_t (*set_next_type
) (payload_t
*this,payload_type_t type
);
208 * @brief get length of payload
210 * @param this calling object
211 * @return length of this payload
213 size_t (*get_length
) (payload_t
*this);
216 * @brief Verifies payload structure and makes consistence check
218 * @param this calling object
221 * - FAILED if consistence not given
223 status_t (*verify
) (payload_t
*this);
227 * @brief Create an empty payload.
229 * Useful for the parser, who wants a generic constructor for all payloads.
230 * It supports all payload_t methods.
232 * @param type type of the payload to create
234 * - created payload, or
238 payload_t
*payload_create(payload_type_t type
);
240 #endif /*PAYLOAD_H_*/