-
Notifications
You must be signed in to change notification settings - Fork 9
/
r3_resty.h
64 lines (48 loc) · 1.54 KB
/
r3_resty.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef LUA_RESTY_R3_RESTY_H
#define LUA_RESTY_R3_RESTY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdio.h>
#include <ctype.h>
#include "r3/include/r3.h"
#ifdef BUILDING_SO
#ifndef __APPLE__
#define LSH_EXPORT __attribute__ ((visibility ("protected")))
#else
/* OSX does not support protect-visibility */
#define LSH_EXPORT __attribute__ ((visibility ("default")))
#endif
#else
#define LSH_EXPORT
#endif
/* **************************************************************************
*
* Export Functions
*
* **************************************************************************
*/
void *r3_create(int cap);
void r3_free(void * tree);
void *r3_insert(void *tree, int method, const char *path,
int path_len, void *data, char **errstr);
int r3_compile(void *tree, char** errstr);
int r3_route_set_attr(void *router, const char *host, const char *remote_addr,
int remote_addr_bits);
int r3_route_attribute_free(void *router);
void *r3_match_entry_create(const char *path, int method, const char *host,
const char *remote_addr);
void *r3_match_route(const void *tree, void *entry);
void *r3_match_route_fetch_idx(void *route);
size_t r3_match_entry_fetch_slugs(void *entry, size_t idx, char *val,
size_t *val_len);
size_t r3_match_entry_fetch_tokens(void *entry, size_t idx, char *val,
size_t *val_len);
void r3_match_entry_free(void *entry);
int is_valid_ipv4(const char *ipv4);
int is_valid_ipv6(const char *ipv6);
#ifdef __cplusplus
}
#endif
#endif