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