1 /* $OpenBSD: ip_ether.h,v 1.18 2014/07/14 12:18:30 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 #if BYTE_ORDER == LITTLE_ENDIAN 46 u_int eip_res:4; /* reserved */ 47 u_int eip_ver:4; /* version */ 48 #endif 49 #if BYTE_ORDER == BIG_ENDIAN 50 u_int eip_ver:4; /* version */ 51 u_int eip_res:4; /* reserved */ 52 #endif 53 u_int8_t eip_pad; /* required padding byte */ 54 } __packed; 55 56 #define ETHERIP_VERSION 0x03 57 58 /* 59 * Names for Ether-IP sysctl objects 60 */ 61 #define ETHERIPCTL_ALLOW 1 /* accept incoming EtherIP packets */ 62 #define ETHERIPCTL_STATS 2 /* etherip stats */ 63 #define ETHERIPCTL_MAXID 3 64 65 #define ETHERIPCTL_NAMES { \ 66 { 0, 0 }, \ 67 { "allow", CTLTYPE_INT }, \ 68 { "stats", CTLTYPE_STRUCT }, \ 69 } 70 71 #ifdef _KERNEL 72 struct tdb; 73 74 int etherip_output(struct mbuf *, struct tdb *, struct mbuf **, int); 75 void etherip_input(struct mbuf *, ...); 76 #ifdef INET6 77 int etherip_input6(struct mbuf **, int *, int); 78 #endif 79 int etherip_sysctl(int *, u_int, void *, size_t *, void *, size_t); 80 81 extern int etherip_allow; 82 extern struct etheripstat etheripstat; 83 #endif /* _KERNEL */ 84 #endif /* _NETINET_IP_ETHER_H_ */ 85