NEWS: Add news for 5.9.5
[strongswan.git] / src / libcharon / encoding / payloads / delete_payload.h
1 /*
2 * Copyright (C) 2015 Tobias Brunner
3 * Copyright (C) 2005-2006 Martin Willi
4 * Copyright (C) 2005 Jan Hutter
5 * HSR Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 /**
19 * @defgroup delete_payload delete_payload
20 * @{ @ingroup payloads
21 */
22
23 #ifndef DELETE_PAYLOAD_H_
24 #define DELETE_PAYLOAD_H_
25
26 typedef struct delete_payload_t delete_payload_t;
27
28 #include <library.h>
29 #include <encoding/payloads/payload.h>
30 #include <encoding/payloads/proposal_substructure.h>
31
32 /**
33 * Class representing an IKEv1 or a IKEv2 DELETE payload.
34 */
35 struct delete_payload_t {
36
37 /**
38 * The payload_t interface.
39 */
40 payload_t payload_interface;
41
42 /**
43 * Get the protocol ID.
44 *
45 * @return protocol ID
46 */
47 protocol_id_t (*get_protocol_id) (delete_payload_t *this);
48
49 /**
50 * Add an SPI to the list of deleted SAs.
51 *
52 * @param spi spi to add
53 */
54 void (*add_spi) (delete_payload_t *this, uint32_t spi);
55
56 /**
57 * Set the IKE SPIs for an IKEv1 delete.
58 *
59 * @param spi_i initiator SPI
60 * @param spi_r responder SPI
61 */
62 void (*set_ike_spi)(delete_payload_t *this, uint64_t spi_i, uint64_t spi_r);
63
64 /**
65 * Get the IKE SPIs from an IKEv1 delete.
66 *
67 * @param spi_i initiator SPI
68 * @param spi_r responder SPI
69 * @return TRUE if SPIs extracted successfully
70 */
71 bool (*get_ike_spi)(delete_payload_t *this, uint64_t *spi_i, uint64_t *spi_r);
72
73 /**
74 * Get an enumerator over the SPIs in network order.
75 *
76 * @return enumerator over SPIs, uint32_t
77 */
78 enumerator_t *(*create_spi_enumerator) (delete_payload_t *this);
79
80 /**
81 * Destroys an delete_payload_t object.
82 */
83 void (*destroy) (delete_payload_t *this);
84 };
85
86 /**
87 * Creates an empty delete_payload_t object.
88 *
89 * @param type PLV2_DELETE or PLV1_DELETE
90 * @param protocol_id protocol, such as AH|ESP
91 * @return delete_payload_t object
92 */
93 delete_payload_t *delete_payload_create(payload_type_t type,
94 protocol_id_t protocol_id);
95
96 #endif /** DELETE_PAYLOAD_H_ @}*/