123173Smckusick /* 229135Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 332787Sbostic * All rights reserved. 423173Smckusick * 532787Sbostic * Redistribution and use in source and binary forms are permitted 634854Sbostic * provided that the above copyright notice and this paragraph are 734854Sbostic * duplicated in all such forms and that any documentation, 834854Sbostic * advertising materials, and other materials related to such 934854Sbostic * distribution and use acknowledge that the software was developed 1034854Sbostic * by the University of California, Berkeley. The name of the 1134854Sbostic * University may not be used to endorse or promote products derived 1234854Sbostic * from this software without specific prior written permission. 1334854Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434854Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1534854Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1632787Sbostic * 17*36819Skarels * @(#)if_ether.h 7.4 (Berkeley) 02/17/89 1823173Smckusick */ 199744Ssam 209744Ssam /* 219744Ssam * Structure of a 10Mb/s Ethernet header. 229744Ssam */ 239746Ssam struct ether_header { 2418641Skarels u_char ether_dhost[6]; 2518641Skarels u_char ether_shost[6]; 269746Ssam u_short ether_type; 279744Ssam }; 289744Ssam 2918641Skarels #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ 3018641Skarels #define ETHERTYPE_IP 0x0800 /* IP protocol */ 3118641Skarels #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ 329744Ssam 339744Ssam /* 3418641Skarels * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have 3525891Skarels * (type-ETHERTYPE_TRAIL)*512 bytes of data followed 3625891Skarels * by an ETHER type (as given above) and then the (variable-length) header. 379744Ssam */ 3818641Skarels #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ 3918641Skarels #define ETHERTYPE_NTRAILER 16 409746Ssam 419746Ssam #define ETHERMTU 1500 429746Ssam #define ETHERMIN (60-14) 4311573Ssam 4411573Ssam /* 4511573Ssam * Ethernet Address Resolution Protocol. 4611573Ssam * 4711573Ssam * See RFC 826 for protocol description. Structure below is adapted 4811573Ssam * to resolving internet addresses. Field names used correspond to 4911573Ssam * RFC 826. 5011573Ssam */ 5111573Ssam struct ether_arp { 5225891Skarels struct arphdr ea_hdr; /* fixed-size header */ 5318641Skarels u_char arp_sha[6]; /* sender hardware address */ 5418641Skarels u_char arp_spa[4]; /* sender protocol address */ 5518641Skarels u_char arp_tha[6]; /* target hardware address */ 5618641Skarels u_char arp_tpa[4]; /* target protocol address */ 5711573Ssam }; 5825891Skarels #define arp_hrd ea_hdr.ar_hrd 5925891Skarels #define arp_pro ea_hdr.ar_pro 6025891Skarels #define arp_hln ea_hdr.ar_hln 6125891Skarels #define arp_pln ea_hdr.ar_pln 6225891Skarels #define arp_op ea_hdr.ar_op 6311573Ssam 6425891Skarels 6511573Ssam /* 6611573Ssam * Structure shared between the ethernet driver modules and 6711573Ssam * the address resolution code. For example, each ec_softc or il_softc 6811573Ssam * begins with this structure. 6911573Ssam */ 7011573Ssam struct arpcom { 7118641Skarels struct ifnet ac_if; /* network-visible interface */ 7218641Skarels u_char ac_enaddr[6]; /* ethernet hardware address */ 7318641Skarels struct in_addr ac_ipaddr; /* copy of ip address- XXX */ 7411573Ssam }; 7511573Ssam 7616211Skarels /* 7716211Skarels * Internet to ethernet address resolution table. 7816211Skarels */ 7916211Skarels struct arptab { 8016211Skarels struct in_addr at_iaddr; /* internet address */ 8118641Skarels u_char at_enaddr[6]; /* ethernet address */ 8216211Skarels u_char at_timer; /* minutes since last reference */ 8316211Skarels u_char at_flags; /* flags */ 8424804Skarels struct mbuf *at_hold; /* last packet until resolved/timeout */ 8516211Skarels }; 8616211Skarels 8712459Ssam #ifdef KERNEL 88*36819Skarels u_char etherbroadcastaddr[6]; 8911573Ssam struct arptab *arptnew(); 90*36819Skarels int ether_output(), ether_input(); 91*36819Skarels char *ether_sprintf(); 9211573Ssam #endif 93