xref: /csrg-svn/sys/netinet/if_ether.h (revision 32787)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  *
12  *	@(#)if_ether.h	7.2 (Berkeley) 12/07/87
13  */
14 
15 /*
16  * Structure of a 10Mb/s Ethernet header.
17  */
18 struct	ether_header {
19 	u_char	ether_dhost[6];
20 	u_char	ether_shost[6];
21 	u_short	ether_type;
22 };
23 
24 #define	ETHERTYPE_PUP	0x0200		/* PUP protocol */
25 #define	ETHERTYPE_IP	0x0800		/* IP protocol */
26 #define ETHERTYPE_ARP	0x0806		/* Addr. resolution protocol */
27 
28 /*
29  * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
30  * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
31  * by an ETHER type (as given above) and then the (variable-length) header.
32  */
33 #define	ETHERTYPE_TRAIL		0x1000		/* Trailer packet */
34 #define	ETHERTYPE_NTRAILER	16
35 
36 #define	ETHERMTU	1500
37 #define	ETHERMIN	(60-14)
38 
39 /*
40  * Ethernet Address Resolution Protocol.
41  *
42  * See RFC 826 for protocol description.  Structure below is adapted
43  * to resolving internet addresses.  Field names used correspond to
44  * RFC 826.
45  */
46 struct	ether_arp {
47 	struct	arphdr ea_hdr;	/* fixed-size header */
48 	u_char	arp_sha[6];	/* sender hardware address */
49 	u_char	arp_spa[4];	/* sender protocol address */
50 	u_char	arp_tha[6];	/* target hardware address */
51 	u_char	arp_tpa[4];	/* target protocol address */
52 };
53 #define	arp_hrd	ea_hdr.ar_hrd
54 #define	arp_pro	ea_hdr.ar_pro
55 #define	arp_hln	ea_hdr.ar_hln
56 #define	arp_pln	ea_hdr.ar_pln
57 #define	arp_op	ea_hdr.ar_op
58 
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 	u_char	ac_enaddr[6];		/* ethernet hardware address */
68 	struct in_addr ac_ipaddr;	/* copy of ip address- XXX */
69 };
70 
71 /*
72  * Internet to ethernet address resolution table.
73  */
74 struct	arptab {
75 	struct	in_addr at_iaddr;	/* internet address */
76 	u_char	at_enaddr[6];		/* ethernet address */
77 	u_char	at_timer;		/* minutes since last reference */
78 	u_char	at_flags;		/* flags */
79 	struct	mbuf *at_hold;		/* last packet until resolved/timeout */
80 };
81 
82 #ifdef	KERNEL
83 u_char etherbroadcastaddr[6];
84 struct	arptab *arptnew();
85 char *ether_sprintf();
86 #endif
87