vendor/TCPDUMP: Import libpcap 4.99.1
[dragonfly.git] / contrib / tcpdump / gmpls.c
1 /*
2  * Redistribution and use in source and binary forms, with or without
3  * modification, are permitted provided that: (1) source code
4  * distributions retain the above copyright notice and this paragraph
5  * in its entirety, and (2) distributions including binary code include
6  * the above copyright notice and this paragraph in its entirety in
7  * the documentation or other materials provided with the distribution.
8  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11  * FOR A PARTICULAR PURPOSE.
12  *
13  * Original code by Hannes Gredler (hannes@gredler.at)
14  */
15
16 #ifdef HAVE_CONFIG_H
17 #include <config.h>
18 #endif
19
20 #include "netdissect-stdinc.h"
21
22 #include "netdissect.h"
23 #include "gmpls.h"
24
25 /* rfc3471 */
26 const struct tok gmpls_link_prot_values[] = {
27     { 0x01, "Extra Traffic"},
28     { 0x02, "Unprotected"},
29     { 0x04, "Shared"},
30     { 0x08, "Dedicated 1:1"},
31     { 0x10, "Dedicated 1+1"},
32     { 0x20, "Enhanced"},
33     { 0x40, "Reserved"},
34     { 0x80, "Reserved"},
35     { 0, NULL }
36 };
37
38 /* rfc3471 */
39 const struct tok gmpls_switch_cap_values[] = {
40     { GMPLS_PSC1, "Packet-Switch Capable-1"},
41     { GMPLS_PSC2, "Packet-Switch Capable-2"},
42     { GMPLS_PSC3, "Packet-Switch Capable-3"},
43     { GMPLS_PSC4, "Packet-Switch Capable-4"},
44     { GMPLS_L2SC, "Layer-2 Switch Capable"},
45     { GMPLS_TSC, "Time-Division-Multiplex"},
46     { GMPLS_LSC, "Lambda-Switch Capable"},
47     { GMPLS_FSC, "Fiber-Switch Capable"},
48     { 0, NULL }
49 };
50
51 /* rfc4205 */
52 const struct tok gmpls_switch_cap_tsc_indication_values[] = {
53     { 0, "Standard SONET/SDH" },
54     { 1, "Arbitrary SONET/SDH" },
55     { 0, NULL }
56 };
57
58 /* rfc3471 */
59 const struct tok gmpls_encoding_values[] = {
60     { 1,    "Packet"},
61     { 2,    "Ethernet V2/DIX"},
62     { 3,    "ANSI/ETSI PDH"},
63     { 4,    "Reserved"},
64     { 5,    "SDH ITU-T G.707/SONET ANSI T1.105"},
65     { 6,    "Reserved"},
66     { 7,    "Digital Wrapper"},
67     { 8,    "Lambda (photonic)"},
68     { 9,    "Fiber"},
69     { 10,   "Reserved"},
70     { 11,   "FiberChannel"},
71     { 0, NULL }
72 };
73
74 /* rfc3471 */
75 const struct tok gmpls_payload_values[] = {
76     {  0,   "Unknown"},
77     {  1,   "Reserved"},
78     {  2,   "Reserved"},
79     {  3,   "Reserved"},
80     {  4,   "Reserved"},
81     {  5,   "Asynchronous mapping of E4"},
82     {  6,   "Asynchronous mapping of DS3/T3"},
83     {  7,   "Asynchronous mapping of E3"},
84     {  8,   "Bit synchronous mapping of E3"},
85     {  9,   "Byte synchronous mapping of E3"},
86     { 10,   "Asynchronous mapping of DS2/T2"},
87     { 11,   "Bit synchronous mapping of DS2/T2"},
88     { 12,   "Reserved"},
89     { 13,   "Asynchronous mapping of E1"},
90     { 14,   "Byte synchronous mapping of E1"},
91     { 15,   "Byte synchronous mapping of 31 * DS0"},
92     { 16,   "Asynchronous mapping of DS1/T1"},
93     { 17,   "Bit synchronous mapping of DS1/T1"},
94     { 18,   "Byte synchronous mapping of DS1/T1"},
95     { 19,   "VC-11 in VC-12"},
96     { 20,   "Reserved"},
97     { 21,   "Reserved"},
98     { 22,   "DS1 SF Asynchronous"},
99     { 23,   "DS1 ESF Asynchronous"},
100     { 24,   "DS3 M23 Asynchronous"},
101     { 25,   "DS3 C-Bit Parity Asynchronous"},
102     { 26,   "VT/LOVC"},
103     { 27,   "STS SPE/HOVC"},
104     { 28,   "POS - No Scrambling, 16 bit CRC"},
105     { 29,   "POS - No Scrambling, 32 bit CRC"},
106     { 30,   "POS - Scrambling, 16 bit CRC"},
107     { 31,   "POS - Scrambling, 32 bit CRC"},
108     { 32,   "ATM mapping"},
109     { 33,   "Ethernet PHY"},
110     { 34,   "SONET/SDH"},
111     { 35,   "Reserved (SONET deprecated)"},
112     { 36,   "Digital Wrapper"},
113     { 37,   "Lambda"},
114     { 38,   "ANSI/ETSI PDH"},
115     { 39,   "Reserved"},
116     { 40,   "Link Access Protocol SDH (X.85 and X.86)"},
117     { 41,   "FDDI"},
118     { 42,   "DQDB (ETSI ETS 300 216)"},
119     { 43,   "FiberChannel-3 (Services)"},
120     { 44,   "HDLC"},
121     { 45,   "Ethernet V2/DIX (only)"},
122     { 46,   "Ethernet 802.3 (only)"},
123 /* draft-ietf-ccamp-gmpls-g709-04.txt */
124     { 47,   "G.709 ODUj"},
125     { 48,   "G.709 OTUk(v)"},
126     { 49,   "CBR/CBRa"},
127     { 50,   "CBRb"},
128     { 51,   "BSOT"},
129     { 52,   "BSNT"},
130     { 53,   "IP/PPP (GFP)"},
131     { 54,   "Ethernet MAC (framed GFP)"},
132     { 55,   "Ethernet PHY (transparent GFP)"},
133     { 56,   "ESCON"},
134     { 57,   "FICON"},
135     { 58,   "Fiber Channel"},
136     { 0, NULL }
137 };
138
139 /*
140  * Link Type values used by LMP Service Discovery (specifically, the Client
141  * Port Service Attributes Object). See UNI 1.0 section 9.4.2 for details.
142  */
143 const struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
144     { 5, "SDH ITU-T G.707"},
145     { 6, "SONET ANSI T1.105"},
146     { 0, NULL}
147 };
148
149 /*
150  * Signal Type values for SDH links used by LMP Service Discovery (specifically,
151  * the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
152  * details.
153  */
154 const struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
155     { 5,  "VC-3"},
156     { 6,  "VC-4"},
157     { 7,  "STM-0"},
158     { 8,  "STM-1"},
159     { 9,  "STM-4"},
160     { 10, "STM-16"},
161     { 11, "STM-64"},
162     { 12, "STM-256"},
163     { 0, NULL}
164 };
165
166 /*
167  * Signal Type values for SONET links used by LMP Service Discovery (specifically,
168  * the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
169  * details.
170  */
171 const struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
172     { 5,  "STS-1 SPE"},
173     { 6,  "STS-3c SPE"},
174     { 7,  "STS-1"},
175     { 8,  "STM-3"},
176     { 9,  "STM-12"},
177     { 10, "STM-48"},
178     { 11, "STM-192"},
179     { 12, "STM-768"},
180     { 0, NULL}
181 };
182
183 #define DIFFSERV_BC_MODEL_RDM           0   /* draft-ietf-tewg-diff-te-proto-07 */
184 #define DIFFSERV_BC_MODEL_MAM           1   /* draft-ietf-tewg-diff-te-proto-07 */
185 #define DIFFSERV_BC_MODEL_EXTD_MAM      254 /* experimental */
186
187 const struct tok diffserv_te_bc_values[] = {
188     {  DIFFSERV_BC_MODEL_RDM, "Russian dolls"},
189     {  DIFFSERV_BC_MODEL_MAM, "Maximum allocation"},
190     {  DIFFSERV_BC_MODEL_EXTD_MAM, "Maximum allocation with E-LSP support"},
191     { 0, NULL }
192 };