Migrated vendor_id_payload to INIT/METHOD macros
[strongswan.git] / src / libcharon / encoding / payloads / vendor_id_payload.h
1 /*
2 * Copyright (C) 2005-2009 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 vendor_id_payload vendor_id_payload
19 * @{ @ingroup payloads
20 */
21
22 #ifndef VENDOR_ID_PAYLOAD_H_
23 #define VENDOR_ID_PAYLOAD_H_
24
25 typedef struct vendor_id_payload_t vendor_id_payload_t;
26
27 #include <library.h>
28 #include <encoding/payloads/payload.h>
29
30 /**
31 * Length of a VENDOR ID payload without the VID data in bytes.
32 */
33 #define VENDOR_ID_PAYLOAD_HEADER_LENGTH 4
34
35 /**
36 * Class representing an IKEv2 VENDOR ID payload.
37 *
38 * The VENDOR ID payload format is described in RFC section 3.12.
39 */
40 struct vendor_id_payload_t {
41
42 /**
43 * The payload_t interface.
44 */
45 payload_t payload_interface;
46
47 /**
48 * Get the VID data.
49 *
50 * @return VID data, pointing to an internal chunk_t
51 */
52 chunk_t (*get_data)(vendor_id_payload_t *this);
53
54 /**
55 * Destroy Vendor ID payload.
56 */
57 void (*destroy)(vendor_id_payload_t *this);
58 };
59
60 /**
61 * Creates an empty Vendor ID payload.
62 *
63 * @return vendor ID payload
64 */
65 vendor_id_payload_t *vendor_id_payload_create();
66
67 /**
68 * Creates a vendor ID payload using a chunk of data
69 *
70 * @param data data to use in vendor ID payload, gets owned by payload
71 * @return vendor ID payload
72 */
73 vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data);
74
75 #endif /** VENDOR_ID_PAYLOAD_H_ @}*/