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