xref: /openbsd-src/sys/netinet/ip_ether.h (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1 /*	$OpenBSD: ip_ether.h,v 1.14 2007/12/14 18:33:41 deraadt Exp $ */
2 /*
3  * The author of this code is Angelos D. Keromytis (angelos@adk.gr)
4  *
5  * This code was written by Angelos D. Keromytis in October 1999.
6  *
7  * Copyright (C) 1999-2001 Angelos D. Keromytis.
8  *
9  * Permission to use, copy, and modify this software with or without fee
10  * is hereby granted, provided that this entire notice is included in
11  * all copies of any software which is or includes a copy or
12  * modification of this software.
13  * You may use this code under the GNU public license if you so wish. Please
14  * contribute changes back to the authors under this freer than GPL license
15  * so that we may further the use of strong encryption without limitations to
16  * all.
17  *
18  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
19  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
20  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
21  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
22  * PURPOSE.
23  */
24 
25 #ifndef _NETINET_IP_ETHER_H_
26 #define _NETINET_IP_ETHER_H_
27 
28 /*
29  * Ethernet-inside-IP processing.
30  */
31 
32 struct etheripstat {
33 	u_int32_t	etherip_hdrops;		/* packet shorter than header shows */
34 	u_int32_t	etherip_qfull;		/* bridge queue full, packet dropped */
35 	u_int32_t	etherip_noifdrops;	/* no interface/bridge information */
36 	u_int32_t	etherip_pdrops;		/* packet dropped due to policy */
37 	u_int32_t	etherip_adrops;         /* all other drops */
38 	u_int32_t	etherip_ipackets;	/* total input packets */
39 	u_int32_t	etherip_opackets;	/* total output packets */
40 	u_int64_t	etherip_ibytes;		/* input bytes */
41 	u_int64_t	etherip_obytes;		/* output bytes */
42 };
43 
44 struct etherip_header {
45 	u_int8_t	eip_ver;		/* version/reserved */
46 	u_int8_t	eip_pad;		/* required padding byte */
47 };
48 #define ETHERIP_VER_VERS_MASK	0x0f
49 #define ETHERIP_VER_RSVD_MASK	0xf0
50 
51 #define ETHERIP_VERSION		0x03
52 
53 /*
54  * Names for Ether-IP sysctl objects
55  */
56 #define	ETHERIPCTL_ALLOW	1	/* accept incoming EtherIP packets */
57 #define	ETHERIPCTL_STATS	2	/* etherip stats */
58 #define	ETHERIPCTL_MAXID	3
59 
60 #define ETHERIPCTL_NAMES { \
61 	{ 0, 0 }, \
62 	{ "allow", CTLTYPE_INT }, \
63 	{ "stats", CTLTYPE_STRUCT }, \
64 }
65 
66 #ifdef _KERNEL
67 int	etherip_sysctl(int *, u_int, void *, size_t *, void *, size_t);
68 
69 extern int etherip_allow;
70 extern struct etheripstat etheripstat;
71 #endif /* _KERNEL */
72 #endif /* _NETINET_IP_ETHER_H_ */
73