2 * @file configuration.c
4 * @brief Configuration class used to store IKE_SA-configurations.
6 * Object of this type represents a configuration for an IKE_SA and its child_sa's.
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 #include "configuration_manager.h"
30 #include "utils/allocator.h"
33 * Private data of an configuration_t object
35 typedef struct private_configuration_manager_s private_configuration_manager_t
;
37 struct private_configuration_manager_s
{
42 configuration_manager_t
public;
46 static status_t
get_remote_host(private_configuration_manager_t
*this, char *name
, host_t
**host
)
48 /* some hard coded users for testing */
50 if (strcmp(name
, "pinflb30") == 0) {
51 remote
= host_create(AF_INET
, "152.96.193.130", 500);
58 else if (strcmp(name
, "pinflb31") == 0) {
59 remote
= host_create(AF_INET
, "152.96.193.131", 500);
69 static status_t
get_local_host(private_configuration_manager_t
*this, char *name
, host_t
**host
)
71 /* use default route for now */
73 local
= host_create(AF_INET
, "0.0.0.0", 0);
82 static status_t
get_proposals_for_host(private_configuration_manager_t
*this, host_t
*host
, linked_list_iterator_t
*list
)
87 static status_t
select_proposals_for_host(private_configuration_manager_t
*this, host_t
*host
, linked_list_iterator_t
*in
, linked_list_iterator_t
*out
)
94 * Implements function destroy of configuration_t.
95 * See #configuration_s.destroy for description.
97 static status_t
destroy(private_configuration_manager_t
*this)
104 * Described in header-file
106 configuration_manager_t
*configuration_manager_create()
108 private_configuration_manager_t
*this = allocator_alloc_thing(private_configuration_manager_t
);
114 /* public functions */
115 this->public.destroy
= (status_t(*)(configuration_manager_t
*))destroy
;
116 this->public.get_remote_host
= (status_t(*)(configuration_manager_t
*,char*,host_t
**))get_remote_host
;
117 this->public.get_local_host
= (status_t(*)(configuration_manager_t
*,char*,host_t
**))get_local_host
;
118 this->public.get_proposals_for_host
= (status_t(*)(configuration_manager_t
*,host_t
*,linked_list_iterator_t
*))get_proposals_for_host
;
119 this->public.select_proposals_for_host
= (status_t(*)(configuration_manager_t
*,host_t
*,linked_list_iterator_t
*,linked_list_iterator_t
*))select_proposals_for_host
;
122 return (&this->public);