de-errno
[dragonfly.git] / contrib / tcpdump-3.8.3 / llc.h
1 /*
2  * Copyright (c) 1993, 1994, 1997
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that: (1) source code distributions
7  * retain the above copyright notice and this paragraph in its entirety, (2)
8  * distributions including binary code include the above copyright notice and
9  * this paragraph in its entirety in the documentation or other materials
10  * provided with the distribution, and (3) all advertising materials mentioning
11  * features or use of this software display the following acknowledgement:
12  * ``This product includes software developed by the University of California,
13  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14  * the University nor the names of its contributors may be used to endorse
15  * or promote products derived from this software without specific prior
16  * written permission.
17  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.16 2002/12/11 07:13:54 guy Exp $ (LBL)
22  */
23
24 /*
25  * This stuff should come from a system header file, but there's no
26  * obviously portable way to do that and it's not really going
27  * to change from system to system.
28  */
29
30 /*
31  * A somewhat abstracted view of the LLC header
32  */
33
34 struct llc {
35         u_int8_t dsap;
36         u_int8_t ssap;
37         union {
38                 u_int8_t u_ctl;
39                 u_int16_t is_ctl;
40                 struct {
41                         u_int8_t snap_ui;
42                         u_int8_t snap_pi[5];
43                 } snap;
44                 struct {
45                         u_int8_t snap_ui;
46                         u_int8_t snap_orgcode[3];
47                         u_int8_t snap_ethertype[2];
48                 } snap_ether;
49         } ctl;
50 };
51
52 #define llcui           ctl.snap.snap_ui
53 #define llcpi           ctl.snap.snap_pi
54 #define llc_orgcode     ctl.snap_ether.snap_orgcode
55 #define llc_ethertype   ctl.snap_ether.snap_ethertype
56 #define llcis           ctl.is_ctl
57 #define llcu            ctl.u_ctl
58
59 #define LLC_U_FMT       3
60 #define LLC_GSAP        1
61 #define LLC_S_FMT       1
62
63 #define LLC_U_POLL      0x10
64 #define LLC_IS_POLL     0x0100
65 #define LLC_XID_FI      0x81
66
67 #define LLC_U_CMD(u)    ((u) & 0xef)
68 #define LLC_UI          0x03
69 #define LLC_UA          0x63
70 #define LLC_DISC        0x43
71 #define LLC_DM          0x0f
72 #define LLC_SABME       0x6f
73 #define LLC_TEST        0xe3
74 #define LLC_XID         0xaf
75 #define LLC_FRMR        0x87
76
77 #define LLC_S_CMD(is)   (((is) >> 1) & 0x03)
78 #define LLC_RR          0x0001
79 #define LLC_RNR         0x0005
80 #define LLC_REJ         0x0009
81
82 #define LLC_IS_NR(is)   (((is) >> 9) & 0x7f)
83 #define LLC_I_NS(is)    (((is) >> 1) & 0x7f)
84
85 #ifndef LLCSAP_NULL
86 #define LLCSAP_NULL             0x00
87 #endif
88 #ifndef LLCSAP_GLOBAL
89 #define LLCSAP_GLOBAL           0xff
90 #endif
91 #ifndef LLCSAP_8021B_I
92 #define LLCSAP_8021B_I          0x02
93 #endif
94 #ifndef LLCSAP_8021B_G
95 #define LLCSAP_8021B_G          0x03
96 #endif
97 #ifndef LLCSAP_IP
98 #define LLCSAP_IP               0x06
99 #endif
100 #ifndef LLCSAP_PROWAYNM
101 #define LLCSAP_PROWAYNM         0x0e
102 #endif
103 #ifndef LLCSAP_8021D
104 #define LLCSAP_8021D            0x42
105 #endif
106 #ifndef LLCSAP_RS511
107 #define LLCSAP_RS511            0x4e
108 #endif
109 #ifndef LLCSAP_ISO8208
110 #define LLCSAP_ISO8208          0x7e
111 #endif
112 #ifndef LLCSAP_PROWAY
113 #define LLCSAP_PROWAY           0x8e
114 #endif
115 #ifndef LLCSAP_SNAP
116 #define LLCSAP_SNAP             0xaa
117 #endif
118 #ifndef LLCSAP_IPX
119 #define LLCSAP_IPX              0xe0
120 #endif
121 #ifndef LLCSAP_NETBEUI
122 #define LLCSAP_NETBEUI          0xf0
123 #endif
124 #ifndef LLCSAP_ISONS
125 #define LLCSAP_ISONS            0xfe
126 #endif
127
128 #define OUI_ENCAP_ETHER 0x000000        /* encapsulated Ethernet */
129 #define OUI_CISCO       0x00000c        /* Cisco protocols */
130 #define OUI_CISCO_90    0x0000f8        /* Cisco bridging */
131 #define OUI_RFC2684     0x0080c2        /* RFC 2684 bridged Ethernet */
132 #define OUI_APPLETALK   0x080007        /* Appletalk */
133
134 /*
135  * PIDs for use with OUI_CISCO.
136  */
137 #define PID_CISCO_CDP           0x2000  /* Cisco Discovery Protocol */
138
139 /*
140  * PIDs for use with OUI_RFC2684.
141  */
142 #define PID_RFC2684_ETH_FCS     0x0001  /* Ethernet, with FCS */
143 #define PID_RFC2684_ETH_NOFCS   0x0007  /* Ethernet, without FCS */
144 #define PID_RFC2684_802_4_FCS   0x0002  /* 802.4, with FCS */
145 #define PID_RFC2684_802_4_NOFCS 0x0008  /* 802.4, without FCS */
146 #define PID_RFC2684_802_5_FCS   0x0003  /* 802.5, with FCS */
147 #define PID_RFC2684_802_5_NOFCS 0x0009  /* 802.5, without FCS */
148 #define PID_RFC2684_FDDI_FCS    0x0004  /* FDDI, with FCS */
149 #define PID_RFC2684_FDDI_NOFCS  0x000a  /* FDDI, without FCS */
150 #define PID_RFC2684_802_6_FCS   0x0005  /* 802.6, with FCS */
151 #define PID_RFC2684_802_6_NOFCS 0x000b  /* 802.6, without FCS */
152 #define PID_RFC2684_BPDU        0x000e  /* BPDUs */
153