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