File: setrxspeed.c

package info (click to toggle)
l2tpns 2.1.21-1.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 820 kB
  • ctags: 1,621
  • sloc: ansic: 16,737; makefile: 160; sh: 142; perl: 139
file content (41 lines) | stat: -rw-r--r-- 771 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <string.h>
#include "l2tpns.h"
#include "plugin.h"

/* fudge up session rx speed if not set */

char const *cvs_id = "$Id: setrxspeed.c,v 1.4 2005/10/11 09:04:53 bodea Exp $";

int plugin_api_version = PLUGIN_API_VERSION;
static struct pluginfuncs *f = 0;

int plugin_post_auth(struct param_post_auth *data)
{
    if (!data->auth_allowed)
    	return PLUGIN_RET_OK;

    if (data->s->rx_connect_speed)
    	return PLUGIN_RET_OK;

    switch (data->s->tx_connect_speed)
    {
    case 256:
	data->s->rx_connect_speed = 64;
	break;

    case 512:
	data->s->rx_connect_speed = 128;
	break;

    case 1500:
	data->s->rx_connect_speed = 256;
	break;
    }

    return PLUGIN_RET_OK;
}

int plugin_init(struct pluginfuncs *funcs)
{
    return ((f = funcs)) ? 1 : 0;
}