summaryrefslogtreecommitdiff
path: root/usr.sbin/npppd/pppoe/pppoe_local.h
blob: 5cd602296ec712defd54c97f13d7d571ce3a8c34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*-
 * Copyright (c) 2009 Internet Initiative Japan Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
#ifndef PPPOE_LOCAL_H
#define PPPOE_LOCAL_H 1

#define	BPF_CAPTURE_SIZ			32768
#define PPPOE_SESSION_HASH_SIZ		557
#define PPPOE_SESSION_BUFSIZ		2048
#define	PPPOED_SESSION_SHUFFLE_MARK	0x10000000
#define PPPOED_SHUTDOWN_TIMEOUT		5

#ifndef PPPOE_NSESSION
/** PPPoE 最大接続数 */
#define	PPPOE_NSESSION			10000
#endif
#define	PPPOE_NLISTENER			512

#define pppoe_session_listen_ifname(session)				\
	((pppoed_listener *)slist_get(&(session)->pppoed->listener,	\
	    (session)->listener_index))->listen_ifname
#define pppoe_session_sock_ether_addr(session)				\
	((pppoed_listener *)slist_get(&(session)->pppoed->listener,	\
	    (session)->listener_index))->ether_addr
#define pppoe_session_sock_bpf(session)					\
	((pppoed_listener *)slist_get(&(session)->pppoed->listener,	\
	    (session)->listener_index))->bpf
/** pptp_ctrl から、リスナーの物理層のラベルを取り出すマクロ */
#define PPPOE_SESSION_LISTENER_LABEL(session)  				\
	((pppoed_listener *)slist_get(&(session)->pppoed->listener,	\
	(session)->listener_index))->phy_label
#define PPPOE_SESSION_LISTENER_IFNAME(session) 				\
	((pppoed_listener *)slist_get(&(session)->pppoed->listener,	\
	(session)->listener_index))->listen_ifname

#ifndef GETSHORT
#define GETSHORT(s, cp) { \
	(s) = *(cp)++ << 8; \
	(s) |= *(cp)++; \
}
#endif
#ifndef countof
#define	countof(x)	(sizeof((x)) / sizeof((x)[0]))
#endif

#define	IFTYPE_IS_LAN(iftype)						\
	((iftype) == IFT_ETHER || (iftype) == IFT_L2VLAN ||		\
	(iftype) == IFT_L3IPVLAN || (iftype) == IFT_L3IPXVLAN)


#endif