2 * Copyright (C) 2006-2008 Tobias Brunner
3 * Copyright (C) 2006 Daniel Roethlisberger
4 * Copyright (C) 2005-2006 Martin Willi
5 * Copyright (C) 2005 Jan Hutter
6 * Hochschule fuer Technik Rapperswil
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * @defgroup notify_payload notify_payload
21 * @{ @ingroup payloads
24 #ifndef NOTIFY_PAYLOAD_H_
25 #define NOTIFY_PAYLOAD_H_
27 typedef enum notify_type_t notify_type_t
;
28 typedef struct notify_payload_t notify_payload_t
;
31 #include <encoding/payloads/payload.h>
32 #include <encoding/payloads/proposal_substructure.h>
33 #include <utils/linked_list.h>
36 * Notify payload length in bytes without any spi and notification data.
38 #define NOTIFY_PAYLOAD_HEADER_LENGTH 8
41 * Notify message types.
43 * See IKEv2 RFC 3.10.1.
46 /* notify error messages */
47 UNSUPPORTED_CRITICAL_PAYLOAD
= 1,
49 INVALID_MAJOR_VERSION
= 5,
51 INVALID_MESSAGE_ID
= 9,
53 NO_PROPOSAL_CHOSEN
= 14,
54 INVALID_KE_PAYLOAD
= 17,
55 AUTHENTICATION_FAILED
= 24,
56 SINGLE_PAIR_REQUIRED
= 34,
57 NO_ADDITIONAL_SAS
= 35,
58 INTERNAL_ADDRESS_FAILURE
= 36,
59 FAILED_CP_REQUIRED
= 37,
61 INVALID_SELECTORS
= 39,
62 /* mobile extension, RFC 4555 */
63 UNACCEPTABLE_ADDRESSES
= 40,
64 UNEXPECTED_NAT_DETECTED
= 41,
65 /* mobile IPv6 bootstrapping, RFC 5026 */
66 USE_ASSIGNED_HoA
= 42,
68 /* IKE-ME, private use */
69 ME_CONNECT_FAILED
= 8192,
71 /* notify status messages */
72 INITIAL_CONTACT
= 16384,
73 SET_WINDOW_SIZE
= 16385,
74 ADDITIONAL_TS_POSSIBLE
= 16386,
75 IPCOMP_SUPPORTED
= 16387,
76 NAT_DETECTION_SOURCE_IP
= 16388,
77 NAT_DETECTION_DESTINATION_IP
= 16389,
79 USE_TRANSPORT_MODE
= 16391,
80 HTTP_CERT_LOOKUP_SUPPORTED
= 16392,
82 ESP_TFC_PADDING_NOT_SUPPORTED
= 16394,
83 NON_FIRST_FRAGMENTS_ALSO
= 16395,
84 /* mobike extension, RFC4555 */
85 MOBIKE_SUPPORTED
= 16396,
86 ADDITIONAL_IP4_ADDRESS
= 16397,
87 ADDITIONAL_IP6_ADDRESS
= 16398,
88 NO_ADDITIONAL_ADDRESSES
= 16399,
89 UPDATE_SA_ADDRESSES
= 16400,
91 NO_NATS_ALLOWED
= 16402,
92 /* repeated authentication extension, RFC4478 */
93 AUTH_LIFETIME
= 16403,
94 /* multiple authentication exchanges, RFC 4739 */
95 MULTIPLE_AUTH_SUPPORTED
= 16404,
96 ANOTHER_AUTH_FOLLOWS
= 16405,
97 /* redirect mechanism, RFC 5685 */
98 REDIRECT_SUPPORTED
= 16406,
100 REDIRECTED_FROM
= 16408,
101 /* session resumption, RFC 5723 */
102 TICKET_LT_OPAQUE
= 16409,
103 TICKET_REQUEST
= 16410,
106 TICKET_OPAQUE
= 16413,
107 /* IPv6 configuration, RFC 5739 */
109 /* wrapped esp, RFC 5840 */
110 USE_WESP_MODE
= 16415,
111 /* robust header compression, RFC 5857 */
112 ROHC_SUPPORTED
= 16416,
113 /* RFC-ietf-ipsecme-eap-mutual, assigned by IANA */
114 EAP_ONLY_AUTHENTICATION
= 16417,
116 /* BEET mode, not even a draft yet. private use */
117 USE_BEET_MODE
= 40961,
118 /* IKE-ME, private use */
119 ME_MEDIATION
= 40962,
122 ME_CONNECTID
= 40965,
123 ME_CONNECTKEY
= 40966,
124 ME_CONNECTAUTH
= 40967,
129 * enum name for notify_type_t.
131 extern enum_name_t
*notify_type_names
;
134 * enum name for notify_type_t (shorter strings).
136 extern enum_name_t
*notify_type_short_names
;
139 * Class representing an IKEv2-Notify Payload.
141 * The Notify Payload format is described in Draft section 3.10.
143 struct notify_payload_t
{
145 * The payload_t interface.
147 payload_t payload_interface
;
150 * Gets the protocol id of this payload.
152 * @return protocol id of this payload
154 u_int8_t (*get_protocol_id
) (notify_payload_t
*this);
157 * Sets the protocol id of this payload.
159 * @param protocol_id protocol id to set
161 void (*set_protocol_id
) (notify_payload_t
*this, u_int8_t protocol_id
);
164 * Gets the notify message type of this payload.
166 * @return notify message type of this payload
168 notify_type_t (*get_notify_type
) (notify_payload_t
*this);
171 * Sets notify message type of this payload.
173 * @param type notify message type to set
175 void (*set_notify_type
) (notify_payload_t
*this, notify_type_t type
);
178 * Returns the currently set spi of this payload.
180 * This is only valid for notifys with protocol AH|ESP
184 u_int32_t (*get_spi
) (notify_payload_t
*this);
187 * Sets the spi of this payload.
189 * This is only valid for notifys with protocol AH|ESP
191 * @param spi SPI value
193 void (*set_spi
) (notify_payload_t
*this, u_int32_t spi
);
196 * Returns the currently set notification data of payload.
198 * Returned data are not copied.
200 * @return chunk_t pointing to the value
202 chunk_t (*get_notification_data
) (notify_payload_t
*this);
205 * Sets the notification data of this payload.
207 * @warning Value is getting copied.
209 * @param notification_data chunk_t pointing to the value to set
211 void (*set_notification_data
) (notify_payload_t
*this,
212 chunk_t notification_data
);
215 * Destroys an notify_payload_t object.
217 void (*destroy
) (notify_payload_t
*this);
221 * Creates an empty notify_payload_t object
223 * @return created notify_payload_t object
225 notify_payload_t
*notify_payload_create(void);
228 * Creates an notify_payload_t object of specific type for specific protocol id.
230 * @param protocol_id protocol id (IKE, AH or ESP)
231 * @param type notify type (see notify_type_t)
232 * @return notify_payload_t object
234 notify_payload_t
*notify_payload_create_from_protocol_and_type(
235 protocol_id_t protocol_id
, notify_type_t type
);
237 #endif /** NOTIFY_PAYLOAD_H_ @}*/