]> git.saurik.com Git - apple/network_cmds.git/blob - tcpdump.tproj/llc.h
4432514d57d4dd995a72f7e0254a6d450385fc5e
[apple/network_cmds.git] / tcpdump.tproj / llc.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License."
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 /*
25 * Copyright (c) 1993, 1994
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that: (1) source code distributions
30 * retain the above copyright notice and this paragraph in its entirety, (2)
31 * distributions including binary code include the above copyright notice and
32 * this paragraph in its entirety in the documentation or other materials
33 * provided with the distribution, and (3) all advertising materials mentioning
34 * features or use of this software display the following acknowledgement:
35 * ``This product includes software developed by the University of California,
36 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
37 * the University nor the names of its contributors may be used to endorse
38 * or promote products derived from this software without specific prior
39 * written permission.
40 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
41 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
42 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
43 *
44 * @(#) $Header: /cvs/Darwin/Commands/NeXT/network_cmds/tcpdump.tproj/llc.h,v 1.1.1.1 1999/05/02 03:58:32 wsanchez Exp $ (LBL)
45 */
46
47 /*
48 * This stuff should come from a system header file, but there's no
49 * obviously portable way to do that and it's not really going
50 * to change from system to system.
51 */
52
53 /*
54 * A somewhat abstracted view of the LLC header
55 */
56
57 struct llc {
58 u_char dsap;
59 u_char ssap;
60 union {
61 u_char u_ctl;
62 u_short is_ctl;
63 struct {
64 u_char snap_ui;
65 u_char snap_pi[5];
66 } snap;
67 struct {
68 u_char snap_ui;
69 u_char snap_orgcode[3];
70 u_char snap_ethertype[2];
71 } snap_ether;
72 } ctl;
73 };
74
75 #define llcui ctl.snap.snap_ui
76 #define llcpi ctl.snap.snap_pi
77 #define orgcode ctl.snap_ether.snap_orgcode
78 #define ethertype ctl.snap_ether.snap_ethertype
79 #define llcis ctl.is_ctl
80 #define llcu ctl.u_ctl
81
82 #define LLC_U_FMT 3
83 #define LLC_GSAP 1
84 #define LLC_S_FMT 1
85
86 #define LLC_U_POLL 0x10
87 #define LLC_IS_POLL 0x0001
88 #define LLC_XID_FI 0x81
89
90 #define LLC_U_CMD(u) ((u) & 0xef)
91 #define LLC_UI 0x03
92 #define LLC_UA 0x63
93 #define LLC_DISC 0x43
94 #define LLC_DM 0x0f
95 #define LLC_SABME 0x6f
96 #define LLC_TEST 0xe3
97 #define LLC_XID 0xaf
98 #define LLC_FRMR 0x87
99
100 #define LLC_S_CMD(is) (((is) >> 10) & 0x03)
101 #define LLC_RR 0x0100
102 #define LLC_RNR 0x0500
103 #define LLC_REJ 0x0900
104
105 #define LLC_IS_NR(is) (((is) >> 9) & 0x7f)
106 #define LLC_I_NS(is) (((is) >> 1) & 0x7f)
107
108 #ifndef LLCSAP_NULL
109 #define LLCSAP_NULL 0x00
110 #endif
111 #ifndef LLCSAP_GLOBAL
112 #define LLCSAP_GLOBAL 0xff
113 #endif
114 #ifndef LLCSAP_8021B
115 #define LLCSAP_8021B_I 0x02
116 #endif
117 #ifndef LLCSAP_8021B
118 #define LLCSAP_8021B_G 0x03
119 #endif
120 #ifndef LLCSAP_IP
121 #define LLCSAP_IP 0x06
122 #endif
123 #ifndef LLCSAP_PROWAYNM
124 #define LLCSAP_PROWAYNM 0x0e
125 #endif
126 #ifndef LLCSAP_8021D
127 #define LLCSAP_8021D 0x42
128 #endif
129 #ifndef LLCSAP_RS511
130 #define LLCSAP_RS511 0x4e
131 #endif
132 #ifndef LLCSAP_ISO8208
133 #define LLCSAP_ISO8208 0x7e
134 #endif
135 #ifndef LLCSAP_PROWAY
136 #define LLCSAP_PROWAY 0x8e
137 #endif
138 #ifndef LLCSAP_SNAP
139 #define LLCSAP_SNAP 0xaa
140 #endif
141 #ifndef LLCSAP_ISONS
142 #define LLCSAP_ISONS 0xfe
143 #endif