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 transform_substructure transform_substructure
19 * @{ @ingroup payloads
22 #ifndef TRANSFORM_SUBSTRUCTURE_H_
23 #define TRANSFORM_SUBSTRUCTURE_H_
25 typedef struct transform_substructure_t transform_substructure_t
;
28 #include <encoding/payloads/payload.h>
29 #include <encoding/payloads/transform_attribute.h>
30 #include <utils/linked_list.h>
31 #include <crypto/diffie_hellman.h>
32 #include <crypto/signers/signer.h>
33 #include <crypto/prfs/prf.h>
34 #include <crypto/crypters/crypter.h>
35 #include <config/proposal.h>
38 * IKEv1 Value for a transform payload.
40 #define TRANSFORM_TYPE_VALUE 3
43 * Class representing an IKEv1/IKEv2 transform substructure.
45 struct transform_substructure_t
{
48 * The payload_t interface.
50 payload_t payload_interface
;
53 * Adds a transform_attribute_t object to this object.
55 * @param proposal transform_attribute_t object to add
57 void (*add_transform_attribute
) (transform_substructure_t
*this,
58 transform_attribute_t
*attribute
);
61 * Sets the next_payload field of this substructure
63 * If this is the last transform, next payload field is set to 0,
66 * @param is_last When TRUE, next payload field is set to 0, otherwise to 3
68 void (*set_is_last_transform
) (transform_substructure_t
*this, bool is_last
);
71 * Get transform type (IKEv2) or the transform number (IKEv1).
73 * @return Transform type of current transform substructure.
75 u_int8_t (*get_transform_type_or_number
) (transform_substructure_t
*this);
78 * Get transform id of the current transform.
80 * @return Transform id of current transform substructure.
82 u_int16_t (*get_transform_id
) (transform_substructure_t
*this);
85 * Create an enumerator over transform attributes.
87 * @return enumerator over transform_attribute_t*
89 enumerator_t
* (*create_attribute_enumerator
)(transform_substructure_t
*this);
92 * Destroys an transform_substructure_t object.
94 void (*destroy
) (transform_substructure_t
*this);
98 * Creates an empty transform_substructure_t object.
100 * @param type TRANSFORM_SUBSTRUCTURE or TRANSFORM_SUBSTRUCTURE_V1
101 * @return created transform_substructure_t object
103 transform_substructure_t
*transform_substructure_create(payload_type_t type
);
106 * Creates an empty transform_substructure_t object.
108 * @param type TRANSFORM_SUBSTRUCTURE or TRANSFORM_SUBSTRUCTURE_V1
109 * @param type_or_number Type (IKEv2) or number (IKEv1) of transform
110 * @param id transform id specifc for the transform type
111 * @return transform_substructure_t object
113 transform_substructure_t
*transform_substructure_create_type(payload_type_t type
,
114 u_int8_t type_or_number
, u_int16_t id
);
116 #endif /** TRANSFORM_SUBSTRUCTURE_H_ @}*/