1 /* if_ether.h 6.3 84/03/20 */ 2 3 /* 4 * Ethernet address - 6 octets 5 */ 6 struct ether_addr { 7 u_char ether_addr_octet[6]; 8 }; 9 10 /* 11 * Structure of a 10Mb/s Ethernet header. 12 */ 13 struct ether_header { 14 struct ether_addr ether_dhost; 15 struct ether_addr ether_shost; 16 u_short ether_type; 17 }; 18 19 #define ETHERPUP_PUPTYPE 0x0200 /* PUP protocol */ 20 #define ETHERPUP_IPTYPE 0x0800 /* IP protocol */ 21 #define ETHERPUP_ARPTYPE 0x0806 /* Addr. resolution protocol */ 22 23 /* 24 * The ETHERPUP_NTRAILER packet types starting at ETHERPUP_TRAIL have 25 * (type-ETHERPUP_TRAIL)*512 bytes of data followed 26 * by a PUP type (as given above) and then the (variable-length) header. 27 */ 28 #define ETHERPUP_TRAIL 0x1000 /* Trailer PUP */ 29 #define ETHERPUP_NTRAILER 16 30 31 #define ETHERMTU 1500 32 #define ETHERMIN (60-14) 33 34 /* 35 * Ethernet Address Resolution Protocol. 36 * 37 * See RFC 826 for protocol description. Structure below is adapted 38 * to resolving internet addresses. Field names used correspond to 39 * RFC 826. 40 */ 41 struct ether_arp { 42 u_short arp_hrd; /* format of hardware address */ 43 #define ARPHRD_ETHER 1 /* ethernet hardware address */ 44 u_short arp_pro; /* format of proto. address (ETHERPUP_IPTYPE) */ 45 u_char arp_hln; /* length of hardware address (6) */ 46 u_char arp_pln; /* length of protocol address (4) */ 47 u_short arp_op; 48 #define ARPOP_REQUEST 1 /* request to resolve address */ 49 #define ARPOP_REPLY 2 /* response to previous request */ 50 u_char arp_xsha[6]; /* sender hardware address */ 51 u_char arp_xspa[4]; /* sender protocol address */ 52 u_char arp_xtha[6]; /* target hardware address */ 53 u_char arp_xtpa[4]; /* target protocol address */ 54 }; 55 #define arp_sha(ea) (*(struct ether_addr *)(ea)->arp_xsha) 56 #define arp_spa(ea) (*(struct in_addr *)(ea)->arp_xspa) 57 #define arp_tha(ea) (*(struct ether_addr *)(ea)->arp_xtha) 58 #define arp_tpa(ea) (*(struct in_addr *)(ea)->arp_xtpa) 59 60 /* 61 * Structure shared between the ethernet driver modules and 62 * the address resolution code. For example, each ec_softc or il_softc 63 * begins with this structure. 64 */ 65 struct arpcom { 66 struct ifnet ac_if; /* network-visible interface */ 67 struct ether_addr ac_enaddr; /* ethernet hardware address */ 68 }; 69 70 /* 71 * Internet to ethernet address resolution table. 72 */ 73 struct arptab { 74 struct in_addr at_iaddr; /* internet address */ 75 struct ether_addr at_enaddr; /* ethernet address */ 76 struct mbuf *at_hold; /* last packet until resolved/timeout */ 77 u_char at_timer; /* minutes since last reference */ 78 u_char at_flags; /* flags */ 79 }; 80 81 #ifdef KERNEL 82 struct ether_addr etherbroadcastaddr; 83 struct arptab *arptnew(); 84 #endif 85