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
19 * @defgroup controller_i controller
29 typedef struct controller_t controller_t
;
32 * Constructor function for a controller.
34 * @param context session specific context, implements context_t
35 * @param param user supplied param, as registered to the dispatcher
37 typedef controller_t
*(*controller_constructor_t
)(context_t
* context
, void *param
);
40 * Controller interface, to be implemented by users controllers.
42 * Controller instances get created per session, so each session has an
43 * associated set of private controller instances.
44 * The controller handle function is called for each incoming request.
49 * Get the name of the controller.
51 * @return name of the controller
53 char* (*get_name
)(controller_t
*this);
56 * Handle a HTTP request for that controller.
58 * Request URLs are parsed in the form
59 * controller_name/p1/p2/p3/p4/p5 with a maximum of 5 parameters. Each
60 * parameter not found in the request URL is set to NULL.
62 * @param request HTTP request
63 * @param p1 first parameter
64 * @param p2 second parameter
65 * @param p3 third parameter
66 * @param p4 forth parameter
67 * @param p5 fifth parameter
70 void (*handle
)(controller_t
*this, request_t
*request
,
71 char *p1
, char *p2
, char *p3
, char *p4
, char *p5
);
74 * Destroy the controller instance.
76 void (*destroy
) (controller_t
*this);
79 #endif /* CONTROLLER_H_ @} */