xref: /netbsd/external/bsd/tcpdump/dist/gmpls.c (revision 6550d01e)
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@juniper.net)
14  */
15 
16 #include <sys/cdefs.h>
17 #ifndef lint
18 #if 0
19 static const char rcsid[] _U_ =
20     "@(#) Header: /tcpdump/master/tcpdump/gmpls.c,v 1.7 2006-04-14 07:11:59 hannes Exp (LBL)";
21 #else
22 __RCSID("$NetBSD: gmpls.c,v 1.2 2010/12/05 05:11:30 christos Exp $");
23 #endif
24 #endif
25 
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29 
30 #include <tcpdump-stdinc.h>
31 
32 #include "interface.h"
33 #include "gmpls.h"
34 
35 /* rfc3471 */
36 const struct tok gmpls_link_prot_values[] = {
37     { 0x01, "Extra Traffic"},
38     { 0x02, "Unprotected"},
39     { 0x04, "Shared"},
40     { 0x08, "Dedicated 1:1"},
41     { 0x10, "Dedicated 1+1"},
42     { 0x20, "Enhanced"},
43     { 0x40, "Reserved"},
44     { 0x80, "Reserved"},
45     { 0, NULL }
46 };
47 
48 /* rfc3471 */
49 const struct tok gmpls_switch_cap_values[] = {
50     { GMPLS_PSC1, "Packet-Switch Capable-1"},
51     { GMPLS_PSC2, "Packet-Switch Capable-2"},
52     { GMPLS_PSC3, "Packet-Switch Capable-3"},
53     { GMPLS_PSC4, "Packet-Switch Capable-4"},
54     { GMPLS_L2SC, "Layer-2 Switch Capable"},
55     { GMPLS_TSC, "Time-Division-Multiplex"},
56     { GMPLS_LSC, "Lambda-Switch Capable"},
57     { GMPLS_FSC, "Fiber-Switch Capable"},
58     { 0, NULL }
59 };
60 
61 /* rfc4205 */
62 const struct tok gmpls_switch_cap_tsc_indication_values[] = {
63     { 0, "Standard SONET/SDH" },
64     { 1, "Arbitrary SONET/SDH" },
65     { 0, NULL }
66 };
67 
68 /* rfc3471 */
69 const struct tok gmpls_encoding_values[] = {
70     { 1,    "Packet"},
71     { 2,    "Ethernet V2/DIX"},
72     { 3,    "ANSI/ETSI PDH"},
73     { 4,    "Reserved"},
74     { 5,    "SDH ITU-T G.707/SONET ANSI T1.105"},
75     { 6,    "Reserved"},
76     { 7,    "Digital Wrapper"},
77     { 8,    "Lambda (photonic)"},
78     { 9,    "Fiber"},
79     { 10,   "Reserved"},
80     { 11,   "FiberChannel"},
81     { 0, NULL }
82 };
83 
84 /* rfc3471 */
85 const struct tok gmpls_payload_values[] = {
86     {  0,   "Unknown"},
87     {  1,   "Reserved"},
88     {  2,   "Reserved"},
89     {  3,   "Reserved"},
90     {  4,   "Reserved"},
91     {  5,   "Asynchronous mapping of E4"},
92     {  6,   "Asynchronous mapping of DS3/T3"},
93     {  7,   "Asynchronous mapping of E3"},
94     {  8,   "Bit synchronous mapping of E3"},
95     {  9,   "Byte synchronous mapping of E3"},
96     { 10,   "Asynchronous mapping of DS2/T2"},
97     { 11,   "Bit synchronous mapping of DS2/T2"},
98     { 12,   "Reserved"},
99     { 13,   "Asynchronous mapping of E1"},
100     { 14,   "Byte synchronous mapping of E1"},
101     { 15,   "Byte synchronous mapping of 31 * DS0"},
102     { 16,   "Asynchronous mapping of DS1/T1"},
103     { 17,   "Bit synchronous mapping of DS1/T1"},
104     { 18,   "Byte synchronous mapping of DS1/T1"},
105     { 19,   "VC-11 in VC-12"},
106     { 20,   "Reserved"},
107     { 21,   "Reserved"},
108     { 22,   "DS1 SF Asynchronous"},
109     { 23,   "DS1 ESF Asynchronous"},
110     { 24,   "DS3 M23 Asynchronous"},
111     { 25,   "DS3 C-Bit Parity Asynchronous"},
112     { 26,   "VT/LOVC"},
113     { 27,   "STS SPE/HOVC"},
114     { 28,   "POS - No Scrambling, 16 bit CRC"},
115     { 29,   "POS - No Scrambling, 32 bit CRC"},
116     { 30,   "POS - Scrambling, 16 bit CRC"},
117     { 31,   "POS - Scrambling, 32 bit CRC"},
118     { 32,   "ATM mapping"},
119     { 33,   "Ethernet PHY"},
120     { 34,   "SONET/SDH"},
121     { 35,   "Reserved (SONET deprecated)"},
122     { 36,   "Digital Wrapper"},
123     { 37,   "Lambda"},
124     { 38,   "ANSI/ETSI PDH"},
125     { 39,   "Reserved"},
126     { 40,   "Link Access Protocol SDH (X.85 and X.86)"},
127     { 41,   "FDDI"},
128     { 42,   "DQDB (ETSI ETS 300 216)"},
129     { 43,   "FiberChannel-3 (Services)"},
130     { 44,   "HDLC"},
131     { 45,   "Ethernet V2/DIX (only)"},
132     { 46,   "Ethernet 802.3 (only)"},
133 /* draft-ietf-ccamp-gmpls-g709-04.txt */
134     { 47,   "G.709 ODUj"},
135     { 48,   "G.709 OTUk(v)"},
136     { 49,   "CBR/CBRa"},
137     { 50,   "CBRb"},
138     { 51,   "BSOT"},
139     { 52,   "BSNT"},
140     { 53,   "IP/PPP (GFP)"},
141     { 54,   "Ethernet MAC (framed GFP)"},
142     { 55,   "Ethernet PHY (transparent GFP)"},
143     { 56,   "ESCON"},
144     { 57,   "FICON"},
145     { 58,   "Fiber Channel"},
146     { 0, NULL }
147 };
148 
149 /*
150  * Link Type values used by LMP Service Discovery (specifically, the Client
151  * Port Service Attributes Object). See UNI 1.0 section 9.4.2 for details.
152  */
153 const struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
154     { 5, "SDH ITU-T G.707"},
155     { 6, "SONET ANSI T1.105"},
156     { 0, NULL}
157 };
158 
159 /*
160  * Signal Type values for SDH links used by LMP Service Discovery (specifically,
161  * the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
162  * details.
163  */
164 const struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
165     { 5,  "VC-3"},
166     { 6,  "VC-4"},
167     { 7,  "STM-0"},
168     { 8,  "STM-1"},
169     { 9,  "STM-4"},
170     { 10, "STM-16"},
171     { 11, "STM-64"},
172     { 12, "STM-256"},
173     { 0, NULL}
174 };
175 
176 /*
177  * Signal Type values for SONET links used by LMP Service Discovery (specifically,
178  * the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
179  * details.
180  */
181 const struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
182     { 5,  "STS-1 SPE"},
183     { 6,  "STS-3c SPE"},
184     { 7,  "STS-1"},
185     { 8,  "STM-3"},
186     { 9,  "STM-12"},
187     { 10, "STM-48"},
188     { 11, "STM-192"},
189     { 12, "STM-768"},
190     { 0, NULL}
191 };
192 
193 #define DIFFSERV_BC_MODEL_RDM           0   /* draft-ietf-tewg-diff-te-proto-07 */
194 #define DIFFSERV_BC_MODEL_MAM           1   /* draft-ietf-tewg-diff-te-proto-07 */
195 #define DIFFSERV_BC_MODEL_EXTD_MAM      254 /* experimental */
196 
197 const struct tok diffserv_te_bc_values[] = {
198     {  DIFFSERV_BC_MODEL_RDM, "Russian dolls"},
199     {  DIFFSERV_BC_MODEL_MAM, "Maximum allocation"},
200     {  DIFFSERV_BC_MODEL_EXTD_MAM, "Maximum allocation with E-LSP support"},
201     { 0, NULL }
202 };
203