FreeBSD/Linux Kernel Cross Reference
sys/net/if_sppp.h
1 /* $NetBSD: if_sppp.h,v 1.36 2021/05/14 08:41:25 yamaguchi Exp $ */
2
3 /*-
4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Martin Husemann <martin@NetBSD.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _NET_IF_SPPP_H_
33 #define _NET_IF_SPPP_H_
34
35 /* ioctls used by the if_spppsubr.c driver */
36
37 #include <sys/ioccom.h>
38
39
40 #define SPPP_AUTHPROTO_NONE 0
41 #define SPPP_AUTHPROTO_PAP 1
42 #define SPPP_AUTHPROTO_CHAP 2
43 #define SPPP_AUTHPROTO_NOCHG 3
44
45 #define SPPP_AUTHFLAG_NOCALLOUT 1 /* do not require authentication on */
46 /* callouts */
47 #define SPPP_AUTHFLAG_NORECHALLENGE 2 /* do not re-challenge CHAP */
48 #define SPPP_AUTHFLAG_PASSIVEAUTHPROTO 4 /* use authproto proposed by peer */
49
50 struct spppauthcfg {
51 char ifname[IFNAMSIZ]; /* pppoe interface name */
52 u_int hisauth; /* one of SPPP_AUTHPROTO_* above */
53 u_int myauth; /* one of SPPP_AUTHPROTO_* above */
54 u_int myname_length; /* includes terminating 0 */
55 u_int mysecret_length; /* includes terminating 0 */
56 u_int hisname_length; /* includes terminating 0 */
57 u_int hissecret_length; /* includes terminating 0 */
58 u_int myauthflags;
59 u_int hisauthflags;
60 char *myname;
61 char *mysecret;
62 char *hisname;
63 char *hissecret;
64 };
65
66 #define SPPPGETAUTHCFG _IOWR('i', 120, struct spppauthcfg)
67 #define SPPPSETAUTHCFG _IOW('i', 121, struct spppauthcfg)
68
69 struct sppplcpcfg {
70 char ifname[IFNAMSIZ]; /* pppoe interface name */
71 int lcp_timeout; /* LCP timeout, in ticks */
72 };
73
74 #define SPPPGETLCPCFG _IOWR('i', 122, struct sppplcpcfg)
75 #define SPPPSETLCPCFG _IOW('i', 123, struct sppplcpcfg)
76
77 /*
78 * Don't change the order of this. Ordering the phases this way allows
79 * for a comparison of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
80 * know whether LCP is up.
81 */
82 #define SPPP_PHASE_DEAD 0
83 #define SPPP_PHASE_ESTABLISH 1
84 #define SPPP_PHASE_TERMINATE 2
85 #define SPPP_PHASE_AUTHENTICATE 3
86 #define SPPP_PHASE_NETWORK 4
87
88 struct spppstatus {
89 char ifname[IFNAMSIZ]; /* pppoe interface name */
90 int phase; /* one of SPPP_PHASE_* above */
91 };
92
93 #define SPPPGETSTATUS _IOWR('i', 124, struct spppstatus)
94
95 struct spppstatusncp {
96 char ifname[IFNAMSIZ]; /* pppoe interface name */
97 int phase; /* one of SPPP_PHASE_* above */
98 int ncpup; /* != 0 if at least on NCP is up */
99 };
100
101 #define SPPPGETSTATUSNCP _IOWR('i', 134, struct spppstatusncp)
102
103 struct spppidletimeout {
104 char ifname[IFNAMSIZ]; /* pppoe interface name */
105 time_t idle_seconds; /* number of seconds idle before
106 * disconnect, 0 to disable idle-timeout */
107 };
108
109 struct spppidletimeout50 {
110 char ifname[IFNAMSIZ]; /* pppoe interface name */
111 uint32_t idle_seconds; /* number of seconds idle before
112 * disconnect, 0 to disable idle-timeout */
113 };
114
115 #define SPPPGETIDLETO _IOWR('i', 125, struct spppidletimeout)
116 #define SPPPSETIDLETO _IOW('i', 126, struct spppidletimeout)
117 #define __SPPPGETIDLETO50 _IOWR('i', 125, struct spppidletimeout50)
118 #define __SPPPSETIDLETO50 _IOW('i', 126, struct spppidletimeout50)
119
120 struct spppauthfailurestats {
121 char ifname[IFNAMSIZ]; /* pppoe interface name */
122 int auth_failures; /* number of LCP failures since last successful TLU */
123 int max_failures; /* max. allowed authorization failures */
124 };
125
126 #define SPPPGETAUTHFAILURES _IOWR('i', 127, struct spppauthfailurestats)
127
128 struct spppauthfailuresettings {
129 char ifname[IFNAMSIZ]; /* pppoe interface name */
130 int max_failures; /* max. allowed authorization failures */
131 };
132 #define SPPPSETAUTHFAILURE _IOW('i', 128, struct spppauthfailuresettings)
133
134 /* set the DNS options we would like to query during PPP negotiation */
135 struct spppdnssettings {
136 char ifname[IFNAMSIZ]; /* pppoe interface name */
137 int query_dns; /* bitmask (bits 0 and 1) for DNS options to query in IPCP */
138 };
139 #define SPPPSETDNSOPTS _IOW('i', 129, struct spppdnssettings)
140 #define SPPPGETDNSOPTS _IOWR('i', 130, struct spppdnssettings)
141
142 /* get the DNS addresses we received from the peer */
143 struct spppdnsaddrs {
144 char ifname[IFNAMSIZ]; /* pppoe interface name */
145 uint32_t dns[2]; /* IP addresses */
146 };
147
148 #define SPPPGETDNSADDRS _IOWR('i', 131, struct spppdnsaddrs)
149
150 /* set LCP keepalive/timeout options */
151 struct spppkeepalivesettings {
152 char ifname[IFNAMSIZ]; /* pppoe interface name */
153 u_int maxalive; /* number of LCP echo req. w/o reply */
154 time_t max_noreceive; /* (sec.) grace period before we start
155 sending LCP echo requests. */
156 u_int alive_interval; /* number of keepalive between echo req. */
157 };
158 struct spppkeepalivesettings50 {
159 char ifname[IFNAMSIZ]; /* pppoe interface name */
160 u_int maxalive; /* number of LCP echo req. w/o reply */
161 uint32_t max_noreceive; /* (sec.) grace period before we start
162 sending LCP echo requests. */
163 };
164 #define SPPPSETKEEPALIVE _IOW('i', 132, struct spppkeepalivesettings)
165 #define SPPPGETKEEPALIVE _IOWR('i', 133, struct spppkeepalivesettings)
166 #define __SPPPSETKEEPALIVE50 _IOW('i', 132, struct spppkeepalivesettings50)
167 #define __SPPPGETKEEPALIVE50 _IOWR('i', 133, struct spppkeepalivesettings50)
168
169 /* 134 already used! */
170
171 /* states are named and numbered according to RFC 1661 */
172 #define SPPP_STATE_INITIAL 0
173 #define SPPP_STATE_STARTING 1
174 #define SPPP_STATE_CLOSED 2
175 #define SPPP_STATE_STOPPED 3
176 #define SPPP_STATE_CLOSING 4
177 #define SPPP_STATE_STOPPING 5
178 #define SPPP_STATE_REQ_SENT 6
179 #define SPPP_STATE_ACK_RCVD 7
180 #define SPPP_STATE_ACK_SENT 8
181 #define SPPP_STATE_OPENED 9
182
183 #define SPPP_LCP_OPT_MRU __BIT(1)
184 #define SPPP_LCP_OPT_ASYNC_MAP __BIT(2)
185 #define SPPP_LCP_OPT_AUTH_PROTO __BIT(3)
186 #define SPPP_LCP_OPT_QUAL_PROTO __BIT(4)
187 #define SPPP_LCP_OPT_MAGIC __BIT(5)
188 #define SPPP_LCP_OPT_RESERVED __BIT(6)
189 #define SPPP_LCP_OPT_PROTO_COMP __BIT(7)
190 #define SPPP_LCP_OPT_ADDR_COMP __BIT(8)
191 #define SPPP_LCP_OPT_FCS_ALTS __BIT(9)
192 #define SPPP_LCP_OPT_SELF_DESC_PAD __BIT(10)
193 #define SPPP_LCP_OPT_CALL_BACK __BIT(13)
194 #define SPPP_LCP_OPT_COMPOUND_FRMS __BIT(15)
195 #define SPPP_LCP_OPT_MP_MRRU __BIT(17)
196 #define SPPP_LCP_OPT_MP_SSNHF __BIT(18)
197 #define SPPP_LCP_OPT_MP_EID __BIT(19)
198
199 /* #define SPPP_OPT_ADDRESSES __BIT(0) */
200 #define SPPP_IPCP_OPT_COMPRESSION __BIT(1)
201 #define SPPP_IPCP_OPT_ADDRESS __BIT(2)
202 #define SPPP_IPCP_OPT_PRIMDNS __BIT(3)
203 #define SPPP_IPCP_OPT_SECDNS __BIT(4)
204
205 #define SPPP_IPV6CP_OPT_IFID __BIT(1)
206 #define SPPP_IPV6CP_OPT_COMPRESSION __BIT(2)
207
208 struct sppplcpstatus {
209 char ifname[IFNAMSIZ];
210 int state;
211 int timeout;
212 u_long opts;
213 u_long magic;
214 u_long mru;
215 };
216
217 #define SPPPGETLCPSTATUS _IOWR('i', 135, struct sppplcpstatus)
218
219 struct spppipcpstatus {
220 char ifname[IFNAMSIZ];
221 int state;
222 u_long opts;
223 u_int32_t myaddr;
224 };
225
226 #define SPPPGETIPCPSTATUS _IOWR('i', 136, struct spppipcpstatus)
227
228 struct spppipv6cpstatus {
229 char ifname[IFNAMSIZ];
230 int state;
231 u_long opts;
232 u_int8_t my_ifid[8];
233 u_int8_t his_ifid[8];
234 };
235
236 #define SPPPGETIPV6CPSTATUS _IOWR('i', 137, struct spppipv6cpstatus)
237
238 #define SPPP_NCP_IPCP __BIT(0)
239 #define SPPP_NCP_IPV6CP __BIT(1)
240 struct spppncpcfg {
241 char ifname[IFNAMSIZ];
242 u_int ncp_flags;
243 };
244
245 #define SPPPGETNCPCFG _IOWR('i', 138, struct spppncpcfg)
246 #define SPPPSETNCPCFG _IOW('i', 139, struct spppncpcfg)
247
248 #endif /* !_NET_IF_SPPP_H_ */
249
Cache object: 53b5a389144a441ffd6f738c78e8db06
|