52fcf4a1670398e16c23668fa33d2c59576fc76d
[l2tpns.git] / setrxspeed.c
1 #include <string.h>
2 #include "l2tpns.h"
3 #include "plugin.h"
4
5 /* fudge up session rx speed if not set */
6
7 int plugin_api_version = PLUGIN_API_VERSION;
8 static struct pluginfuncs *f = 0;
9
10 int plugin_post_auth(struct param_post_auth *data)
11 {
12 if (!data->auth_allowed)
13 return PLUGIN_RET_OK;
14
15 if (data->s->rx_connect_speed)
16 return PLUGIN_RET_OK;
17
18 switch (data->s->tx_connect_speed)
19 {
20 case 256:
21 data->s->rx_connect_speed = 64;
22 break;
23
24 case 512:
25 data->s->rx_connect_speed = 128;
26 break;
27
28 case 1500:
29 data->s->rx_connect_speed = 256;
30 break;
31 }
32
33 return PLUGIN_RET_OK;
34 }
35
36 int plugin_init(struct pluginfuncs *funcs)
37 {
38 return ((f = funcs)) ? 1 : 0;
39 }