4 * @brief Interface of init_config_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 #ifndef _INIT_CONFIG_H_
24 #define _INIT_CONFIG_H_
27 #include <network/host.h>
28 #include <utils/iterator.h>
29 #include <transforms/crypters/crypter.h>
30 #include <transforms/prfs/prf.h>
31 #include <transforms/signers/signer.h>
32 #include <transforms/diffie_hellman.h>
34 typedef struct ike_proposal_t ike_proposal_t
;
37 * Represents a Proposal used in IKE_SA_INIT phase.
39 struct ike_proposal_t
{
41 * Encryption algorithm.
43 encryption_algorithm_t encryption_algorithm
;
46 * Key length of encryption algorithm in bytes.
48 u_int16_t encryption_algorithm_key_length
;
51 * Integrity algorithm.
53 integrity_algorithm_t integrity_algorithm
;
56 * Key length of integrity algorithm
58 u_int16_t integrity_algorithm_key_length
;
61 * Pseudo random function (prf).
63 pseudo_random_function_t pseudo_random_function
;
68 u_int16_t pseudo_random_function_key_length
;
71 * Diffie hellman group.
73 diffie_hellman_group_t diffie_hellman_group
;
77 typedef struct init_config_t init_config_t
;
80 * Represents a configuration class holding all needed informations for IKE_SA_INIT phase.
85 struct init_config_t
{
88 * Get my host information as host_t object.
90 * @warning Object is getting cloned and has to get destroyed by caller.
92 * @param this calling object
93 * @return host information as host_t object
95 host_t
* (*get_my_host
) (init_config_t
*this);
98 * Get other host information as host_t object.
100 * @warning Object is getting cloned and has to get destroyed by caller.
102 * @param this calling object
103 * @return host information as host_t object
105 host_t
* (*get_other_host
) (init_config_t
*this);
108 * Get the diffie hellman group to use as initiator with given priority.
111 * @param this calling object
112 * @param priority priority of dh group number (starting at 1)
113 * @return diffie hellman group number for given priority or
114 * MODP_UNDEFINED for not supported priorities
116 diffie_hellman_group_t (*get_dh_group_number
) (init_config_t
*this,size_t priority
);
119 * Returns a list of all supported ike_proposals of type ike_proposal_t *.
121 * @warning array of ike_proposal_t has to get destroyed by the caller
123 * @param this calling object
124 * @param proposals first proposal in a array
125 * @return number of proposals in array
127 size_t (*get_proposals
) (init_config_t
*this,ike_proposal_t
**proposals
);
130 * Adds a proposal with given priority to the current stored proposals
132 * If allready a proposal with given priority is stored the other one is
133 * moved one priority back. If priority is higher then all other stored
134 * proposals, it is inserted as last one.
136 * @param this calling object
137 * @param priority priority of adding proposal
138 * @param proposal proposal to add
140 void (*add_proposal
) (init_config_t
*this,size_t priority
, ike_proposal_t proposal
);
143 * Select a proposed from suggested proposals.
146 * @param this calling object
147 * @param suggested_proposals first proposal in a array
148 * @param proposal_count number of suggested proposals in array
149 * @param selected_proposal the ike_proposal_t pointing to is set
151 * - SUCCESS if a proposal was selected
152 * - NOT_FOUND if none of suggested proposals is supported
154 status_t (*select_proposal
) (init_config_t
*this, ike_proposal_t
*proposals
, size_t proposal_count
, ike_proposal_t
*selected_proposal
);
157 * Destroys a init_config_t object.
159 * @param this calling object
161 void (*destroy
) (init_config_t
*this);
165 * Creates a init_config_t object.
167 * @return pointer to created init_config_t object.
171 init_config_t
* init_config_create(char * my_ip
, char *other_ip
, u_int16_t my_port
, u_int16_t other_port
);
173 #endif //_INIT_CONFIG_H_