xref: /original-bsd/sys/netinet/if_ether.h (revision 95407d66)
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.5 (Berkeley) 06/28/90
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 #ifdef	KERNEL
78 u_char	etherbroadcastaddr[6];
79 struct	arptab *arptnew();
80 int	ether_output(), ether_input();
81 char	*ether_sprintf();
82 #endif
83