File: file.h

package info (click to toggle)
l2tpd 0.67-1.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 636 kB
  • ctags: 621
  • sloc: ansic: 7,940; makefile: 70; sh: 22
file content (150 lines) | stat: -rw-r--r-- 5,957 bytes parent folder | download
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
 * Layer Two Tunnelling Protocol Daemon
 * Copyright (C) 1998 Adtran, Inc.
 *
 * Mark Spencer
 *
 * This software is distributed under the terms
 * of the GPL, which you should have received
 * along with this source.
 *
 * File format handling header file
 *
 */

#ifndef _FILE_H
#define _FILE_H

#define STRLEN 80               /* Length of a string */

/* Definition of a keyword */
struct keyword
{
    char *keyword;
    int (*handler) (char *word, char *value, int context, void *item);
};

struct iprange
{
    unsigned int start;
    unsigned int end;
    int sense;
    struct iprange *next;
};

struct host
{
    char hostname[STRLEN];
    int port;
    struct host *next;
};


#define CONTEXT_GLOBAL 	1
#define CONTEXT_LNS	   	2
#define CONTEXT_LAC		3
#define CONTEXT_DEFAULT	256

#define SENSE_ALLOW -1
#define SENSE_DENY 0

#define DEFAULT_AUTH_FILE "/etc/l2tp/l2tp-secrets"
#define ALT_DEFAULT_AUTH_FILE "/etc/l2tpd/l2tp-secrets"
#define DEFAULT_CONFIG_FILE "/etc/l2tp/l2tpd.conf"
#define ALT_DEFAULT_CONFIG_FILE "/etc/l2tpd/l2tpd.conf"
#define DEFAULT_PID_FILE "/var/run/l2tpd.pid"

/* Definition of an LNS */
struct lns
{
    struct lns *next;
    int exclusive;              /* Only one tunnel per host? */
    int active;                 /* Is this actively in use? */
    unsigned int localaddr;     /* Local IP for PPP connections */
    int tun_rws;                /* Receive window size (tunnel) */
    int call_rws;               /* Call rws */
    int hbit;                   /* Permit hidden AVP's? */
    int lbit;                   /* Use the length field? */
    int challenge;              /* Challenge authenticate the peer? */
    int authpeer;               /* Authenticate our peer? */
    int authself;               /* Authenticate ourselves? */
    char authname[STRLEN];      /* Who we authenticate as */
    char peername[STRLEN];      /* Force peer name to this */
    char hostname[STRLEN];      /* Hostname to report */
    char entname[STRLEN];       /* Name of this entry */
    struct iprange *lacs;       /* Hosts permitted to connect */
    struct iprange *range;      /* Range of IP's we provide */
    int passwdauth;             /* Authenticate by passwd file? (or PAM) */
    int pap_require;            /* Require PAP auth for PPP */
    int chap_require;           /* Require CHAP auth for PPP */
    int pap_refuse;             /* Refuse PAP authentication for us */
    int chap_refuse;            /* Refuse CHAP authentication for us */
    int idle;                   /* Idle timeout in seconds */
    unsigned int pridns;        /* Primary DNS server */
    unsigned int secdns;        /* Secondary DNS server */
    unsigned int priwins;       /* Primary WINS server */
    unsigned int secwins;       /* Secondary WINS server */
    int proxyarp;               /* Use proxy-arp? */
    int proxyauth;              /* Allow proxy authentication? */
    int debug;                  /* Debug PPP? */
    char pppoptfile[STRLEN];    /* File containing PPP options */
    struct tunnel *t;           /* Tunnel of this, if it's ready */
};

struct lac
{
    struct lac *next;
    struct host *lns;           /* LNS's we can connect to */
    struct schedule_entry *rsched;
    int tun_rws;                /* Receive window size (tunnel) */
    int call_rws;               /* Call rws */
    int active;                 /* Is this connection in active use? */
    int hbit;                   /* Permit hidden AVP's? */
    int lbit;                   /* Use the length field? */
    int challenge;              /* Challenge authenticate the peer? */
    unsigned int localaddr;     /* Local IP address */
    unsigned int remoteaddr;    /* Force remote address to this */
    char authname[STRLEN];      /* Who we authenticate as */
    char peername[STRLEN];      /* Force peer name to this */
    char hostname[STRLEN];      /* Hostname to report */
    char entname[STRLEN];       /* Name of this entry */
    int authpeer;               /* Authenticate our peer? */
    int authself;               /* Authenticate ourselves? */
    int pap_require;            /* Require PAP auth for PPP */
    int chap_require;           /* Require CHAP auth for PPP */
    int pap_refuse;             /* Refuse PAP authentication for us */
    int chap_refuse;            /* Refuse CHAP authentication for us */
    int idle;                   /* Idle timeout in seconds */
    int autodial;               /* Try to dial immediately? */
    int defaultroute;           /* Use as default route? */
    int redial;                 /* Redial if disconnected */
    int rmax;                   /* Maximum # of consecutive redials */
    int rtries;                 /* # of tries so far */
    int rtimeout;               /* Redial every this many # of seconds */
    char pppoptfile[STRLEN];    /* File containing PPP options */
    int debug;
    struct tunnel *t;           /* Our tunnel */
    struct call *c;             /* Our call */
};

struct global
{
    int port;                   /* Port number to listen to */
    char authfile[STRLEN];      /* File containing authentication info */
    char altauthfile[STRLEN];   /* File containing authentication info */
    char configfile[STRLEN];    /* File containing configuration info */
    char altconfigfile[STRLEN]; /* File containing configuration info */
    char pidfile[STRLEN];       /* File containing the pid number*/
    int daemon;                 /* Use daemon mode? */
    int accesscontrol;          /* Use access control? */
    int forceuserspace;         /* Force userspace? */
};

extern struct global gconfig;   /* Global configuration options */

extern struct lns *lnslist;     /* All LNS entries */
extern struct lac *laclist;     /* All LAC entries */
extern struct lns *deflns;      /* Default LNS config */
extern struct lac *deflac;      /* Default LAC config */
extern int init_config ();      /* Read in the config file */
#endif