1 /* 2 * Copyright (c) 1982 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)if_ether.h 6.7 (Berkeley) 01/13/86 7 */ 8 9 /* 10 * Structure of a 10Mb/s Ethernet header. 11 */ 12 struct ether_header { 13 u_char ether_dhost[6]; 14 u_char ether_shost[6]; 15 u_short ether_type; 16 }; 17 18 #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ 19 #define ETHERTYPE_IP 0x0800 /* IP protocol */ 20 #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ 21 22 /* 23 * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have 24 * (type-ETHERTYPE_TRAIL)*512 bytes of data followed 25 * by an ETHER type (as given above) and then the (variable-length) header. 26 */ 27 #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ 28 #define ETHERTYPE_NTRAILER 16 29 30 #define ETHERMTU 1500 31 #define ETHERMIN (60-14) 32 33 /* 34 * Ethernet Address Resolution Protocol. 35 * 36 * See RFC 826 for protocol description. Structure below is adapted 37 * to resolving internet addresses. Field names used correspond to 38 * RFC 826. 39 */ 40 struct ether_arp { 41 struct arphdr ea_hdr; /* fixed-size header */ 42 u_char arp_sha[6]; /* sender hardware address */ 43 u_char arp_spa[4]; /* sender protocol address */ 44 u_char arp_tha[6]; /* target hardware address */ 45 u_char arp_tpa[4]; /* target protocol address */ 46 }; 47 #define arp_hrd ea_hdr.ar_hrd 48 #define arp_pro ea_hdr.ar_pro 49 #define arp_hln ea_hdr.ar_hln 50 #define arp_pln ea_hdr.ar_pln 51 #define arp_op ea_hdr.ar_op 52 53 54 /* 55 * Structure shared between the ethernet driver modules and 56 * the address resolution code. For example, each ec_softc or il_softc 57 * begins with this structure. 58 */ 59 struct arpcom { 60 struct ifnet ac_if; /* network-visible interface */ 61 u_char ac_enaddr[6]; /* ethernet hardware address */ 62 struct in_addr ac_ipaddr; /* copy of ip address- XXX */ 63 }; 64 65 /* 66 * Internet to ethernet address resolution table. 67 */ 68 struct arptab { 69 struct in_addr at_iaddr; /* internet address */ 70 u_char at_enaddr[6]; /* ethernet address */ 71 u_char at_timer; /* minutes since last reference */ 72 u_char at_flags; /* flags */ 73 struct mbuf *at_hold; /* last packet until resolved/timeout */ 74 }; 75 76 #ifdef KERNEL 77 u_char etherbroadcastaddr[6]; 78 struct arptab *arptnew(); 79 char *ether_sprintf(); 80 #endif 81