taskrambler  0.1.8
Web server and task management solution.
router.h
Go to the documentation of this file.
1 /**
2  * \file
3  * A generic REST router that is able to map a URL to a specific
4  * function. It uses dlsym to get the address of the function to
5  * be called.
6  * The functions need to have a common interface for sure....This will
7  * work out while I am working on this.
8  * After a function is found it's address will be stored in a hash
9  * so that further lookups might be faster.
10  * By it's nature I think this is part of the HttpApplicationAdapter.
11  *
12  * \author Georg Hopp
13  *
14  * \copyright
15  * Copyright © 2013 Georg Hopp
16  *
17  * This program is free software: you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation, either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program. If not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #ifndef __ROUTER_H__
32 #define __ROUTER_H__
33 
34 #include <dlfcn.h>
35 
36 #include "class.h"
37 #include "hash.h"
38 #include "session.h"
39 #include "http/request.h"
40 #include "http/response.h"
42 
43 typedef char * (* fptr_routable)(Application, Session, Hash);
44 
45 CLASS(Router) {
46  Hash functions;
47  Application application;
48 
49  void * handle;
50  char * prefix;
51  size_t nprefix;
52 
53 };
54 
55 HttpResponse routerRoute(Router, HttpRequest, Session);
56 
57 #endif // __ROUTER_H__
58 
59 // vim: set ts=4 sw=4:
CLASS(Router)
Definition: router.h:45
HttpResponse routerRoute(Router, HttpRequest, Session)
Definition: route.c:53