forked from coova/coova-chilli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchilli_module.h
91 lines (73 loc) · 2.64 KB
/
chilli_module.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* -*- mode: c; c-basic-offset: 2 -*- */
/*
* Copyright (C) 2007-2012 David Bird (Coova Technologies) <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _CHILLI_MODULE_H
#define _CHILLI_MODULE_H
struct chilli_module {
void *lib;
/*
* Modules shall return an integer code.
* We shall use the lower 8 bits as a main code,
* the rest of the integer available for handler
* specific flags.
*/
# define CHILLI_MOD_OK 0
# define CHILLI_MOD_ERROR -1
# define CHILLI_MOD_CONTINUE 1
# define CHILLI_MOD_BREAK 2
int (* initialize) (char *, char isReload);
int (* net_select) (select_ctx *sctx);
# define CHILLI_MOD_REDIR_SKIP_RADIUS (1 << 8)
int (* redir_login) (struct redir_t *,
struct redir_conn_t *,
struct redir_socket_t *);
int (* dhcp_connect) (struct app_conn_t *,
struct dhcp_conn_t *);
int (* dhcp_disconnect) (struct app_conn_t *,
struct dhcp_conn_t *);
int (* session_start) (struct app_conn_t *);
int (* session_update) (struct app_conn_t *);
int (* session_stop) (struct app_conn_t *);
#define CHILLI_CMDSOCK_ERR -1
#define CHILLI_CMDSOCK_OK 0
int (* cmdsock_handler)
(struct cmdsock_request *req, bstring s, int sock);
/* lower level handers */
#define CHILLI_DNS_ERR -1
#define CHILLI_DNS_DROP 0
#define CHILLI_DNS_OK 1
#define CHILLI_DNS_MOD 2
#define CHILLI_DNS_NAK 3
int (* dns_handler)
(struct app_conn_t *, struct dhcp_conn_t *, uint8_t *, size_t *, int);
#define CHILLI_RADIUS_ERR -1
#define CHILLI_RADIUS_OK 0
int (* radius_handler)
(struct radius_t *radius, struct app_conn_t *conn,
struct radius_packet_t *req, struct radius_packet_t *resp);
/* lower level handers */
size_t (* dhcp_handler)
(int, struct app_conn_t *, struct dhcp_conn_t *,
uint8_t *, size_t, uint8_t *, size_t);
int (* destroy) (char isReload);
};
#define chilli_mod_state(x) ((x)&0xff)
int chilli_module_load(void **ctx, char *name);
int chilli_module_unload(void *ctx);
#define CHILLI_MODULE_INIT 0
#endif