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