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