1180059Sjhb/*	$NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $	*/
2180059Sjhb/* $FreeBSD$ */
3180059Sjhb
4180059Sjhb/*-
5180059Sjhb * Copyright (c) 1982, 1986, 1993
6180059Sjhb *	The Regents of the University of California.  All rights reserved.
7180059Sjhb *
8180059Sjhb * Redistribution and use in source and binary forms, with or without
9180059Sjhb * modification, are permitted provided that the following conditions
10180059Sjhb * are met:
11180059Sjhb * 1. Redistributions of source code must retain the above copyright
12180059Sjhb *    notice, this list of conditions and the following disclaimer.
13180059Sjhb * 2. Redistributions in binary form must reproduce the above copyright
14180059Sjhb *    notice, this list of conditions and the following disclaimer in the
15180059Sjhb *    documentation and/or other materials provided with the distribution.
16180059Sjhb * 4. Neither the name of the University nor the names of its contributors
17180059Sjhb *    may be used to endorse or promote products derived from this software
18180059Sjhb *    without specific prior written permission.
19180059Sjhb *
20180059Sjhb * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21180059Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22180059Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23180059Sjhb * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24180059Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25180059Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26180059Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27180059Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28180059Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29180059Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30180059Sjhb * SUCH DAMAGE.
31180059Sjhb *
32180059Sjhb * from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp
33180059Sjhb *       @(#)if_ether.h	8.1 (Berkeley) 6/10/93
34180059Sjhb */
35180059Sjhb
36180059Sjhb#ifndef _NET_IF_ARC_H_
37180059Sjhb#define _NET_IF_ARC_H_
38180059Sjhb
39180059Sjhb/*
40180059Sjhb * Arcnet address - 1 octets
41180059Sjhb * don't know who uses this.
42180059Sjhb */
43180059Sjhbstruct arc_addr {
44180059Sjhb	u_int8_t  arc_addr_octet[1];
45180059Sjhb} __packed;
46180059Sjhb
47180059Sjhb/*
48180059Sjhb * Structure of a 2.5MB/s Arcnet header.
49180059Sjhb * as given to interface code.
50180059Sjhb */
51180059Sjhbstruct	arc_header {
52180059Sjhb	u_int8_t  arc_shost;
53180059Sjhb	u_int8_t  arc_dhost;
54180059Sjhb	u_int8_t  arc_type;
55180059Sjhb	/*
56180059Sjhb	 * only present for newstyle encoding with LL fragmentation.
57180059Sjhb	 * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead.
58180059Sjhb	 */
59180059Sjhb	u_int8_t  arc_flag;
60180059Sjhb	u_int16_t arc_seqid;
61180059Sjhb
62180059Sjhb	/*
63180059Sjhb	 * only present in exception packets (arc_flag == 0xff)
64180059Sjhb	 */
65180059Sjhb	u_int8_t  arc_type2;	/* same as arc_type */
66180059Sjhb	u_int8_t  arc_flag2;	/* real flag value */
67180059Sjhb	u_int16_t arc_seqid2;	/* real seqid value */
68180059Sjhb} __packed;
69180059Sjhb
70180059Sjhb#define	ARC_ADDR_LEN		1
71180059Sjhb
72180059Sjhb#define	ARC_HDRLEN		3
73180059Sjhb#define	ARC_HDRNEWLEN		6
74180059Sjhb#define	ARC_HDRNEWLEN_EXC	10
75180059Sjhb
76180059Sjhb/* these lengths are data link layer length - 2 * ARC_ADDR_LEN */
77180059Sjhb#define	ARC_MIN_LEN		1
78180059Sjhb#define	ARC_MIN_FORBID_LEN	254
79180059Sjhb#define	ARC_MAX_FORBID_LEN	256
80180059Sjhb#define	ARC_MAX_LEN		508
81180059Sjhb#define ARC_MAX_DATA		504
82180059Sjhb
83180059Sjhb/* RFC 1051 */
84180059Sjhb#define	ARCTYPE_IP_OLD		240	/* IP protocol */
85180059Sjhb#define	ARCTYPE_ARP_OLD		241	/* address resolution protocol */
86180059Sjhb
87180059Sjhb/* RFC 1201 */
88180059Sjhb#define	ARCTYPE_IP		212	/* IP protocol */
89180059Sjhb#define	ARCTYPE_ARP		213	/* address resolution protocol */
90180059Sjhb#define	ARCTYPE_REVARP		214	/* reverse addr resolution protocol */
91180059Sjhb
92180059Sjhb#define	ARCTYPE_ATALK		221	/* Appletalk */
93180059Sjhb#define	ARCTYPE_BANIAN		247	/* Banyan Vines */
94180059Sjhb#define	ARCTYPE_IPX		250	/* Novell IPX */
95180059Sjhb
96180059Sjhb#define ARCTYPE_INET6		0xc4	/* IPng */
97180059Sjhb#define ARCTYPE_DIAGNOSE	0x80	/* as per ANSI/ATA 878.1 */
98180059Sjhb
99180059Sjhb#define	ARCMTU			507
100180059Sjhb#define	ARCMIN			0
101180059Sjhb
102180059Sjhb#define ARC_PHDS_MAXMTU		60480
103180059Sjhb
104180059Sjhbstruct	arccom {
105180059Sjhb	struct	  ifnet *ac_ifp;	/* network-visible interface */
106180059Sjhb
107180059Sjhb	u_int16_t ac_seqid;		/* seq. id used by PHDS encap. */
108180059Sjhb
109180059Sjhb	u_int8_t  arc_shost;
110180059Sjhb	u_int8_t  arc_dhost;
111180059Sjhb	u_int8_t  arc_type;
112180059Sjhb
113180059Sjhb	u_int8_t  dummy0;
114180059Sjhb	u_int16_t dummy1;
115180059Sjhb	int sflag, fsflag, rsflag;
116180059Sjhb	struct mbuf *curr_frag;
117180059Sjhb
118180059Sjhb	struct ac_frag {
119180059Sjhb		u_int8_t  af_maxflag;	/* from first packet */
120180059Sjhb		u_int8_t  af_lastseen;	/* last split flag seen */
121180059Sjhb		u_int16_t af_seqid;
122180059Sjhb		struct mbuf *af_packet;
123180059Sjhb	} ac_fragtab[256];		/* indexed by sender ll address */
124180059Sjhb};
125180059Sjhb
126180059Sjhb#ifdef _KERNEL
127180059Sjhbextern u_int8_t arcbroadcastaddr;
128180059Sjhbextern int arc_ipmtu;	/* XXX new ip only, no RFC 1051! */
129
130void	arc_ifattach(struct ifnet *, u_int8_t);
131void	arc_ifdetach(struct ifnet *);
132void	arc_storelladdr(struct ifnet *, u_int8_t);
133int	arc_isphds(u_int8_t);
134void	arc_input(struct ifnet *, struct mbuf *);
135int	arc_output(struct ifnet *, struct mbuf *,
136	    struct sockaddr *, struct route *);
137int	arc_ioctl(struct ifnet *, u_long, caddr_t);
138
139void		arc_frag_init(struct ifnet *);
140struct mbuf *	arc_frag_next(struct ifnet *);
141#endif
142
143#endif /* _NET_IF_ARC_H_ */
144