xref: /netbsd/sys/net/if_sppp.h (revision bf9ec67e)
1 /*	$NetBSD: if_sppp.h,v 1.17 2002/04/14 12:24:28 martin 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  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 /* ioctls used by the if_spppsubr.c driver */
40 
41 #define	SPPP_AUTHPROTO_NONE	0
42 #define SPPP_AUTHPROTO_PAP	1
43 #define SPPP_AUTHPROTO_CHAP	2
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 
49 struct spppauthcfg {
50 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
51 	u_int	hisauth;		/* one of SPPP_AUTHPROTO_* above */
52 	u_int	myauth;			/* one of SPPP_AUTHPROTO_* above */
53 	u_int	myname_length;		/* includes terminating 0 */
54 	u_int	mysecret_length;	/* includes terminating 0 */
55 	u_int	hisname_length;		/* includes terminating 0 */
56 	u_int	hissecret_length;	/* includes terminating 0 */
57 	u_int	myauthflags;
58 	u_int	hisauthflags;
59 	char	*myname;
60 	char	*mysecret;
61 	char	*hisname;
62 	char	*hissecret;
63 };
64 
65 #define	SPPPGETAUTHCFG	_IOWR('i', 120, struct spppauthcfg)
66 #define	SPPPSETAUTHCFG	_IOW('i', 121, struct spppauthcfg)
67 
68 struct sppplcpcfg {
69 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
70 	int	lcp_timeout;		/* LCP timeout, in ticks */
71 };
72 
73 #define	SPPPGETLCPCFG	_IOWR('i', 122, struct sppplcpcfg)
74 #define	SPPPSETLCPCFG	_IOW('i', 123, struct sppplcpcfg)
75 
76 /*
77  * Don't change the order of this.  Ordering the phases this way allows
78  * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
79  * know whether LCP is up.
80  */
81 #define	SPPP_PHASE_DEAD		0
82 #define	SPPP_PHASE_ESTABLISH	1
83 #define	SPPP_PHASE_TERMINATE	2
84 #define	SPPP_PHASE_AUTHENTICATE	3
85 #define	SPPP_PHASE_NETWORK	4
86 
87 struct spppstatus {
88 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
89 	int	phase;			/* one of SPPP_PHASE_* above */
90 };
91 
92 #define	SPPPGETSTATUS	_IOWR('i', 124, struct spppstatus)
93 
94 struct spppidletimeout {
95 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
96 	time_t	idle_seconds;		/* number of seconds idle before
97 					 * disconnect, 0 to disable idle-timeout */
98 };
99 
100 #define	SPPPGETIDLETO	_IOWR('i', 125, struct spppstatus)
101 #define	SPPPSETIDLETO	_IOW('i', 126, struct spppstatus)
102 
103 struct spppauthfailurestats {
104 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
105 	int	auth_failures;		/* number of LCP failures since last successfull TLU */
106 	int	max_failures;		/* max. allowed authorization failures */
107 };
108 
109 #define	SPPPGETAUTHFAILURES	_IOWR('i', 127, struct spppauthfailurestats)
110 
111 struct spppauthfailuresettings {
112 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
113 	int	max_failures;		/* max. allowed authorization failures */
114 };
115 #define	SPPPSETAUTHFAILURE	_IOW('i', 128, struct spppauthfailuresettings)
116 
117 /* set the DNS options we would like to query during PPP negotiation */
118 struct spppdnssettings {
119 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
120 	int	query_dns;		/* bitmask (bits 0 and 1) for DNS options to query in IPCP */
121 };
122 #define	SPPPSETDNSOPTS		_IOW('i', 129, struct spppdnssettings)
123 #define	SPPPGETDNSOPTS		_IOWR('i', 130, struct spppdnssettings)
124 
125 /* get the DNS addresses we received from the peer */
126 struct spppdnsaddrs {
127 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
128 	u_int32_t dns[2];		/* IP addresses */
129 };
130 
131 #define SPPPGETDNSADDRS		_IOWR('i', 131, struct spppdnsaddrs)
132