-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroute.h
50 lines (41 loc) · 977 Bytes
/
route.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef ROUTE_H_
#define ROUTE_H_
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <syslog.h>
#include <errno.h>
#include <execinfo.h>
#include <pthread.h>
#include <signal.h>
#include "network.h"
#include "request.h"
#ifdef __cplusplus
extern "C" {
#endif
//extern struct lal_route *routes;
struct lal_route {
const char *path;
const size_t pathlen;
const enum lal_http_method method;
int (*const handler)(int, struct lal_request *);
struct lal_route *next;
void *extra;
};
int
lal_route_request (void *arg);
void
lal_destroy_routes (struct lal_route *routes);
struct lal_route *
lal_init_routes();
void
lal_register_route(struct lal_route *routes, enum lal_http_method method, const char *route,
int (*handler)(int, struct lal_request *), void *extra);
struct lal_route *
lal_get_route(struct lal_route *routes, struct lal_request *request);
#ifdef __cplusplus
}
#endif
#endif // ROUTE_H_