1 /* $NetBSD: if_token.h,v 1.15 2007/12/25 18:33:45 perry Exp $ */
4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * from: NetBSD: if_fddi.h,v 1.2 1995/08/19 04:35:28 cgd Exp
34 #ifndef _NET_IF_TOKEN_H_
35 #define _NET_IF_TOKEN_H_
37 #define ISO88025_ADDR_LEN 6
39 /* Token Ring physical header */
41 uint8_t token_ac
; /* access control field */
42 uint8_t token_fc
; /* frame control field */
43 uint8_t token_dhost
[ISO88025_ADDR_LEN
]; /* dest. address */
44 uint8_t token_shost
[ISO88025_ADDR_LEN
]; /* source address */
47 #define TOKEN_MAX_BRIDGE 8
49 /* Token Ring routing information field */
51 uint16_t tr_rcf
; /* route control field */
52 uint16_t tr_rdf
[TOKEN_MAX_BRIDGE
]; /* route-designator fields */
55 /* standard values for address control and frame control field */
59 #define TOKEN_RI_PRESENT 0x80 /* routing info present bit */
60 #define TOKEN_RCF_LEN_MASK 0x1f00
61 #define TOKEN_RCF_BROADCAST_MASK 0xe000
62 #define TOKEN_RCF_BROADCAST_ALL 0x8000 /* all routes broadcast */
63 #define TOKEN_RCF_BROADCAST_SINGLE 0xc000 /* single route broadcast */
66 * A Token-ring frame consists of
67 * header + rif + llcinfo + fcs
68 * 14 + 2 * (0 ... 9) + x + 4 octets
69 * where llcinfo contains the llcsnap header (8 octets) and the IP frame
71 /* LLC INFO (802.5PD-2) */
72 #define TOKEN_RCF_FRAME0 0x0000 /* 516 */
73 #define TOKEN_RCF_FRAME1 0x0010 /* 1500 */
74 #define TOKEN_RCF_FRAME2 0x0020 /* 2052 */
75 #define TOKEN_RCF_FRAME3 0x0030 /* 4472 */
76 #define TOKEN_RCF_FRAME4 0x0040 /* 8144 */
77 #define TOKEN_RCF_FRAME5 0x0050 /* 11407 */
78 #define TOKEN_RCF_FRAME6 0x0060 /* 17800 */
79 #define TOKEN_RCF_FRAME7 0x0070 /* 65535 */
80 #define TOKEN_RCF_FRAME_MASK 0x0070
82 #define TOKEN_RCF_DIRECTION 0x0080
85 * According to RFC 1042
87 #define IPMTU_4MBIT_MAX 4464
88 #define IPMTU_16MBIT_MAX 8188
92 * It is recommended that all implementations support IP packets
93 * of at least 2002 octets.
95 #define ISO88025_MTU 2002
98 * This assumes that route information fields are appended to
99 * existing structures like llinfo_arp and token_header
101 #define TOKEN_RIF(x) ((struct token_rif *) ((x) + 1))
104 * This is a kludge to get at the token ring mac header and the source route
105 * information after m_adj() has been used on the mbuf.
106 * Note that m is always an mbuf with a packet header.
108 #define M_TRHSTART(m) \
109 (ALIGN(((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf : &(m)->m_pktdat[0]) \
110 + sizeof (struct token_header)) - sizeof(struct token_header))
114 * XXX we need if_ethersubr.c with all these defines
116 #define tokenbroadcastaddr etherbroadcastaddr
117 #define token_ipmulticast_min ether_ipmulticast_min
118 #define token_ipmulticast_max ether_ipmulticast_max
119 #define token_sprintf ether_sprintf
121 void token_ifattach(struct ifnet
*, void *);
122 void token_ifdetach(struct ifnet
*);
125 #endif /* !_NET_IF_TOKEN_H_ */