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