remove non-working setuid option
[l2tpns.git] / plugin.h
1 #ifndef __PLUGIN_H__
2 #define __PLUGIN_H__
3
4 #define PLUGIN_API_VERSION 7
5 #define MAX_PLUGIN_TYPES 30
6
7 enum
8 {
9 PLUGIN_PRE_AUTH = 1,
10 PLUGIN_POST_AUTH,
11 PLUGIN_PACKET_RX,
12 PLUGIN_PACKET_TX,
13 PLUGIN_TIMER,
14 PLUGIN_NEW_SESSION,
15 PLUGIN_KILL_SESSION,
16 PLUGIN_CONTROL,
17 PLUGIN_RADIUS_RESPONSE,
18 PLUGIN_RADIUS_RESET,
19 PLUGIN_RADIUS_ACCOUNT,
20 PLUGIN_BECOME_MASTER,
21 PLUGIN_NEW_SESSION_MASTER,
22 };
23
24 #define PLUGIN_RET_ERROR 0
25 #define PLUGIN_RET_OK 1
26 #define PLUGIN_RET_STOP 2
27 #define PLUGIN_RET_NOTMASTER 3
28
29 struct pluginfuncs
30 {
31 void (*log)(int level, sessionidt s, tunnelidt t, const char *format, ...);
32 void (*log_hex)(int level, const char *title, const uint8_t *data, int maxsize);
33 char *(*fmtaddr)(in_addr_t addr, int n);
34 sessionidt (*get_session_by_username)(char *username);
35 sessiont *(*get_session_by_id)(sessionidt s);
36 sessionidt (*get_id_by_session)(sessiont *s);
37 uint16_t (*radiusnew)(sessionidt s);
38 void (*radiussend)(uint16_t r, uint8_t state);
39 void *(*getconfig)(char *key, enum config_typet type);
40 void (*sessionshutdown)(sessionidt s, char const *reason, int result, int error, int term_cause);
41 void (*sessionkill)(sessionidt s, char *reason);
42 void (*throttle)(sessionidt s, int rate_in, int rate_out);
43 int (*session_changed)(int sid);
44 };
45
46 struct param_pre_auth
47 {
48 tunnelt *t;
49 sessiont *s;
50 char *username;
51 char *password;
52 int protocol;
53 int continue_auth;
54 };
55
56 struct param_post_auth
57 {
58 tunnelt *t;
59 sessiont *s;
60 char *username;
61 short auth_allowed;
62 int protocol;
63 };
64
65 struct param_packet_rx
66 {
67 tunnelt *t;
68 sessiont *s;
69 char *buf;
70 int len;
71 };
72
73 struct param_packet_tx
74 {
75 tunnelt *t;
76 sessiont *s;
77 char *buf;
78 int len;
79 };
80
81 struct param_timer
82 {
83 time_t time_now;
84 };
85
86 struct param_control
87 {
88 int iam_master;
89 int argc;
90 char **argv;
91 // output
92 int response;
93 char *additional;
94 };
95
96 struct param_new_session
97 {
98 tunnelt *t;
99 sessiont *s;
100 };
101
102 struct param_kill_session
103 {
104 tunnelt *t;
105 sessiont *s;
106 };
107
108 struct param_radius_response
109 {
110 tunnelt *t;
111 sessiont *s;
112 char *key;
113 char *value;
114 };
115
116 struct param_radius_reset
117 {
118 tunnelt *t;
119 sessiont *s;
120 };
121
122 struct param_radius_account
123 {
124 tunnelt *t;
125 sessiont *s;
126 uint8_t **packet;
127 };
128
129 #endif /* __PLUGIN_H__ */