xref: /original-bsd/sys/netinet/if_ether.h (revision 5da3d24a)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)if_ether.h	7.6 (Berkeley) 06/25/91
8  */
9 
10 /*
11  * Structure of a 10Mb/s Ethernet header.
12  */
13 struct	ether_header {
14 	u_char	ether_dhost[6];
15 	u_char	ether_shost[6];
16 	u_short	ether_type;
17 };
18 
19 #define	ETHERTYPE_PUP	0x0200		/* PUP protocol */
20 #define	ETHERTYPE_IP	0x0800		/* IP protocol */
21 #define ETHERTYPE_ARP	0x0806		/* Addr. resolution protocol */
22 
23 /*
24  * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
25  * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
26  * by an ETHER type (as given above) and then the (variable-length) header.
27  */
28 #define	ETHERTYPE_TRAIL		0x1000		/* Trailer packet */
29 #define	ETHERTYPE_NTRAILER	16
30 
31 #define	ETHERMTU	1500
32 #define	ETHERMIN	(60-14)
33 
34 /*
35  * Ethernet Address Resolution Protocol.
36  *
37  * See RFC 826 for protocol description.  Structure below is adapted
38  * to resolving internet addresses.  Field names used correspond to
39  * RFC 826.
40  */
41 struct	ether_arp {
42 	struct	arphdr ea_hdr;	/* fixed-size header */
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 #define	arp_hrd	ea_hdr.ar_hrd
49 #define	arp_pro	ea_hdr.ar_pro
50 #define	arp_hln	ea_hdr.ar_hln
51 #define	arp_pln	ea_hdr.ar_pln
52 #define	arp_op	ea_hdr.ar_op
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 struct llinfo_arp {
78 	struct	llinfo_arp *la_next;
79 	struct	llinfo_arp *la_prev;
80 	struct	rtentry *la_rt;
81 	struct	mbuf *la_hold;		/* last packet until resolved/timeout */
82 	long	la_asked;		/* last time we QUERIED for this addr */
83 #define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */
84 };
85 
86 struct sockaddr_inarp {
87 	u_char	sin_len;
88 	u_char	sin_family;
89 	u_short sin_port;
90 	struct	in_addr sin_addr;
91 	struct	in_addr sin_srcaddr;
92 	u_short	sin_tos;
93 	u_short	sin_other;
94 #define SIN_PROXY 1
95 };
96 
97 #ifdef	KERNEL
98 u_char	etherbroadcastaddr[6];
99 struct	llinfo_arp *arptnew();
100 struct	llinfo_arp llinfo_arp;		/* head of the llinfo queue */
101 int	ether_output(), ether_input(), arp_rtrequest();
102 char	*ether_sprintf();
103 struct	ifqueue arpintrq;
104 #endif
105