OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / l2tpd / file.h
1 /*
2  * Layer Two Tunnelling Protocol Daemon
3  * Copyright (C) 1998 Adtran, Inc.
4  * Copyright (C) 2002 Jeff McAdams
5  *
6  * Mark Spencer
7  *
8  * This software is distributed under the terms
9  * of the GPL, which you should have received
10  * along with this source.
11  *
12  * File format handling header file
13  *
14  */
15
16 #ifndef _FILE_H
17 #define _FILE_H
18
19 #define STRLEN 80               /* Length of a string */
20
21 /* Definition of a keyword */
22 struct keyword
23 {
24     char *keyword;
25     int (*handler) (char *word, char *value, int context, void *item);
26 };
27
28 struct iprange
29 {
30     unsigned int start;
31     unsigned int end;
32     int sense;
33     struct iprange *next;
34 };
35
36 struct host
37 {
38     char hostname[STRLEN];
39     int port;
40     struct host *next;
41 };
42
43
44 #define CONTEXT_GLOBAL  1
45 #define CONTEXT_LNS             2
46 #define CONTEXT_LAC             3
47 #define CONTEXT_DEFAULT 256
48
49 #define SENSE_ALLOW -1
50 #define SENSE_DENY 0
51
52 #ifndef DEFAULT_AUTH_FILE
53 #define DEFAULT_AUTH_FILE "/etc/l2tpd/l2tp-secrets"
54 #endif
55 #ifndef DEFAULT_CONFIG_FILE
56 #define DEFAULT_CONFIG_FILE "/etc/l2tpd/l2tpd.conf"
57 #endif
58 #define ALT_DEFAULT_AUTH_FILE "/etc/l2tp/l2tp-secrets"
59 #define ALT_DEFAULT_CONFIG_FILE "/etc/l2tp/l2tpd.conf"
60 #define DEFAULT_PID_FILE "/var/run/l2tpd.pid"
61
62 /* Definition of an LNS */
63 struct lns
64 {
65     struct lns *next;
66     int exclusive;              /* Only one tunnel per host? */
67     int active;                 /* Is this actively in use? */
68     unsigned int localaddr;     /* Local IP for PPP connections */
69     int tun_rws;                /* Receive window size (tunnel) */
70     int call_rws;               /* Call rws */
71     int hbit;                   /* Permit hidden AVP's? */
72     int lbit;                   /* Use the length field? */
73     int challenge;              /* Challenge authenticate the peer? */
74     int authpeer;               /* Authenticate our peer? */
75     int authself;               /* Authenticate ourselves? */
76     char authname[STRLEN];      /* Who we authenticate as */
77     char peername[STRLEN];      /* Force peer name to this */
78     char hostname[STRLEN];      /* Hostname to report */
79     char entname[STRLEN];       /* Name of this entry */
80     struct iprange *lacs;       /* Hosts permitted to connect */
81     struct iprange *range;      /* Range of IP's we provide */
82     int passwdauth;             /* Authenticate by passwd file? (or PAM) */
83     int pap_require;            /* Require PAP auth for PPP */
84     int chap_require;           /* Require CHAP auth for PPP */
85     int pap_refuse;             /* Refuse PAP authentication for us */
86     int chap_refuse;            /* Refuse CHAP authentication for us */
87     int idle;                   /* Idle timeout in seconds */
88     unsigned int pridns;        /* Primary DNS server */
89     unsigned int secdns;        /* Secondary DNS server */
90     unsigned int priwins;       /* Primary WINS server */
91     unsigned int secwins;       /* Secondary WINS server */
92     int proxyarp;               /* Use proxy-arp? */
93     int proxyauth;              /* Allow proxy authentication? */
94     int debug;                  /* Debug PPP? */
95     char pppoptfile[STRLEN];    /* File containing PPP options */
96     struct tunnel *t;           /* Tunnel of this, if it's ready */
97 };
98
99 struct lac
100 {
101     struct lac *next;
102     struct host *lns;           /* LNS's we can connect to */
103     struct schedule_entry *rsched;
104     int tun_rws;                /* Receive window size (tunnel) */
105     int call_rws;               /* Call rws */
106     int active;                 /* Is this connection in active use? */
107     int hbit;                   /* Permit hidden AVP's? */
108     int lbit;                   /* Use the length field? */
109     int challenge;              /* Challenge authenticate the peer? */
110     unsigned int localaddr;     /* Local IP address */
111     unsigned int remoteaddr;    /* Force remote address to this */
112     char authname[STRLEN];      /* Who we authenticate as */
113     char peername[STRLEN];      /* Force peer name to this */
114     char hostname[STRLEN];      /* Hostname to report */
115     char entname[STRLEN];       /* Name of this entry */
116     int authpeer;               /* Authenticate our peer? */
117     int authself;               /* Authenticate ourselves? */
118     int pap_require;            /* Require PAP auth for PPP */
119     int chap_require;           /* Require CHAP auth for PPP */
120     int pap_refuse;             /* Refuse PAP authentication for us */
121     int chap_refuse;            /* Refuse CHAP authentication for us */
122     int idle;                   /* Idle timeout in seconds */
123     int autodial;               /* Try to dial immediately? */
124     int defaultroute;           /* Use as default route? */
125     int redial;                 /* Redial if disconnected */
126     int rmax;                   /* Maximum # of consecutive redials */
127     int rtries;                 /* # of tries so far */
128     int rtimeout;               /* Redial every this many # of seconds */
129     char pppoptfile[STRLEN];    /* File containing PPP options */
130     int debug;
131     struct tunnel *t;           /* Our tunnel */
132     struct call *c;             /* Our call */
133 };
134
135 struct global
136 {
137     unsigned int listenaddr;    /* IP address to bind to */ 
138     int port;                   /* Port number to listen to */
139     char authfile[STRLEN];      /* File containing authentication info */
140     char altauthfile[STRLEN];   /* File containing authentication info */
141     char configfile[STRLEN];    /* File containing configuration info */
142     char altconfigfile[STRLEN]; /* File containing configuration info */
143     char pidfile[STRLEN];       /* File containing the pid number*/
144     int daemon;                 /* Use daemon mode? */
145     int accesscontrol;          /* Use access control? */
146     int forceuserspace;         /* Force userspace? */
147 };
148
149 extern struct global gconfig;   /* Global configuration options */
150
151 extern struct lns *lnslist;     /* All LNS entries */
152 extern struct lac *laclist;     /* All LAC entries */
153 extern struct lns *deflns;      /* Default LNS config */
154 extern struct lac *deflac;      /* Default LAC config */
155 extern int init_config ();      /* Read in the config file */
156 #endif