xref: /openbsd/sys/net/if_pppoe.h (revision a4cc1f24)
1*a4cc1f24Sdlg /*	$OpenBSD: if_pppoe.h,v 1.9 2025/01/15 06:15:44 dlg Exp $ */
221a78fbcScanacar /*	$NetBSD: if_pppoe.h,v 1.5 2003/11/28 08:56:48 keihan Exp $ */
321a78fbcScanacar 
421a78fbcScanacar /*
521a78fbcScanacar  * Copyright (c) 2002 The NetBSD Foundation, Inc.
621a78fbcScanacar  * All rights reserved.
721a78fbcScanacar  *
821a78fbcScanacar  * This code is derived from software contributed to The NetBSD Foundation
921a78fbcScanacar  * by Martin Husemann <martin@NetBSD.org>.
1021a78fbcScanacar  *
1121a78fbcScanacar  * Redistribution and use in source and binary forms, with or without
1221a78fbcScanacar  * modification, are permitted provided that the following conditions
1321a78fbcScanacar  * are met:
1421a78fbcScanacar  * 1. Redistributions of source code must retain the above copyright
1521a78fbcScanacar  *    notice, this list of conditions and the following disclaimer.
1621a78fbcScanacar  * 2. Redistributions in binary form must reproduce the above copyright
1721a78fbcScanacar  *    notice, this list of conditions and the following disclaimer in the
1821a78fbcScanacar  *    documentation and/or other materials provided with the distribution.
1921a78fbcScanacar  *
2021a78fbcScanacar  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2121a78fbcScanacar  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2221a78fbcScanacar  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2321a78fbcScanacar  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2421a78fbcScanacar  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2521a78fbcScanacar  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2621a78fbcScanacar  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2721a78fbcScanacar  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2821a78fbcScanacar  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2921a78fbcScanacar  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3021a78fbcScanacar  * POSSIBILITY OF SUCH DAMAGE.
3121a78fbcScanacar  */
3221a78fbcScanacar 
3321a78fbcScanacar #ifndef _NET_IF_PPPOE_H_
3421a78fbcScanacar #define _NET_IF_PPPOE_H_
3521a78fbcScanacar 
3621a78fbcScanacar #define PPPOE_NAMELEN	512		/* should be enough */
3721a78fbcScanacar struct pppoediscparms {
3821a78fbcScanacar 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
3921a78fbcScanacar 	char	eth_ifname[IFNAMSIZ];	/* external ethernet interface name */
4021a78fbcScanacar 	char	ac_name[PPPOE_NAMELEN];	/* access concentrator name */
4121a78fbcScanacar 	char	service_name[PPPOE_NAMELEN]; /* service name */
4221a78fbcScanacar };
4321a78fbcScanacar 
4421a78fbcScanacar #define	PPPOESETPARMS	_IOW('i', 110, struct pppoediscparms)
4521a78fbcScanacar #define	PPPOEGETPARMS	_IOWR('i', 111, struct pppoediscparms)
4621a78fbcScanacar 
4721a78fbcScanacar #define PPPOE_STATE_INITIAL	0
4821a78fbcScanacar #define PPPOE_STATE_PADI_SENT	1
4921a78fbcScanacar #define	PPPOE_STATE_PADR_SENT	2
5021a78fbcScanacar #define	PPPOE_STATE_SESSION	3
5121a78fbcScanacar #define	PPPOE_STATE_CLOSING	4
5221a78fbcScanacar /* passive */
5321a78fbcScanacar #define	PPPOE_STATE_PADO_SENT	1
5421a78fbcScanacar 
5521a78fbcScanacar struct pppoeconnectionstate {
5621a78fbcScanacar 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
5721a78fbcScanacar 	u_int	state;			/* one of the PPPOE_STATE_ states above */
5821a78fbcScanacar 	u_int	session_id;		/* if state == PPPOE_STATE_SESSION */
5921a78fbcScanacar 	u_int	padi_retry_no;		/* number of retries already sent */
6021a78fbcScanacar 	u_int	padr_retry_no;
6121a78fbcScanacar 
6221a78fbcScanacar 	struct timeval session_time;	/* time the session was established */
6321a78fbcScanacar };
6421a78fbcScanacar 
6521a78fbcScanacar #define PPPOEGETSESSION	_IOWR('i', 112, struct pppoeconnectionstate)
6621a78fbcScanacar 
6721a78fbcScanacar #ifdef _KERNEL
6821a78fbcScanacar 
692c8b151eSmvs extern struct mbuf_queue pppoediscinq;
702c8b151eSmvs extern struct mbuf_queue pppoeinq;
7121a78fbcScanacar 
72*a4cc1f24Sdlg int		 pppoe_if_exists(void);
73*a4cc1f24Sdlg struct mbuf	*pppoe_vinput(struct ifnet *, struct mbuf *);
74*a4cc1f24Sdlg 
7521a78fbcScanacar #endif /* _KERNEL */
76f9ce9b1bSpvalchev #endif /* _NET_IF_PPPOE_H_ */
77