support of certreq payload in IKE_AUTH messages
[strongswan.git] / src / 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-2006 Martin Willi
10 * Copyright (C) 2005 Jan Hutter
11 * Hochschule fuer Technik Rapperswil
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 */
23
24 #ifndef CERTREQ_PAYLOAD_H_
25 #define CERTREQ_PAYLOAD_H_
26
27 #include <types.h>
28 #include <encoding/payloads/payload.h>
29 #include <encoding/payloads/cert_payload.h>
30
31 /**
32 * Length of a CERTREQ payload without the CERTREQ data in bytes.
33 *
34 * @ingroup payloads
35 */
36 #define CERTREQ_PAYLOAD_HEADER_LENGTH 5
37
38
39 typedef struct certreq_payload_t certreq_payload_t;
40
41 /**
42 * @brief Class representing an IKEv2 CERTREQ payload.
43 *
44 * The CERTREQ payload format is described in RFC section 3.7.
45 * This is just a dummy implementation to fullfill the standards
46 * requirements. A full implementation would offer setters/getters
47 * for the different encoding types.
48 *
49 * @b Constructors:
50 * - certreq_payload_create()
51 *
52 * @todo Implement payload functionality.
53 *
54 * @ingroup payloads
55 */
56 struct certreq_payload_t {
57 /**
58 * The payload_t interface.
59 */
60 payload_t payload_interface;
61
62 /**
63 * @brief Set the CERT encoding.
64 *
65 * @param this calling certreq_payload_t object
66 * @param encoding CERT encoding
67 */
68 void (*set_cert_encoding) (certreq_payload_t *this, cert_encoding_t encoding);
69
70 /**
71 * @brief Get the CERT encoding.
72 *
73 * @param this calling certreq_payload_t object
74 * @return Encoding of the CERT
75 */
76 cert_encoding_t (*get_cert_encoding) (certreq_payload_t *this);
77
78 /**
79 * @brief Set the CERTREQ data.
80 *
81 * Data are getting cloned.
82 *
83 * @param this calling certreq_payload_t object
84 * @param data CERTREQ data as chunk_t
85 */
86 void (*set_data) (certreq_payload_t *this, chunk_t data);
87
88 /**
89 * @brief Get the CERTREQ data.
90 *
91 * Returned data are a copy of the internal one.
92 *
93 * @param this calling certreq_payload_t object
94 * @return CERTREQ data as chunk_t
95 */
96 chunk_t (*get_data_clone) (certreq_payload_t *this);
97
98 /**
99 * @brief Get the CERTREQ data.
100 *
101 * Returned data are NOT copied.
102 *
103 * @param this calling certreq_payload_t object
104 * @return CERTREQ data as chunk_t
105 */
106 chunk_t (*get_data) (certreq_payload_t *this);
107
108 /**
109 * @brief Destroys an certreq_payload_t object.
110 *
111 * @param this certreq_payload_t object to destroy
112 */
113 void (*destroy) (certreq_payload_t *this);
114 };
115
116 /**
117 * @brief Creates an empty certreq_payload_t object.
118 *
119 * @return certreq_payload_t object
120 *
121 * @ingroup payloads
122 */
123 certreq_payload_t *certreq_payload_create(void);
124
125 /**
126 * @brief Creates a certreq_payload_t object from a ca certificate
127 *
128 * @param id subject distinguished name of CA certificate
129 * @return certreq_payload_t object
130 *
131 * @ingroup payloads
132 */
133 certreq_payload_t *certreq_payload_create_from_cacert(identification_t *id);
134
135 /**
136 * @brief Creates a certreq_payload_t object from all ca certificates
137 *
138 * @return certreq_payload_t object
139 *
140 * @ingroup payloads
141 */
142 certreq_payload_t *certreq_payload_create_from_cacerts(void);
143
144 #endif /* CERTREQ_PAYLOAD_H_ */