]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/net/if_arc.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / net / if_arc.h
1 /*      $NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $      */
2 /* $FreeBSD$ */
3
4 /*-
5  * Copyright (c) 1982, 1986, 1993
6  *      The Regents of the University of California.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 4. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp
33  *       @(#)if_ether.h 8.1 (Berkeley) 6/10/93
34  */
35
36 #ifndef _NET_IF_ARC_H_
37 #define _NET_IF_ARC_H_
38
39 /*
40  * Arcnet address - 1 octets
41  * don't know who uses this.
42  */
43 struct arc_addr {
44         u_int8_t  arc_addr_octet[1];
45 } __packed;
46
47 /*
48  * Structure of a 2.5MB/s Arcnet header.
49  * as given to interface code.
50  */
51 struct  arc_header {
52         u_int8_t  arc_shost;
53         u_int8_t  arc_dhost;
54         u_int8_t  arc_type;
55         /*
56          * only present for newstyle encoding with LL fragmentation.
57          * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead.
58          */
59         u_int8_t  arc_flag;
60         u_int16_t arc_seqid;
61
62         /*
63          * only present in exception packets (arc_flag == 0xff)
64          */
65         u_int8_t  arc_type2;    /* same as arc_type */
66         u_int8_t  arc_flag2;    /* real flag value */
67         u_int16_t arc_seqid2;   /* real seqid value */
68 } __packed;
69
70 #define ARC_ADDR_LEN            1
71
72 #define ARC_HDRLEN              3
73 #define ARC_HDRNEWLEN           6
74 #define ARC_HDRNEWLEN_EXC       10
75
76 /* these lengths are data link layer length - 2 * ARC_ADDR_LEN */
77 #define ARC_MIN_LEN             1
78 #define ARC_MIN_FORBID_LEN      254
79 #define ARC_MAX_FORBID_LEN      256
80 #define ARC_MAX_LEN             508
81 #define ARC_MAX_DATA            504
82
83 /* RFC 1051 */
84 #define ARCTYPE_IP_OLD          240     /* IP protocol */
85 #define ARCTYPE_ARP_OLD         241     /* address resolution protocol */
86
87 /* RFC 1201 */
88 #define ARCTYPE_IP              212     /* IP protocol */
89 #define ARCTYPE_ARP             213     /* address resolution protocol */
90 #define ARCTYPE_REVARP          214     /* reverse addr resolution protocol */
91
92 #define ARCTYPE_ATALK           221     /* Appletalk */
93 #define ARCTYPE_BANIAN          247     /* Banyan Vines */
94 #define ARCTYPE_IPX             250     /* Novell IPX */
95
96 #define ARCTYPE_INET6           0xc4    /* IPng */
97 #define ARCTYPE_DIAGNOSE        0x80    /* as per ANSI/ATA 878.1 */
98
99 #define ARCMTU                  507
100 #define ARCMIN                  0
101
102 #define ARC_PHDS_MAXMTU         60480
103
104 struct  arccom {
105         struct    ifnet *ac_ifp;        /* network-visible interface */
106
107         u_int16_t ac_seqid;             /* seq. id used by PHDS encap. */
108
109         u_int8_t  arc_shost;
110         u_int8_t  arc_dhost;
111         u_int8_t  arc_type;
112
113         u_int8_t  dummy0;
114         u_int16_t dummy1;
115         int sflag, fsflag, rsflag;
116         struct mbuf *curr_frag;
117
118         struct ac_frag {
119                 u_int8_t  af_maxflag;   /* from first packet */
120                 u_int8_t  af_lastseen;  /* last split flag seen */
121                 u_int16_t af_seqid;
122                 struct mbuf *af_packet;
123         } ac_fragtab[256];              /* indexed by sender ll address */
124 };
125
126 #ifdef _KERNEL
127 extern u_int8_t arcbroadcastaddr;
128 extern int arc_ipmtu;   /* XXX new ip only, no RFC 1051! */
129
130 void    arc_ifattach(struct ifnet *, u_int8_t);
131 void    arc_ifdetach(struct ifnet *);
132 void    arc_storelladdr(struct ifnet *, u_int8_t);
133 int     arc_isphds(u_int8_t);
134 void    arc_input(struct ifnet *, struct mbuf *);
135 int     arc_output(struct ifnet *, struct mbuf *,
136             struct sockaddr *, struct route *);
137 int     arc_ioctl(struct ifnet *, u_long, caddr_t);
138
139 void            arc_frag_init(struct ifnet *);
140 struct mbuf *   arc_frag_next(struct ifnet *);
141 #endif
142
143 #endif /* _NET_IF_ARC_H_ */