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