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