add Cisco-AVPairs to RADIUS accounting records via plugin_radius_account
[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 char const *cvs_id = "$Id: setrxspeed.c,v 1.4 2005-10-11 09:04:53 bodea Exp $";
8
9 int plugin_api_version = PLUGIN_API_VERSION;
10 static struct pluginfuncs *f = 0;
11
12 int plugin_post_auth(struct param_post_auth *data)
13 {
14 if (!data->auth_allowed)
15 return PLUGIN_RET_OK;
16
17 if (data->s->rx_connect_speed)
18 return PLUGIN_RET_OK;
19
20 switch (data->s->tx_connect_speed)
21 {
22 case 256:
23 data->s->rx_connect_speed = 64;
24 break;
25
26 case 512:
27 data->s->rx_connect_speed = 128;
28 break;
29
30 case 1500:
31 data->s->rx_connect_speed = 256;
32 break;
33 }
34
35 return PLUGIN_RET_OK;
36 }
37
38 int plugin_init(struct pluginfuncs *funcs)
39 {
40 return ((f = funcs)) ? 1 : 0;
41 }