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 TEMPORARY_FAILURE
= 43,
69 CHILD_SA_NOT_FOUND
= 44,
71 /* IKE-ME, private use */
72 ME_CONNECT_FAILED
= 8192,
74 /* notify status messages */
75 INITIAL_CONTACT
= 16384,
76 SET_WINDOW_SIZE
= 16385,
77 ADDITIONAL_TS_POSSIBLE
= 16386,
78 IPCOMP_SUPPORTED
= 16387,
79 NAT_DETECTION_SOURCE_IP
= 16388,
80 NAT_DETECTION_DESTINATION_IP
= 16389,
82 USE_TRANSPORT_MODE
= 16391,
83 HTTP_CERT_LOOKUP_SUPPORTED
= 16392,
85 ESP_TFC_PADDING_NOT_SUPPORTED
= 16394,
86 NON_FIRST_FRAGMENTS_ALSO
= 16395,
87 /* mobike extension, RFC4555 */
88 MOBIKE_SUPPORTED
= 16396,
89 ADDITIONAL_IP4_ADDRESS
= 16397,
90 ADDITIONAL_IP6_ADDRESS
= 16398,
91 NO_ADDITIONAL_ADDRESSES
= 16399,
92 UPDATE_SA_ADDRESSES
= 16400,
94 NO_NATS_ALLOWED
= 16402,
95 /* repeated authentication extension, RFC4478 */
96 AUTH_LIFETIME
= 16403,
97 /* multiple authentication exchanges, RFC 4739 */
98 MULTIPLE_AUTH_SUPPORTED
= 16404,
99 ANOTHER_AUTH_FOLLOWS
= 16405,
100 /* redirect mechanism, RFC 5685 */
101 REDIRECT_SUPPORTED
= 16406,
103 REDIRECTED_FROM
= 16408,
104 /* session resumption, RFC 5723 */
105 TICKET_LT_OPAQUE
= 16409,
106 TICKET_REQUEST
= 16410,
109 TICKET_OPAQUE
= 16413,
110 /* IPv6 configuration, RFC 5739 */
112 /* wrapped esp, RFC 5840 */
113 USE_WESP_MODE
= 16415,
114 /* robust header compression, RFC 5857 */
115 ROHC_SUPPORTED
= 16416,
116 /* RFC-ietf-ipsecme-eap-mutual, assigned by IANA */
117 EAP_ONLY_AUTHENTICATION
= 16417,
119 /* BEET mode, not even a draft yet. private use */
120 USE_BEET_MODE
= 40961,
121 /* IKE-ME, private use */
122 ME_MEDIATION
= 40962,
125 ME_CONNECTID
= 40965,
126 ME_CONNECTKEY
= 40966,
127 ME_CONNECTAUTH
= 40967,
132 * enum name for notify_type_t.
134 extern enum_name_t
*notify_type_names
;
137 * enum name for notify_type_t (shorter strings).
139 extern enum_name_t
*notify_type_short_names
;
142 * Class representing an IKEv2-Notify Payload.
144 * The Notify Payload format is described in Draft section 3.10.
146 struct notify_payload_t
{
148 * The payload_t interface.
150 payload_t payload_interface
;
153 * Gets the protocol id of this payload.
155 * @return protocol id of this payload
157 u_int8_t (*get_protocol_id
) (notify_payload_t
*this);
160 * Sets the protocol id of this payload.
162 * @param protocol_id protocol id to set
164 void (*set_protocol_id
) (notify_payload_t
*this, u_int8_t protocol_id
);
167 * Gets the notify message type of this payload.
169 * @return notify message type of this payload
171 notify_type_t (*get_notify_type
) (notify_payload_t
*this);
174 * Sets notify message type of this payload.
176 * @param type notify message type to set
178 void (*set_notify_type
) (notify_payload_t
*this, notify_type_t type
);
181 * Returns the currently set spi of this payload.
183 * This is only valid for notifys with protocol AH|ESP
187 u_int32_t (*get_spi
) (notify_payload_t
*this);
190 * Sets the spi of this payload.
192 * This is only valid for notifys with protocol AH|ESP
194 * @param spi SPI value
196 void (*set_spi
) (notify_payload_t
*this, u_int32_t spi
);
199 * Returns the currently set notification data of payload.
201 * Returned data are not copied.
203 * @return chunk_t pointing to the value
205 chunk_t (*get_notification_data
) (notify_payload_t
*this);
208 * Sets the notification data of this payload.
210 * @warning Value is getting copied.
212 * @param notification_data chunk_t pointing to the value to set
214 void (*set_notification_data
) (notify_payload_t
*this,
215 chunk_t notification_data
);
218 * Destroys an notify_payload_t object.
220 void (*destroy
) (notify_payload_t
*this);
224 * Creates an empty notify_payload_t object
226 * @return created notify_payload_t object
228 notify_payload_t
*notify_payload_create(void);
231 * Creates an notify_payload_t object of specific type for specific protocol id.
233 * @param protocol_id protocol id (IKE, AH or ESP)
234 * @param type notify type (see notify_type_t)
235 * @return notify_payload_t object
237 notify_payload_t
*notify_payload_create_from_protocol_and_type(
238 protocol_id_t protocol_id
, notify_type_t type
);
240 #endif /** NOTIFY_PAYLOAD_H_ @}*/