2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
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>.
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
18 * @defgroup ke_payload ke_payload
19 * @{ @ingroup payloads
25 typedef struct ke_payload_t ke_payload_t
;
28 #include <encoding/payloads/payload.h>
29 #include <encoding/payloads/transform_substructure.h>
30 #include <collections/linked_list.h>
31 #include <crypto/diffie_hellman.h>
34 * Class representing an IKEv1 or IKEv2 key exchange payload.
39 * The payload_t interface.
41 payload_t payload_interface
;
44 * Returns the key exchange data of this KE payload.
46 * @return chunk_t pointing to internal data
48 chunk_t (*get_key_exchange_data
) (ke_payload_t
*this);
51 * Gets the Diffie-Hellman Group Number of this KE payload (IKEv2 only).
53 * @return DH Group Number of this payload
55 diffie_hellman_group_t (*get_dh_group_number
) (ke_payload_t
*this);
58 * Destroys a ke_payload_t object.
60 void (*destroy
) (ke_payload_t
*this);
64 * Creates an empty ke_payload_t object.
66 * @param type PLV2_KEY_EXCHANGE or PLV1_KEY_EXCHANGE
67 * @return ke_payload_t object
69 ke_payload_t
*ke_payload_create(payload_type_t type
);
72 * Creates a ke_payload_t from a diffie_hellman_t.
74 * @param type PLV2_KEY_EXCHANGE or PLV1_KEY_EXCHANGE
75 * @param dh diffie hellman object containing group and key
76 * @return ke_payload_t object
78 ke_payload_t
*ke_payload_create_from_diffie_hellman(payload_type_t type
,
79 diffie_hellman_t
*dh
);
81 #endif /** KE_PAYLOAD_H_ @}*/