(no commit message)
[strongswan.git] / src / charon / encoding / payloads / vendor_id_payload.h
1 /**
2 * @file vendor_id_payload.h
3 *
4 * @brief Interface of vendor_id_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 #ifndef VENDOR_ID_PAYLOAD_H_
24 #define VENDOR_ID_PAYLOAD_H_
25
26 #include <types.h>
27 #include <encoding/payloads/payload.h>
28
29 /**
30 * Length of a VENDOR ID payload without the VID data in bytes.
31 *
32 * @ingroup payloads
33 */
34 #define VENDOR_ID_PAYLOAD_HEADER_LENGTH 4
35
36
37 typedef struct vendor_id_payload_t vendor_id_payload_t;
38
39 /**
40 * @brief Class representing an IKEv2 VENDOR ID payload.
41 *
42 * The VENDOR ID payload format is described in RFC section 3.12.
43 *
44 * @b Constructors:
45 * - vendor_id_payload_create()
46 *
47 * @ingroup payloads
48 */
49 struct vendor_id_payload_t {
50 /**
51 * The payload_t interface.
52 */
53 payload_t payload_interface;
54
55 /**
56 * @brief Set the VID data.
57 *
58 * Data are getting cloned.
59 *
60 * @param this calling vendor_id_payload_t object
61 * @param data VID data as chunk_t
62 */
63 void (*set_data) (vendor_id_payload_t *this, chunk_t data);
64
65 /**
66 * @brief Get the VID data.
67 *
68 * Returned data are a copy of the internal one.
69 *
70 * @param this calling vendor_id_payload_t object
71 * @return VID data as chunk_t
72 */
73 chunk_t (*get_data_clone) (vendor_id_payload_t *this);
74
75 /**
76 * @brief Get the VID data.
77 *
78 * Returned data are NOT copied.
79 *
80 * @param this calling vendor_id_payload_t object
81 * @return VID data as chunk_t
82 */
83 chunk_t (*get_data) (vendor_id_payload_t *this);
84
85 /**
86 * @brief Destroys an vendor_id_payload_t object.
87 *
88 * @param this vendor_id_payload_t object to destroy
89 */
90 void (*destroy) (vendor_id_payload_t *this);
91 };
92
93 /**
94 * @brief Creates an empty vendor_id_payload_t object.
95 *
96 * @return vendor_id_payload_t object
97 *
98 * @ingroup payloads
99 */
100 vendor_id_payload_t *vendor_id_payload_create(void);
101
102
103 #endif /* VENDOR_ID_PAYLOAD_H_ */