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