4 * @brief Interface controller_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
29 typedef struct controller_t controller_t
;
32 * @brief Controller action handle function
34 * @param request http request
35 * @param response http response
37 typedef void *(*controller_handler_t
)(controller_t
*this, request_t
*request
);
40 * @brief Constructor function for a controller
42 * @param context session specific context
43 * @param param user supplied param
45 typedef controller_t
*(*controller_constructor_t
)(context_t
* context
, void *param
);
48 * @brief Controller interface, to be implemented by users controllers.
54 * @brief Get the name of the controller.
56 * @return name of the controller
58 char* (*get_name
)(controller_t
*this);
61 * @brief Handle a HTTP request for that controller.
63 * Request URLs are parsed in the form
64 * controller_name/p1/p2/p3/p4/p5 with a maximum of 5 parameters. Each
65 * parameter not found in the request URL is set to NULL.
67 * @param request HTTP request
68 * @param p1 first parameter
69 * @param p2 second parameter
70 * @param p3 third parameter
71 * @param p4 forth parameter
72 * @param p5 fifth parameter
75 void (*handle
)(controller_t
*this, request_t
*request
,
76 char *a1
, char *a2
, char *a3
, char *a4
, char *a5
);
79 * @brief Destroy the controller instance.
81 void (*destroy
) (controller_t
*this);
84 #endif /* CONTROLLER_H_ */