19dd14ef01d6e7c669d65e8d7cb2281232f2a322
[strongswan.git] / Source / charon / encoding / payloads / notify_payload.h
1 /**
2 * @file notify_payload.h
3 *
4 * @brief Interface of notify_payload_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
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>.
16 *
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
20 * for more details.
21 */
22
23
24 #ifndef NOTIFY_PAYLOAD_H_
25 #define NOTIFY_PAYLOAD_H_
26
27 #include <types.h>
28 #include <encoding/payloads/payload.h>
29 #include <utils/linked_list.h>
30
31 /**
32 * Critical flag must not be set.
33 *
34 * @ingroup payloads
35 */
36 #define NOTIFY_PAYLOAD_CRITICAL_FLAG FALSE;
37
38 /**
39 * Notify payload length in bytes without any spi and notification data.
40 *
41 * @ingroup payloads
42 */
43 #define NOTIFY_PAYLOAD_HEADER_LENGTH 8
44
45 typedef struct notify_payload_t notify_payload_t;
46
47 /**
48 * Object representing an IKEv2-Notify Payload.
49 *
50 * The Notify Payload format is described in Draft section 3.10.
51 *
52 *
53 * @ingroup payloads
54 */
55 struct notify_payload_t {
56 /**
57 * The payload_t interface.
58 */
59 payload_t payload_interface;
60
61 /**
62 * @brief Gets the protocol id of this payload.
63 *
64 * @param this calling notify_payload_t object
65 * @return protocol id of this payload
66 */
67 u_int8_t (*get_protocol_id) (notify_payload_t *this);
68
69 /**
70 * @brief Sets the protocol id of this payload.
71 *
72 * @param this calling notify_payload_t object
73 * @param protocol_id protocol id to set
74 */
75 void (*set_protocol_id) (notify_payload_t *this, u_int8_t protocol_id);
76
77 /**
78 * @brief Gets the notify message type of this payload.
79 *
80 * @param this calling notify_payload_t object
81 * @return notify message type of this payload
82 */
83 u_int16_t (*get_notify_message_type) (notify_payload_t *this);
84
85 /**
86 * @brief Sets notify message type of this payload.
87 *
88 * @param this calling notify_payload_t object
89 * @param notify_message_type notify message type to set
90 */
91 void (*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 */
111 void (*set_spi) (notify_payload_t *this, chunk_t spi);
112
113 /**
114 * @brief Returns the currently set notification data of payload.
115 *
116 * @warning Returned data are not copied.
117 *
118 * @param this calling notify_payload_t object
119 * @return chunk_t pointing to the value
120 */
121 chunk_t (*get_notification_data) (notify_payload_t *this);
122
123 /**
124 * @brief Sets the notification data of this payload.
125 *
126 * @warning Value is getting copied.
127 *
128 * @param this calling notify_payload_t object
129 * @param notification_data chunk_t pointing to the value to set
130 */
131 void (*set_notification_data) (notify_payload_t *this, chunk_t notification_data);
132
133 /**
134 * @brief Destroys an notify_payload_t object.
135 *
136 * @param this notify_payload_t object to destroy
137 */
138 void (*destroy) (notify_payload_t *this);
139 };
140
141 /**
142 * @brief Creates an empty notify_payload_t object
143 *
144 * @return created notify_payload_t object
145 *
146 * @ingroup payloads
147 */
148 notify_payload_t *notify_payload_create();
149
150
151 #endif /*NOTIFY_PAYLOAD_H_*/