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.6 (Berkeley) 09/16/85 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-ETHERPUP_TRAIL)*512 bytes of data followed 25 * by a PUP 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 u_short arp_hrd; /* format of hardware address */ 42 #define ARPHRD_ETHER 1 /* ethernet hardware address */ 43 u_short arp_pro; /* format of proto. address (ETHERPUP_IPTYPE) */ 44 u_char arp_hln; /* length of hardware address (6) */ 45 u_char arp_pln; /* length of protocol address (4) */ 46 u_short arp_op; 47 #define ARPOP_REQUEST 1 /* request to resolve address */ 48 #define ARPOP_REPLY 2 /* response to previous request */ 49 u_char arp_sha[6]; /* sender hardware address */ 50 u_char arp_spa[4]; /* sender protocol address */ 51 u_char arp_tha[6]; /* target hardware address */ 52 u_char arp_tpa[4]; /* target protocol address */ 53 }; 54 55 /* 56 * Structure shared between the ethernet driver modules and 57 * the address resolution code. For example, each ec_softc or il_softc 58 * begins with this structure. 59 */ 60 struct arpcom { 61 struct ifnet ac_if; /* network-visible interface */ 62 u_char ac_enaddr[6]; /* ethernet hardware address */ 63 struct in_addr ac_ipaddr; /* copy of ip address- XXX */ 64 }; 65 66 /* 67 * Internet to ethernet address resolution table. 68 */ 69 struct arptab { 70 struct in_addr at_iaddr; /* internet address */ 71 u_char at_enaddr[6]; /* ethernet address */ 72 u_char at_timer; /* minutes since last reference */ 73 u_char at_flags; /* flags */ 74 struct mbuf *at_hold; /* last packet until resolved/timeout */ 75 }; 76 77 #ifdef KERNEL 78 u_char etherbroadcastaddr[6]; 79 struct arptab *arptnew(); 80 #endif 81