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