2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
5 * Copyright (C) secunet Security Networks AG
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * @defgroup certreq_payload certreq_payload
20 * @{ @ingroup payloads
23 #ifndef CERTREQ_PAYLOAD_H_
24 #define CERTREQ_PAYLOAD_H_
26 typedef struct certreq_payload_t certreq_payload_t
;
29 #include <encoding/payloads/payload.h>
30 #include <encoding/payloads/cert_payload.h>
31 #include <utils/identification.h>
34 * Class representing an IKEv1/IKEv2 CERTREQ payload.
36 struct certreq_payload_t
{
39 * The payload_t interface.
41 payload_t payload_interface
;
44 * Create an enumerator over contained keyids (IKEv2 only).
46 * @return enumerator over chunk_t's.
48 enumerator_t
* (*create_keyid_enumerator
)(certreq_payload_t
*this);
51 * Get the type of contained certificate keyids.
53 * @return certificate keyid type
55 certificate_type_t (*get_cert_type
)(certreq_payload_t
*this);
58 * Add a certificates keyid to the payload (IKEv2 only).
60 * @param keyid keyid of the trusted certificate
63 void (*add_keyid
)(certreq_payload_t
*this, chunk_t keyid
);
66 * Get the distinguished name of the payload (IKEv1 only).
68 * @return DN as identity, must be destroyed
70 identification_t
* (*get_dn
)(certreq_payload_t
*this);
73 * Destroys an certreq_payload_t object.
75 void (*destroy
) (certreq_payload_t
*this);
79 * Creates an empty certreq_payload_t object.
81 * @return certreq payload
83 certreq_payload_t
*certreq_payload_create(payload_type_t payload_type
);
86 * Creates an empty IKEv2 certreq_payload_t for a kind of certificates.
88 * @param type type of the added keyids
89 * @return certreq payload
91 certreq_payload_t
*certreq_payload_create_type(certificate_type_t type
);
94 * Creates a IKEv1 certreq_payload_t for a given distinguished name.
96 * @param id distinguished name, does not get owned
97 * @return certreq payload
99 certreq_payload_t
*certreq_payload_create_dn(identification_t
*id
);
101 #endif /** CERTREQ_PAYLOAD_H_ @}*/