payload: Use common prefixes for all payload type identifiers
[strongswan.git] / src / libcharon / 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
17 /**
18 * @defgroup delete_payload delete_payload
19 * @{ @ingroup payloads
20 */
21
22 #ifndef DELETE_PAYLOAD_H_
23 #define DELETE_PAYLOAD_H_
24
25 typedef struct delete_payload_t delete_payload_t;
26
27 #include <library.h>
28 #include <encoding/payloads/payload.h>
29 #include <encoding/payloads/proposal_substructure.h>
30
31 /**
32 * Class representing an IKEv1 or a IKEv2 DELETE payload.
33 */
34 struct delete_payload_t {
35
36 /**
37 * The payload_t interface.
38 */
39 payload_t payload_interface;
40
41 /**
42 * Get the protocol ID.
43 *
44 * @return protocol ID
45 */
46 protocol_id_t (*get_protocol_id) (delete_payload_t *this);
47
48 /**
49 * Add an SPI to the list of deleted SAs.
50 *
51 * @param spi spi to add
52 */
53 void (*add_spi) (delete_payload_t *this, u_int32_t spi);
54
55 /**
56 * Set the IKE SPIs for an IKEv1 delete.
57 *
58 * @param spi_i initiator SPI
59 * @param spi_r responder SPI
60 */
61 void (*set_ike_spi)(delete_payload_t *this, u_int64_t spi_i, u_int64_t spi_r);
62
63 /**
64 * Get an enumerator over the SPIs in network order.
65 *
66 * @return enumerator over SPIs, u_int32_t
67 */
68 enumerator_t *(*create_spi_enumerator) (delete_payload_t *this);
69
70 /**
71 * Destroys an delete_payload_t object.
72 */
73 void (*destroy) (delete_payload_t *this);
74 };
75
76 /**
77 * Creates an empty delete_payload_t object.
78 *
79 * @param type PLV2_DELETE or PLV1_DELETE
80 * @param protocol_id protocol, such as AH|ESP
81 * @return delete_payload_t object
82 */
83 delete_payload_t *delete_payload_create(payload_type_t type,
84 protocol_id_t protocol_id);
85
86 #endif /** DELETE_PAYLOAD_H_ @}*/