]> git.ipfire.org Git - thirdparty/strongswan.git/blob - Source/charon/payloads/notify_payload.h
- moved packet and socket in new network-package
[thirdparty/strongswan.git] / Source / charon / payloads / notify_payload.h
1 /**
2 * @file notify_payload.h
3 *
4 * @brief Declaration of the class notify_payload_t.
5 *
6 * An object of this type represents an IKEv2 Notify-Payload.
7 *
8 * See section 3.10 of Draft for details of this payload type.
9 *
10 */
11
12 /*
13 * Copyright (C) 2005 Jan Hutter, Martin Willi
14 * Hochschule fuer Technik Rapperswil
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
20 *
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
25 */
26
27
28 #ifndef NOTIFY_PAYLOAD_H_
29 #define NOTIFY_PAYLOAD_H_
30
31 #include <types.h>
32 #include <payloads/payload.h>
33 #include <utils/linked_list.h>
34
35 /**
36 * Critical flag must not be set
37 */
38 #define NOTIFY_PAYLOAD_CRITICAL_FLAG FALSE;
39
40 /**
41 * Notify payload length in bytes without any spi and notification data
42 */
43 #define NOTIFY_PAYLOAD_HEADER_LENGTH 8
44
45 /**
46 * Object representing an IKEv2-Notify Payload
47 *
48 * The Notify Payload format is described in Draft section 3.10.
49 *
50 */
51 typedef struct notify_payload_s notify_payload_t;
52
53 struct notify_payload_s {
54 /**
55 * implements payload_t interface
56 */
57 payload_t payload_interface;
58
59 /**
60 * @brief Gets the protocol id of this payload.
61 *
62 * @param this calling notify_payload_t object
63 * @return protocol id of this payload
64 */
65 u_int8_t (*get_protocol_id) (notify_payload_t *this);
66
67 /**
68 * @brief Sets the protocol id of this payload.
69 *
70 * @param this calling notify_payload_t object
71 * @param protocol_id protocol id to set
72 * @return SUCCESS
73 */
74 status_t (*set_protocol_id) (notify_payload_t *this, u_int8_t protocol_id);
75
76 /**
77 * @brief Gets the notify message type of this payload.
78 *
79 * @param this calling notify_payload_t object
80 * @return notify message type of this payload
81 */
82 u_int16_t (*get_notify_message_type) (notify_payload_t *this);
83
84 /**
85 * @brief Sets notify message type of this payload.
86 *
87 * @param this calling notify_payload_t object
88 * @param notify_message_type notify message type to set
89 * @return SUCCESS
90 */
91 status_t (*set_notify_message_type) (notify_payload_t *this, u_int16_t notify_message_type);
92
93 /**
94 * @brief Returns the currently set spi of this payload.
95 *
96 * @warning Returned data are not copied.
97 *
98 * @param this calling notify_payload_t object
99 * @return chunk_t pointing to the value
100 */
101 chunk_t (*get_spi) (notify_payload_t *this);
102
103 /**
104 * @brief Sets the spi of this payload.
105 *
106 * @warning Value is getting copied.
107 *
108 * @param this calling notify_payload_t object
109 * @param spi chunk_t pointing to the value to set
110 * @return
111 * - SUCCESS or
112 * - OUT_OF_RES
113 */
114 status_t (*set_spi) (notify_payload_t *this, chunk_t spi);
115
116 /**
117 * @brief Returns the currently set notification data of payload.
118 *
119 * @warning Returned data are not copied.
120 *
121 * @param this calling notify_payload_t object
122 * @return chunk_t pointing to the value
123 */
124 chunk_t (*get_notification_data) (notify_payload_t *this);
125
126 /**
127 * @brief Sets the notification data of this payload.
128 *
129 * @warning Value is getting copied.
130 *
131 * @param this calling notify_payload_t object
132 * @param notification_data chunk_t pointing to the value to set
133 * @return
134 * - SUCCESS or
135 * - OUT_OF_RES
136 */
137 status_t (*set_notification_data) (notify_payload_t *this, chunk_t notification_data);
138
139 /**
140 * @brief Destroys an notify_payload_t object.
141 *
142 * @param this notify_payload_t object to destroy
143 * @return
144 * SUCCESS in any case
145 */
146 status_t (*destroy) (notify_payload_t *this);
147 };
148
149 /**
150 * @brief Creates an empty notify_payload_t object
151 *
152 * @return
153 * - created notify_payload_t object, or
154 * - NULL if failed
155 */
156 notify_payload_t *notify_payload_create();
157
158
159 #endif /*NOTIFY_PAYLOAD_H_*/