diff options
author | Martin Willi <martin@revosec.ch> | 2013-07-17 11:50:45 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-07-18 12:24:38 +0200 |
commit | 890f20989f0535bb2af761821a3682c957bfeff7 (patch) | |
tree | 14e93f38b02dafd7255eb70b715ecf319214b1ee /src/libfast/dispatcher.h | |
parent | 569d114de8cf8c35917e8c8720751c3ca32f9d47 (diff) | |
download | strongswan-890f20989f0535bb2af761821a3682c957bfeff7.tar.bz2 strongswan-890f20989f0535bb2af761821a3682c957bfeff7.tar.xz |
libfast: add a fast_ prefix to all classes, avoiding namespace clashes
Diffstat (limited to 'src/libfast/dispatcher.h')
-rw-r--r-- | src/libfast/dispatcher.h | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/src/libfast/dispatcher.h b/src/libfast/dispatcher.h deleted file mode 100644 index 16223fe76..000000000 --- a/src/libfast/dispatcher.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2007 Martin Willi - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -/** - * @defgroup libfast libfast - * @{ - * FastCGI Application Server w/ templates. - * - * Libfast is a framework to write web applications in an MVC fashion. It uses - * the ClearSilver template engine and communicates through FastCGI with - * the webserver. It is multithreaded and really fast. - * - * The application has a global context and a session context. The global - * context is accessed from all sessions simultaneously and therefore - * needs to be threadsave. Often a database wrapper is the global context. - * The session context is instanciated per session. Sessions are managed - * automatically through session cookies. The session context is kept alive - * until the session times out. It must implement the context_t interface and - * a #context_constructor_t is needed to create instances. To each session, - * a set of controllers gets instanciated. The controller instances are per - * session, so you can hold private data for each user. - * Controllers need to implement the controller_t interface and need a - * #controller_constructor_t function to create instances. - * - * A small example shows how to set up libfast: - * @code - dispatcher_t *dispatcher; - your_global_context_implementation_t *global; - - global = initialize_your_global_context(); - - dispatcher = dispatcher_create(NULL, FALSE, 180, - (context_constructor_t)your_session_context_create, global); - dispatcher->add_controller(dispatcher, your_controller1_create, param1); - dispatcher->add_controller(dispatcher, your_controller2_create, param2); - - dispatcher->run(dispatcher, 20); - - dispatcher->waitsignal(dispatcher); - - dispatcher->destroy(dispatcher); - global->destroy(); - @endcode - * @} - * - * @defgroup dispatcher dispatcher - * @{ @ingroup libfast - */ - -#ifndef DISPATCHER_H_ -#define DISPATCHER_H_ - -#include "controller.h" -#include "filter.h" - -typedef struct dispatcher_t dispatcher_t; - -/** - * Dispatcher, accepts connections using multiple threads. - * - * The dispatcher creates a session for each client (using SID cookies). In - * each session, a session context is created using the context constructor. - * Each controller is instanciated in the session using the controller - * constructor added with add_controller. - */ -struct dispatcher_t { - - /** - * Register a controller to the dispatcher. - * - * The first controller added serves as default controller. Client's - * get redirected to it if no other controller matches. - * - * @param constructor constructor function to the conntroller - * @param param param to pass to constructor - */ - void (*add_controller)(dispatcher_t *this, - controller_constructor_t constructor, void *param); - - /** - * Add a filter to the dispatcher. - * - * @param constructor constructor to create filter in session - * @param param param to pass to constructor - */ - void (*add_filter)(dispatcher_t *this, - filter_constructor_t constructor, void *param); - - /** - * Start with dispatching. - * - * Instanciate a constant thread pool and start dispatching requests. - * - * @param threads number of dispatching threads - */ - void (*run)(dispatcher_t *this, int threads); - - /** - * Wait for a relevant signal action. - * - */ - void (*waitsignal)(dispatcher_t *this); - - /** - * Destroy the dispatcher_t. - */ - void (*destroy) (dispatcher_t *this); -}; - -/** - * Create a dispatcher. - * - * The context constructor is invoked to create a session context for - * each session. - * - * @param socket FastCGI socket path, NULL for dynamic - * @param debug no stripping, no compression, timing information - * @param timeout session timeout - * @param constructor construction function for session context - * @param param parameter to supply to context constructor - */ -dispatcher_t *dispatcher_create(char *socket, bool debug, int timeout, - context_constructor_t constructor, void *param); - -#endif /** DISPATCHER_H_ @}*/ |