4 * @brief Implementation of dispatcher_t.
9 * Copyright (C) 2007 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 #include <dispatcher.h>
28 #include "controller/auth_controller.h"
29 #include "controller/ikesa_controller.h"
30 #include "controller/gateway_controller.h"
31 #include "controller/control_controller.h"
32 #include "controller/config_controller.h"
34 #define DBFILE IPSECDIR "/manager.db"
35 #define SESSION_TIMEOUT 900
38 int main (int arc
, char *argv
[])
40 dispatcher_t
*dispatcher
;
46 #endif /* FCGI_SOCKET */
48 database
= database_create(DBFILE
);
51 fprintf(stderr
, "opening database '%s' failed.\n", DBFILE
);
55 dispatcher
= dispatcher_create(socket
, SESSION_TIMEOUT
,
56 (context_constructor_t
)manager_create
, database
);
57 dispatcher
->add_controller(dispatcher
, ikesa_controller_create
, NULL
);
58 dispatcher
->add_controller(dispatcher
, gateway_controller_create
, NULL
);
59 dispatcher
->add_controller(dispatcher
, auth_controller_create
, NULL
);
60 dispatcher
->add_controller(dispatcher
, control_controller_create
, NULL
);
61 dispatcher
->add_controller(dispatcher
, config_controller_create
, NULL
);
63 dispatcher
->run(dispatcher
, THREADS
, NULL
, NULL
, NULL
, NULL
);
65 dispatcher
->waitsignal(dispatcher
);
67 dispatcher
->destroy(dispatcher
);
68 database
->destroy(database
);