1/*	$NetBSD: if_sppp.h,v 1.26 2008/04/28 20:24:09 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 *
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#define	SPPP_AUTHPROTO_NONE	0
38#define SPPP_AUTHPROTO_PAP	1
39#define SPPP_AUTHPROTO_CHAP	2
40
41#define SPPP_AUTHFLAG_NOCALLOUT		1	/* do not require authentication on */
42						/* callouts */
43#define SPPP_AUTHFLAG_NORECHALLENGE	2	/* do not re-challenge CHAP */
44
45struct spppauthcfg {
46	char	ifname[IFNAMSIZ];	/* pppoe interface name */
47	u_int	hisauth;		/* one of SPPP_AUTHPROTO_* above */
48	u_int	myauth;			/* one of SPPP_AUTHPROTO_* above */
49	u_int	myname_length;		/* includes terminating 0 */
50	u_int	mysecret_length;	/* includes terminating 0 */
51	u_int	hisname_length;		/* includes terminating 0 */
52	u_int	hissecret_length;	/* includes terminating 0 */
53	u_int	myauthflags;
54	u_int	hisauthflags;
55	char	*myname;
56	char	*mysecret;
57	char	*hisname;
58	char	*hissecret;
59};
60
61#define	SPPPGETAUTHCFG	_IOWR('i', 120, struct spppauthcfg)
62#define	SPPPSETAUTHCFG	_IOW('i', 121, struct spppauthcfg)
63
64struct sppplcpcfg {
65	char	ifname[IFNAMSIZ];	/* pppoe interface name */
66	int	lcp_timeout;		/* LCP timeout, in ticks */
67};
68
69#define	SPPPGETLCPCFG	_IOWR('i', 122, struct sppplcpcfg)
70#define	SPPPSETLCPCFG	_IOW('i', 123, struct sppplcpcfg)
71
72/*
73 * Don't change the order of this.  Ordering the phases this way allows
74 * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to
75 * know whether LCP is up.
76 */
77#define	SPPP_PHASE_DEAD		0
78#define	SPPP_PHASE_ESTABLISH	1
79#define	SPPP_PHASE_TERMINATE	2
80#define	SPPP_PHASE_AUTHENTICATE	3
81#define	SPPP_PHASE_NETWORK	4
82
83struct spppstatus {
84	char	ifname[IFNAMSIZ];	/* pppoe interface name */
85	int	phase;			/* one of SPPP_PHASE_* above */
86};
87
88#define	SPPPGETSTATUS	_IOWR('i', 124, struct spppstatus)
89
90struct spppstatusncp {
91	char	ifname[IFNAMSIZ];	/* pppoe interface name */
92	int	phase;			/* one of SPPP_PHASE_* above */
93	int	ncpup;			/* != 0 if at least on NCP is up */
94};
95
96#define	SPPPGETSTATUSNCP	_IOWR('i', 134, struct spppstatusncp)
97
98struct spppidletimeout {
99	char	ifname[IFNAMSIZ];	/* pppoe interface name */
100	time_t	idle_seconds;		/* number of seconds idle before
101					 * disconnect, 0 to disable idle-timeout */
102};
103
104struct spppidletimeout50 {
105	char	ifname[IFNAMSIZ];	/* pppoe interface name */
106	uint32_t idle_seconds;		/* number of seconds idle before
107					 * disconnect, 0 to disable idle-timeout */
108};
109
110#define	SPPPGETIDLETO	_IOWR('i', 125, struct spppidletimeout)
111#define	SPPPSETIDLETO	_IOW('i', 126, struct spppidletimeout)
112#define	__SPPPGETIDLETO50	_IOWR('i', 125, struct spppidletimeout50)
113#define	__SPPPSETIDLETO50	_IOW('i', 126, struct spppidletimeout50)
114
115struct spppauthfailurestats {
116	char	ifname[IFNAMSIZ];	/* pppoe interface name */
117	int	auth_failures;		/* number of LCP failures since last successful TLU */
118	int	max_failures;		/* max. allowed authorization failures */
119};
120
121#define	SPPPGETAUTHFAILURES	_IOWR('i', 127, struct spppauthfailurestats)
122
123struct spppauthfailuresettings {
124	char	ifname[IFNAMSIZ];	/* pppoe interface name */
125	int	max_failures;		/* max. allowed authorization failures */
126};
127#define	SPPPSETAUTHFAILURE	_IOW('i', 128, struct spppauthfailuresettings)
128
129/* set the DNS options we would like to query during PPP negotiation */
130struct spppdnssettings {
131	char	ifname[IFNAMSIZ];	/* pppoe interface name */
132	int	query_dns;		/* bitmask (bits 0 and 1) for DNS options to query in IPCP */
133};
134#define	SPPPSETDNSOPTS		_IOW('i', 129, struct spppdnssettings)
135#define	SPPPGETDNSOPTS		_IOWR('i', 130, struct spppdnssettings)
136
137/* get the DNS addresses we received from the peer */
138struct spppdnsaddrs {
139	char	ifname[IFNAMSIZ];	/* pppoe interface name */
140	uint32_t dns[2];		/* IP addresses */
141};
142
143#define SPPPGETDNSADDRS		_IOWR('i', 131, struct spppdnsaddrs)
144
145/* set LCP keepalive/timeout options */
146struct spppkeepalivesettings {
147	char	ifname[IFNAMSIZ];	/* pppoe interface name */
148	u_int	maxalive;		/* number of LCP echo req. w/o reply */
149	time_t	max_noreceive;		/* (sec.) grace period before we start
150					   sending LCP echo requests. */
151};
152struct spppkeepalivesettings50 {
153	char	ifname[IFNAMSIZ];	/* pppoe interface name */
154	u_int	maxalive;		/* number of LCP echo req. w/o reply */
155	uint32_t max_noreceive;		/* (sec.) grace period before we start
156					   sending LCP echo requests. */
157};
158#define	SPPPSETKEEPALIVE	_IOW('i', 132, struct spppkeepalivesettings)
159#define	SPPPGETKEEPALIVE	_IOWR('i', 133, struct spppkeepalivesettings)
160#define	__SPPPSETKEEPALIVE50	_IOW('i', 132, struct spppkeepalivesettings50)
161#define	__SPPPGETKEEPALIVE50	_IOWR('i', 133, struct spppkeepalivesettings50)
162
163/* 134 already used! */
164
165#endif /* !_NET_IF_SPPP_H_ */
166
167