150a8747052940b901e1a942c37d15fc3d640a62
[strongswan.git] / src / charon / encoding / payloads / delete_payload.h
1 /*
2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * $Id$
17 */
18
19 /**
20 * @defgroup delete_payload delete_payload
21 * @{ @ingroup payloads
22 */
23
24 #ifndef DELETE_PAYLOAD_H_
25 #define DELETE_PAYLOAD_H_
26
27 typedef struct delete_payload_t delete_payload_t;
28
29 #include <library.h>
30 #include <encoding/payloads/payload.h>
31 #include <encoding/payloads/proposal_substructure.h>
32
33 /**
34 * Length of a delete payload without the SPI in bytes.
35 */
36 #define DELETE_PAYLOAD_HEADER_LENGTH 8
37
38 /**
39 * Class representing an IKEv2 DELETE payload.
40 *
41 * The DELETE payload format is described in RFC section 3.11.
42 */
43 struct delete_payload_t {
44 /**
45 * The payload_t interface.
46 */
47 payload_t payload_interface;
48
49 /**
50 * Get the protocol ID.
51 *
52 * @return protocol ID
53 */
54 protocol_id_t (*get_protocol_id) (delete_payload_t *this);
55
56 /**
57 * Add an SPI to the list of deleted SAs.
58 *
59 * @param spi spi to add
60 */
61 void (*add_spi) (delete_payload_t *this, u_int32_t spi);
62
63 /**
64 * Get an iterator over the SPIs.
65 *
66 * The iterate() function returns a pointer to a u_int32_t SPI.
67 *
68 * @return iterator over SPIs
69 */
70 iterator_t *(*create_spi_iterator) (delete_payload_t *this);
71
72 /**
73 * Destroys an delete_payload_t object.
74 */
75 void (*destroy) (delete_payload_t *this);
76 };
77
78 /**
79 * Creates an empty delete_payload_t object.
80 *
81 * @param protocol_id protocol, such as AH|ESP
82 * @return delete_payload_t object
83 */
84 delete_payload_t *delete_payload_create(protocol_id_t protocol_id);
85
86 #endif /* DELETE_PAYLOAD_H_ @} */