00975e93a10c93cf85f4c62bcc1e707fb388743f
2 * Copyright (C) 2008 Martin Willi
3 * Copyright (C) 2008 Philip Boetschi, Adrian Doerig
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
21 #include <dispatcher.h>
23 #include <database/database.h>
25 #include "filter/auth_filter.h"
26 #include "controller/user_controller.h"
27 #include "controller/peer_controller.h"
29 int main(int arc
, char *argv
[])
31 dispatcher_t
*dispatcher
;
38 library_init(STRONGSWAN_CONF
);
39 lib
->plugins
->load(lib
->plugins
, IPSEC_PLUGINDIR
,
40 lib
->settings
->get_str(lib
->settings
, "medsrv.load", PLUGINS
));
42 socket
= lib
->settings
->get_str(lib
->settings
, "medsrv.socket", NULL
);
43 debug
= lib
->settings
->get_bool(lib
->settings
, "medsrv.debug", FALSE
);
44 timeout
= lib
->settings
->get_int(lib
->settings
, "medsrv.timeout", 900);
45 threads
= lib
->settings
->get_int(lib
->settings
, "medsrv.threads", 5);
46 uri
= lib
->settings
->get_str(lib
->settings
, "medsrv.database", NULL
);
49 fprintf(stderr
, "database URI medsrv.database not defined.\n");
53 db
= lib
->db
->create(lib
->db
, uri
);
56 fprintf(stderr
, "opening database failed.\n");
60 dispatcher
= dispatcher_create(socket
, debug
, timeout
,
61 (context_constructor_t
)user_create
, db
);
62 dispatcher
->add_filter(dispatcher
,
63 (filter_constructor_t
)auth_filter_create
, db
);
64 dispatcher
->add_controller(dispatcher
,
65 (controller_constructor_t
)user_controller_create
, db
);
66 dispatcher
->add_controller(dispatcher
,
67 (controller_constructor_t
)peer_controller_create
, db
);
69 dispatcher
->run(dispatcher
, threads
);
71 dispatcher
->waitsignal(dispatcher
);
72 dispatcher
->destroy(dispatcher
);