- Add startup-config(5) manpage [FIXME].
[l2tpns.git] / plugin.h
1 #ifndef __PLUGIN_H__
2 #define __PLUGIN_H__
3
4 #define PLUGIN_API_VERSION 3
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_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
26 struct pluginfuncs
27 {
28 void (*log)(int level, ipt address, sessionidt s, tunnelidt t, const char *format, ...);
29 void (*log_hex)(int level, const char *title, const char *data, int maxsize);
30 char *(*inet_toa)(unsigned long addr);
31 sessionidt (*get_session_by_username)(char *username);
32 sessiont *(*get_session_by_id)(sessionidt s);
33 sessionidt (*get_id_by_session)(sessiont *s);
34 void (*sessionkill)(sessionidt s, char *reason);
35 u16 (*radiusnew)(sessionidt s);
36 void (*radiussend)(u16 r, u8 state);
37 void *(*getconfig)(char *key, enum config_typet type);
38 };
39
40 struct param_pre_auth
41 {
42 tunnelt *t;
43 sessiont *s;
44 char *username;
45 char *password;
46 int protocol;
47 int continue_auth;
48 };
49
50 struct param_post_auth
51 {
52 tunnelt *t;
53 sessiont *s;
54 char *username;
55 short auth_allowed;
56 int protocol;
57 };
58
59 struct param_packet_rx
60 {
61 tunnelt *t;
62 sessiont *s;
63 char *buf;
64 int len;
65 };
66
67 struct param_packet_tx
68 {
69 tunnelt *t;
70 sessiont *s;
71 char *buf;
72 int len;
73 };
74
75 struct param_timer
76 {
77 time_t time_now;
78 };
79
80 struct param_control
81 {
82 int argc;
83 char **argv;
84 int response;
85 char *additional;
86 };
87
88 struct param_new_session
89 {
90 tunnelt *t;
91 sessiont *s;
92 };
93
94 struct param_kill_session
95 {
96 tunnelt *t;
97 sessiont *s;
98 };
99
100 struct param_radius_response
101 {
102 tunnelt *t;
103 sessiont *s;
104 char *key;
105 char *value;
106 };
107
108 #endif /* __PLUGIN_H__ */