2 * @file notify_payload.h
4 * @brief Interface of notify_payload_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 #ifndef NOTIFY_PAYLOAD_H_
25 #define NOTIFY_PAYLOAD_H_
28 #include <encoding/payloads/payload.h>
29 #include <encoding/payloads/proposal_substructure.h>
30 #include <utils/linked_list.h>
33 * Notify payload length in bytes without any spi and notification data.
37 #define NOTIFY_PAYLOAD_HEADER_LENGTH 8
39 typedef enum notify_message_type_t notify_message_type_t
;
43 * @brief Notify message types.
45 * See IKEv2 RFC 3.10.1.
49 enum notify_message_type_t
{
50 UNSUPPORTED_CRITICAL_PAYLOAD
= 1,
52 INVALID_MAJOR_VERSION
= 5,
54 INVALID_MESSAGE_ID
= 9,
56 NO_PROPOSAL_CHOSEN
= 14,
57 INVALID_KE_PAYLOAD
= 17,
58 AUTHENTICATION_FAILED
= 24,
59 SINGLE_PAIR_REQUIRED
= 34,
60 NO_ADDITIONAL_SAS
= 35,
61 INTERNAL_ADDRESS_FAILURE
= 36,
62 FAILED_CP_REQUIRED
= 37,
64 INVALID_SELECTORS
= 39,
66 INITIAL_CONTACT
= 16384,
67 SET_WINDOW_SIZE
= 16385
71 * String mappings for notify_message_type_t.
75 extern mapping_t notify_message_type_m
[];
78 typedef struct notify_payload_t notify_payload_t
;
81 * @brief Class representing an IKEv2-Notify Payload.
83 * The Notify Payload format is described in Draft section 3.10.
86 * - notify_payload_create()
87 * - notify_payload_create_from_protocol_and_type()
89 * @todo Build specified constructor/getter for notify's
93 struct notify_payload_t
{
95 * The payload_t interface.
97 payload_t payload_interface
;
100 * @brief Gets the protocol id of this payload.
102 * @param this calling notify_payload_t object
103 * @return protocol id of this payload
105 u_int8_t (*get_protocol_id
) (notify_payload_t
*this);
108 * @brief Sets the protocol id of this payload.
110 * @param this calling notify_payload_t object
111 * @param protocol_id protocol id to set
113 void (*set_protocol_id
) (notify_payload_t
*this, u_int8_t protocol_id
);
116 * @brief Gets the notify message type of this payload.
118 * @param this calling notify_payload_t object
119 * @return notify message type of this payload
121 u_int16_t (*get_notify_message_type
) (notify_payload_t
*this);
124 * @brief Sets notify message type of this payload.
126 * @param this calling notify_payload_t object
127 * @param notify_message_type notify message type to set
129 void (*set_notify_message_type
) (notify_payload_t
*this, u_int16_t notify_message_type
);
132 * @brief Returns the currently set spi of this payload.
134 * @warning Returned data are not copied.
136 * @param this calling notify_payload_t object
137 * @return chunk_t pointing to the value
139 chunk_t (*get_spi
) (notify_payload_t
*this);
142 * @brief Sets the spi of this payload.
144 * @warning Value is getting copied.
146 * @param this calling notify_payload_t object
147 * @param spi chunk_t pointing to the value to set
149 void (*set_spi
) (notify_payload_t
*this, chunk_t spi
);
152 * @brief Returns the currently set notification data of payload.
154 * @warning Returned data are not copied.
156 * @param this calling notify_payload_t object
157 * @return chunk_t pointing to the value
159 chunk_t (*get_notification_data
) (notify_payload_t
*this);
162 * @brief Sets the notification data of this payload.
164 * @warning Value is getting copied.
166 * @param this calling notify_payload_t object
167 * @param notification_data chunk_t pointing to the value to set
169 void (*set_notification_data
) (notify_payload_t
*this, chunk_t notification_data
);
172 * @brief Destroys an notify_payload_t object.
174 * @param this notify_payload_t object to destroy
176 void (*destroy
) (notify_payload_t
*this);
180 * @brief Creates an empty notify_payload_t object
182 * @return created notify_payload_t object
186 notify_payload_t
*notify_payload_create();
189 * @brief Creates an notify_payload_t object of specific type for specific protocol id.
191 * @param protocol_id protocol id (IKE, AH or ESP)
192 * @param notify_message_type notify type (see notify_message_type_t)
193 * @return notify_payload_t object
197 notify_payload_t
*notify_payload_create_from_protocol_and_type(protocol_id_t protocol_id
, notify_message_type_t notify_message_type
);
200 #endif /*NOTIFY_PAYLOAD_H_*/