- cleaned code of generator_t class
[strongswan.git] / Source / charon / encoding / payloads / certreq_payload.h
1 /**
2 * @file certreq_payload.h
3 *
4 * @brief Interface of certreq_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 _CERTREQ_PAYLOAD_H_
24 #define _CERTREQ_PAYLOAD_H_
25
26 #include <types.h>
27 #include <encoding/payloads/payload.h>
28 #include <encoding/payloads/cert_payload.h>
29
30 /**
31 * Length of a CERTREQ payload without the CERTREQ data in bytes.
32 *
33 * @ingroup payloads
34 */
35 #define CERTREQ_PAYLOAD_HEADER_LENGTH 5
36
37
38 typedef struct certreq_payload_t certreq_payload_t;
39
40 /**
41 * Object representing an IKEv2 CERTREQ payload.
42 *
43 * The CERTREQ payload format is described in draft section 3.7.
44 *
45 * @ingroup payloads
46 *
47 */
48 struct certreq_payload_t {
49 /**
50 * The payload_t interface.
51 */
52 payload_t payload_interface;
53
54 /**
55 * @brief Set the CERT encoding.
56 *
57 *
58 * @param this calling certreq_payload_t object
59 * @param encoding CERT encoding
60 */
61 void (*set_cert_encoding) (certreq_payload_t *this, cert_encoding_t encoding);
62
63 /**
64 * @brief Get the CERT encoding.
65 *
66 * @param this calling certreq_payload_t object
67 * @return Encoding of the CERT
68 */
69 cert_encoding_t (*get_cert_encoding) (certreq_payload_t *this);
70
71 /**
72 * @brief Set the CERTREQ data.
73 *
74 * Data are getting cloned.
75 *
76 * @param this calling certreq_payload_t object
77 * @param data CERTREQ data as chunk_t
78 */
79 void (*set_data) (certreq_payload_t *this, chunk_t data);
80
81 /**
82 * @brief Get the CERTREQ data.
83 *
84 * Returned data are a copy of the internal one.
85 *
86 * @param this calling certreq_payload_t object
87 * @return CERTREQ data as chunk_t
88 */
89 chunk_t (*get_data_clone) (certreq_payload_t *this);
90
91 /**
92 * @brief Get the CERTREQ data.
93 *
94 * Returned data are NOT copied.
95 *
96 * @param this calling certreq_payload_t object
97 * @return CERTREQ data as chunk_t
98 */
99 chunk_t (*get_data) (certreq_payload_t *this);
100
101 /**
102 * @brief Destroys an certreq_payload_t object.
103 *
104 * @param this certreq_payload_t object to destroy
105 */
106 void (*destroy) (certreq_payload_t *this);
107 };
108
109 /**
110 * @brief Creates an empty certreq_payload_t object.
111 *
112 * @return created certreq_payload_t object
113 *
114 * @ingroup payloads
115 */
116 certreq_payload_t *certreq_payload_create();
117
118
119 #endif //_CERTREQ_PAYLOAD_H_