2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * @defgroup controller_i controller
27 typedef struct controller_t controller_t
;
30 * Constructor function for a controller.
32 * @param context session specific context, implements context_t
33 * @param param user supplied param, as registered to the dispatcher
35 typedef controller_t
*(*controller_constructor_t
)(context_t
* context
, void *param
);
38 * Controller interface, to be implemented by users controllers.
40 * Controller instances get created per session, so each session has an
41 * associated set of private controller instances.
42 * The controller handle function is called for each incoming request.
47 * Get the name of the controller.
49 * @return name of the controller
51 char* (*get_name
)(controller_t
*this);
54 * Handle a HTTP request for that controller.
56 * Request URLs are parsed in the form
57 * controller_name/p1/p2/p3/p4/p5 with a maximum of 5 parameters. Each
58 * parameter not found in the request URL is set to NULL.
60 * @param request HTTP request
61 * @param p1 first parameter
62 * @param p2 second parameter
63 * @param p3 third parameter
64 * @param p4 forth parameter
65 * @param p5 fifth parameter
68 void (*handle
)(controller_t
*this, request_t
*request
,
69 char *p1
, char *p2
, char *p3
, char *p4
, char *p5
);
72 * Destroy the controller instance.
74 void (*destroy
) (controller_t
*this);
77 #endif /** CONTROLLER_H_ @}*/