184931Sfjoe/*	$NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $	*/
284931Sfjoe/* $FreeBSD$ */
384931Sfjoe
4139823Simp/*-
584931Sfjoe * Copyright (c) 1982, 1986, 1993
684931Sfjoe *	The Regents of the University of California.  All rights reserved.
784931Sfjoe *
884931Sfjoe * Redistribution and use in source and binary forms, with or without
984931Sfjoe * modification, are permitted provided that the following conditions
1084931Sfjoe * are met:
1184931Sfjoe * 1. Redistributions of source code must retain the above copyright
1284931Sfjoe *    notice, this list of conditions and the following disclaimer.
1384931Sfjoe * 2. Redistributions in binary form must reproduce the above copyright
1484931Sfjoe *    notice, this list of conditions and the following disclaimer in the
1584931Sfjoe *    documentation and/or other materials provided with the distribution.
1684931Sfjoe * 4. Neither the name of the University nor the names of its contributors
1784931Sfjoe *    may be used to endorse or promote products derived from this software
1884931Sfjoe *    without specific prior written permission.
1984931Sfjoe *
2084931Sfjoe * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2184931Sfjoe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2284931Sfjoe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2384931Sfjoe * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2484931Sfjoe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2584931Sfjoe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2684931Sfjoe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2784931Sfjoe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2884931Sfjoe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2984931Sfjoe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3084931Sfjoe * SUCH DAMAGE.
3184931Sfjoe *
3284931Sfjoe * from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp
3384931Sfjoe *       @(#)if_ether.h	8.1 (Berkeley) 6/10/93
3484931Sfjoe */
3584931Sfjoe
3684931Sfjoe#ifndef _NET_IF_ARC_H_
3784931Sfjoe#define _NET_IF_ARC_H_
3884931Sfjoe
3984931Sfjoe/*
4084931Sfjoe * Arcnet address - 1 octets
4184931Sfjoe * don't know who uses this.
4284931Sfjoe */
4384931Sfjoestruct arc_addr {
4484931Sfjoe	u_int8_t  arc_addr_octet[1];
45103842Salfred} __packed;
4684931Sfjoe
4784931Sfjoe/*
4884931Sfjoe * Structure of a 2.5MB/s Arcnet header.
4984931Sfjoe * as given to interface code.
5084931Sfjoe */
5184931Sfjoestruct	arc_header {
5284931Sfjoe	u_int8_t  arc_shost;
5384931Sfjoe	u_int8_t  arc_dhost;
5484931Sfjoe	u_int8_t  arc_type;
5584931Sfjoe	/*
5684931Sfjoe	 * only present for newstyle encoding with LL fragmentation.
5784931Sfjoe	 * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead.
5884931Sfjoe	 */
5984931Sfjoe	u_int8_t  arc_flag;
6084931Sfjoe	u_int16_t arc_seqid;
6184931Sfjoe
6284931Sfjoe	/*
6384931Sfjoe	 * only present in exception packets (arc_flag == 0xff)
6484931Sfjoe	 */
6584931Sfjoe	u_int8_t  arc_type2;	/* same as arc_type */
6684931Sfjoe	u_int8_t  arc_flag2;	/* real flag value */
6784931Sfjoe	u_int16_t arc_seqid2;	/* real seqid value */
68103842Salfred} __packed;
6984931Sfjoe
7084931Sfjoe#define	ARC_ADDR_LEN		1
7184931Sfjoe
7284931Sfjoe#define	ARC_HDRLEN		3
7384931Sfjoe#define	ARC_HDRNEWLEN		6
7484931Sfjoe#define	ARC_HDRNEWLEN_EXC	10
7584931Sfjoe
76109771Sfjoe/* these lengths are data link layer length - 2 * ARC_ADDR_LEN */
7784931Sfjoe#define	ARC_MIN_LEN		1
7884931Sfjoe#define	ARC_MIN_FORBID_LEN	254
7984931Sfjoe#define	ARC_MAX_FORBID_LEN	256
8084931Sfjoe#define	ARC_MAX_LEN		508
81109771Sfjoe#define ARC_MAX_DATA		504
8284931Sfjoe
8384931Sfjoe/* RFC 1051 */
8484931Sfjoe#define	ARCTYPE_IP_OLD		240	/* IP protocol */
8584931Sfjoe#define	ARCTYPE_ARP_OLD		241	/* address resolution protocol */
8684931Sfjoe
8784931Sfjoe/* RFC 1201 */
8884931Sfjoe#define	ARCTYPE_IP		212	/* IP protocol */
8984931Sfjoe#define	ARCTYPE_ARP		213	/* address resolution protocol */
9084931Sfjoe#define	ARCTYPE_REVARP		214	/* reverse addr resolution protocol */
9184931Sfjoe
9284931Sfjoe#define	ARCTYPE_ATALK		221	/* Appletalk */
9384931Sfjoe#define	ARCTYPE_BANIAN		247	/* Banyan Vines */
9484931Sfjoe#define	ARCTYPE_IPX		250	/* Novell IPX */
9584931Sfjoe
9684931Sfjoe#define ARCTYPE_INET6		0xc4	/* IPng */
9784931Sfjoe#define ARCTYPE_DIAGNOSE	0x80	/* as per ANSI/ATA 878.1 */
9884931Sfjoe
9984931Sfjoe#define	ARCMTU			507
10084931Sfjoe#define	ARCMIN			0
10184931Sfjoe
10284931Sfjoe#define ARC_PHDS_MAXMTU		60480
10384931Sfjoe
10484931Sfjoestruct	arccom {
105147256Sbrooks	struct	  ifnet *ac_ifp;	/* network-visible interface */
10684931Sfjoe
10784931Sfjoe	u_int16_t ac_seqid;		/* seq. id used by PHDS encap. */
10884931Sfjoe
10984931Sfjoe	u_int8_t  arc_shost;
11084931Sfjoe	u_int8_t  arc_dhost;
11184931Sfjoe	u_int8_t  arc_type;
11284931Sfjoe
11384931Sfjoe	u_int8_t  dummy0;
11484931Sfjoe	u_int16_t dummy1;
11584931Sfjoe	int sflag, fsflag, rsflag;
11684931Sfjoe	struct mbuf *curr_frag;
11784931Sfjoe
11884931Sfjoe	struct ac_frag {
11984931Sfjoe		u_int8_t  af_maxflag;	/* from first packet */
12084931Sfjoe		u_int8_t  af_lastseen;	/* last split flag seen */
12184931Sfjoe		u_int16_t af_seqid;
12284931Sfjoe		struct mbuf *af_packet;
12384931Sfjoe	} ac_fragtab[256];		/* indexed by sender ll address */
12484931Sfjoe};
12584931Sfjoe
12684931Sfjoe#ifdef _KERNEL
12784931Sfjoeextern u_int8_t arcbroadcastaddr;
12884931Sfjoeextern int arc_ipmtu;	/* XXX new ip only, no RFC 1051! */
12984931Sfjoe
13092725Salfredvoid	arc_ifattach(struct ifnet *, u_int8_t);
13192725Salfredvoid	arc_ifdetach(struct ifnet *);
13292725Salfredvoid	arc_storelladdr(struct ifnet *, u_int8_t);
133157681Srwatsonint	arc_isphds(u_int8_t);
13492725Salfredvoid	arc_input(struct ifnet *, struct mbuf *);
13592725Salfredint	arc_output(struct ifnet *, struct mbuf *,
136249925Sglebius	    const struct sockaddr *, struct route *);
137194581Srdivackyint	arc_ioctl(struct ifnet *, u_long, caddr_t);
13884931Sfjoe
13992725Salfredvoid		arc_frag_init(struct ifnet *);
14092725Salfredstruct mbuf *	arc_frag_next(struct ifnet *);
14184931Sfjoe#endif
14284931Sfjoe
14384931Sfjoe#endif /* _NET_IF_ARC_H_ */
144