xref: /original-bsd/sys/netinet/if_ether.h (revision 4d072710)
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 the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)if_ether.h	7.3 (Berkeley) 06/29/88
18  */
19 
20 /*
21  * Structure of a 10Mb/s Ethernet header.
22  */
23 struct	ether_header {
24 	u_char	ether_dhost[6];
25 	u_char	ether_shost[6];
26 	u_short	ether_type;
27 };
28 
29 #define	ETHERTYPE_PUP	0x0200		/* PUP protocol */
30 #define	ETHERTYPE_IP	0x0800		/* IP protocol */
31 #define ETHERTYPE_ARP	0x0806		/* Addr. resolution protocol */
32 
33 /*
34  * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
35  * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
36  * by an ETHER type (as given above) and then the (variable-length) header.
37  */
38 #define	ETHERTYPE_TRAIL		0x1000		/* Trailer packet */
39 #define	ETHERTYPE_NTRAILER	16
40 
41 #define	ETHERMTU	1500
42 #define	ETHERMIN	(60-14)
43 
44 /*
45  * Ethernet Address Resolution Protocol.
46  *
47  * See RFC 826 for protocol description.  Structure below is adapted
48  * to resolving internet addresses.  Field names used correspond to
49  * RFC 826.
50  */
51 struct	ether_arp {
52 	struct	arphdr ea_hdr;	/* fixed-size header */
53 	u_char	arp_sha[6];	/* sender hardware address */
54 	u_char	arp_spa[4];	/* sender protocol address */
55 	u_char	arp_tha[6];	/* target hardware address */
56 	u_char	arp_tpa[4];	/* target protocol address */
57 };
58 #define	arp_hrd	ea_hdr.ar_hrd
59 #define	arp_pro	ea_hdr.ar_pro
60 #define	arp_hln	ea_hdr.ar_hln
61 #define	arp_pln	ea_hdr.ar_pln
62 #define	arp_op	ea_hdr.ar_op
63 
64 
65 /*
66  * Structure shared between the ethernet driver modules and
67  * the address resolution code.  For example, each ec_softc or il_softc
68  * begins with this structure.
69  */
70 struct	arpcom {
71 	struct 	ifnet ac_if;		/* network-visible interface */
72 	u_char	ac_enaddr[6];		/* ethernet hardware address */
73 	struct in_addr ac_ipaddr;	/* copy of ip address- XXX */
74 };
75 
76 /*
77  * Internet to ethernet address resolution table.
78  */
79 struct	arptab {
80 	struct	in_addr at_iaddr;	/* internet address */
81 	u_char	at_enaddr[6];		/* ethernet address */
82 	u_char	at_timer;		/* minutes since last reference */
83 	u_char	at_flags;		/* flags */
84 	struct	mbuf *at_hold;		/* last packet until resolved/timeout */
85 };
86 
87 #ifdef	KERNEL
88 u_char etherbroadcastaddr[6];
89 struct	arptab *arptnew();
90 char *ether_sprintf();
91 #endif
92