📄 if_ether.h
字号:
/* if_ether.h - network interface Ethernet header file *//* Copyright 2001 - 2005 Wind River Systems, Inc. *//* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 * $FreeBSD: src/sys/netinet/if_ether.h,v 1.24.2.1 2002/02/13 21:38:56 fjoe Exp $ *//*modification history--------------------01y,23feb05,vvv restored ether_tag_header definition for backward-compatibility (SPR #102773)01x,18feb05,wap Allow sysctl init routines to be scaled out01w,08feb05,vvv _KERNEL cleanup01v,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE01u,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver /main/vdt/base6_itn5_networking-int/2)01t,24feb04,nee Adding the prototype for ipEtherResolvRtn 01s,20nov03,niq Remove copyright_wrs.h file inclusion01r,04nov03,rlm Ran batch header path update for header re-org.01q,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.01p,23oct03,rlm updated #includes for header re-org01o,15sep03,vvv updated path for new headers01n,13aug03,niq Fix definition of la_rt (Part of Accordion Base6 merge)01m,15may03,spm Tornado 2.2 FCS merge (SPR #63006; ver 01h,24may02,vvv: TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB)01l,09may03,vvv changed include order to fix build01k,01may03,spm Tornado 2.2 CP1 merge (from ver 01i,13jan03,rae: TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)01j,01feb03,pas merge from FreeBSD 4.7 - changed arp_rtrequest(), arp_ifinit() calls01i,09sep02,hsh add c++ protection01h,13feb02,ham changed for tornado build01g,09dec01,ppp adding llinfo_arp structure 01f,03oct01,ann commenting the prototype for arpintr01e,17sep01,ppp Commenting out the static declaration of in_arpinput01d,10sep01,ann adding some macros that could be helpful01c,24aug01,ann moving the forward declaration of arpintr here from if_ether.c01b,14aug01,ppp Commenting out two definations.01a,01aug01,ppp Created from FreeBSD 4.3*/#ifndef _NETINET_IF_ETHER_H_#define _NETINET_IF_ETHER_H_#include <cfgDefs.h>#include <netinet/in.h>#include <net/ethernet.h>#include <net/if_arp.h>#include <cfgDefs.h>#ifdef __cplusplus extern "C" {#endif typedef struct arp_config_params { CFG_DATA_HDR cfgh; int cfg_priv_arpt_prune; int cfg_priv_arpt_keep; int cfg_priv_arpt_down; int cfg_priv_arpMaxEntries; int cfg_priv_arp_maxtries; int cfg_priv_useloopback; int cfg_priv_arp_proxyall; int cfg_priv_log_arp_wrong_iface; FUNCPTR cfg_privInitSysctl; int cfg_arp_gratuituous;} ARP_CONFIG_PARAMS;/* Ether header for tagged frames */struct ether_tag_header { u_char ether_dhost [6]; u_char ether_shost [6]; u_char etherTag [4]; u_short ether_type; };/* * Clarinet * The following macros are required as they are used in all the * driver header files which include if_ether.h *//* * for compilers that have 4-bytes structure alignment rule, * it is understood that sizeof (ether_header) is 0x10 */#define SIZEOF_ETHERHEADER 0xe /* For tagged Ethernet headers */#define SIZEOF_TAG_ETHERHEADER 0x12 /* minimal size of an ethernet frame including the headers supported * by most ethernet chips. */#define ETHERSMALL 60/* End of Clarinet introduced macros *//* * Macro to map an IP multicast address to an Ethernet multicast address. * The high-order 25 bits of the Ethernet address are statically assigned, * and the low-order 23 bits are taken from the low end of the IP address. */#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ /* struct in_addr *ipaddr; */ \ /* u_char enaddr[ETHER_ADDR_LEN]; */ \{ \ (enaddr)[0] = 0x01; \ (enaddr)[1] = 0x00; \ (enaddr)[2] = 0x5e; \ (enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \ (enaddr)[4] = ((u_char *)ipaddr)[2]; \ (enaddr)[5] = ((u_char *)ipaddr)[3]; \}/* * Macro to map an IP6 multicast address to an Ethernet multicast address. * The high-order 16 bits of the Ethernet address are statically assigned, * and the low-order 32 bits are taken from the low end of the IP6 address. */#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \/* struct in6_addr *ip6addr; */ \/* u_char enaddr[ETHER_ADDR_LEN]; */ \{ \ (enaddr)[0] = 0x33; \ (enaddr)[1] = 0x33; \ (enaddr)[2] = ((u_char *)ip6addr)[12]; \ (enaddr)[3] = ((u_char *)ip6addr)[13]; \ (enaddr)[4] = ((u_char *)ip6addr)[14]; \ (enaddr)[5] = ((u_char *)ip6addr)[15]; \} #define ETHER_MULTICAST(enaddr) \ ((enaddr)[0] == 0x1) && ((enaddr)[1] == 0x0) && ((enaddr)[2] == 0x5e) /* * Ethernet Address Resolution Protocol. * * See RFC 826 for protocol description. Structure below is adapted * to resolving internet addresses. Field names used correspond to * RFC 826. */struct ether_arp { struct arphdr ea_hdr; /* fixed-size header */ u_char arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ u_char arp_spa[4]; /* sender protocol address */ u_char arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ u_char arp_tpa[4]; /* target protocol address */};#define arp_hrd ea_hdr.ar_hrd#define arp_pro ea_hdr.ar_pro#define arp_hln ea_hdr.ar_hln#define arp_pln ea_hdr.ar_pln#define arp_op ea_hdr.ar_opstruct sockaddr_inarp { u_char sin_len; u_char sin_family; u_short sin_port; struct in_addr sin_addr; struct in_addr sin_srcaddr; u_short sin_tos; u_short sin_other;#define SIN_PROXY 1};struct llinfo_arp { LIST_ENTRY(llinfo_arp) la_le; struct rtentry *la_rt; struct mbuf *la_hold; /* last packet until resolved/timeout */ long la_asked; /* last time we QUERIED for this addr */};/* * IP and ethernet specific routing flags */#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */#ifdef _WRS_KERNELextern u_char ether_ipmulticast_min[ETHER_ADDR_LEN];extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN];extern struct ifqueue arpintrq;int arpresolve __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, u_char *, struct rtentry *));int ipEtherResolvRtn __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, char *, struct rtentry *, FUNCPTR));void arp_ifinit __P((struct ifnet *, struct ifaddr *));#endif /* _WRS_KERNEL */#ifdef __cplusplus}#endif#endif /* _NETINET_IF_ETHER_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -