Drop ".i0", it is an undefined macro.
[netbsd-mini2440.git] / dist / tcpdump / token.h
blob1c98336ad683dd40e1a8934a673d510bba5a6647
1 /* $NetBSD$ */
3 /* @(#) Header: /tcpdump/master/tcpdump/token.h,v 1.6 2002/12/11 07:14:12 guy Exp (LBL) */
4 /*
5 * Copyright (c) 1998, Larry Lile
6 * All rights reserved.
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 unmodified, this list of conditions, and the following
13 * 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.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
32 #define TOKEN_HDRLEN 14
33 #define TOKEN_RING_MAC_LEN 6
34 #define ROUTING_SEGMENT_MAX 16
35 #define IS_SOURCE_ROUTED(trp) ((trp)->token_shost[0] & 0x80)
36 #define FRAME_TYPE(trp) (((trp)->token_fc & 0xC0) >> 6)
37 #define TOKEN_FC_LLC 1
39 #define BROADCAST(trp) ((ntohs((trp)->token_rcf) & 0xE000) >> 13)
40 #define RIF_LENGTH(trp) ((ntohs((trp)->token_rcf) & 0x1f00) >> 8)
41 #define DIRECTION(trp) ((ntohs((trp)->token_rcf) & 0x0080) >> 7)
42 #define LARGEST_FRAME(trp) ((ntohs((trp)->token_rcf) & 0x0070) >> 4)
43 #define RING_NUMBER(trp, x) ((ntohs((trp)->token_rseg[x]) & 0xfff0) >> 4)
44 #define BRIDGE_NUMBER(trp, x) ((ntohs((trp)->token_rseg[x]) & 0x000f))
45 #define SEGMENT_COUNT(trp) ((int)((RIF_LENGTH(trp) - 2) / 2))
47 struct token_header {
48 u_int8_t token_ac;
49 u_int8_t token_fc;
50 u_int8_t token_dhost[TOKEN_RING_MAC_LEN];
51 u_int8_t token_shost[TOKEN_RING_MAC_LEN];
52 u_int16_t token_rcf;
53 u_int16_t token_rseg[ROUTING_SEGMENT_MAX];