9ef4fb9d9dc90c4f9b289031fd1236ccf75f5fa0
[strongswan.git] / src / charon / encoding / payloads / certreq_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 certreq_payload certreq_payload
21 * @{ @ingroup payloads
22 */
23
24 #ifndef CERTREQ_PAYLOAD_H_
25 #define CERTREQ_PAYLOAD_H_
26
27 typedef struct certreq_payload_t certreq_payload_t;
28
29 #include <library.h>
30 #include <encoding/payloads/payload.h>
31 #include <encoding/payloads/cert_payload.h>
32
33 /**
34 * Length of a CERTREQ payload without the CERTREQ data in bytes.
35 */
36 #define CERTREQ_PAYLOAD_HEADER_LENGTH 5
37
38 /**
39 * Class representing an IKEv2 CERTREQ payload.
40 *
41 * The CERTREQ payload format is described in RFC section 3.7.
42 */
43 struct certreq_payload_t {
44 /**
45 * The payload_t interface.
46 */
47 payload_t payload_interface;
48
49 /**
50 * Create an enumerator over contained keyids.
51 *
52 * @return enumerator over chunk_t's.
53 */
54 enumerator_t* (*create_keyid_enumerator)(certreq_payload_t *this);
55
56 /**
57 * Get the type of contained certificate keyids.
58 *
59 * @return certificate keyid type
60 */
61 certificate_type_t (*get_cert_type)(certreq_payload_t *this);
62
63 /**
64 * Add a certificates keyid to the payload.
65 *
66 * @param keyid keyid of the trusted certifcate
67 * @return
68 */
69 void (*add_keyid)(certreq_payload_t *this, chunk_t keyid);
70
71 /**
72 * Destroys an certreq_payload_t object.
73 */
74 void (*destroy) (certreq_payload_t *this);
75 };
76
77 /**
78 * Creates an empty certreq_payload_t object.
79 *
80 * @return certreq payload
81 */
82 certreq_payload_t *certreq_payload_create(void);
83
84 /**
85 * Creates an empty certreq_payload_t for a kind of certificates.
86 *
87 * @param type type of the added keyids
88 * @return certreq payload
89 */
90 certreq_payload_t *certreq_payload_create_type(certificate_type_t type);
91
92 #endif /* CERTREQ_PAYLOAD_H_ @} */