print-lmp.c revision 1.3.2.1 1 1.1 christos /*
2 1.1 christos * Redistribution and use in source and binary forms, with or without
3 1.1 christos * modification, are permitted provided that: (1) source code
4 1.1 christos * distributions retain the above copyright notice and this paragraph
5 1.1 christos * in its entirety, and (2) distributions including binary code include
6 1.1 christos * the above copyright notice and this paragraph in its entirety in
7 1.1 christos * the documentation or other materials provided with the distribution.
8 1.1 christos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 1.1 christos * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 1.1 christos * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 1.1 christos * FOR A PARTICULAR PURPOSE.
12 1.1 christos *
13 1.1 christos * Original code by Hannes Gredler (hannes (at) juniper.net)
14 1.1 christos * Support for LMP service discovery extensions (defined by UNI 1.0) added
15 1.1 christos * by Manu Pathak (mapathak (at) cisco.com), May 2005
16 1.1 christos */
17 1.1 christos
18 1.3.2.1 snj /* \summary: Link Management Protocol (LMP) printer */
19 1.3.2.1 snj
20 1.3.2.1 snj /* specification: RFC 4204 */
21 1.3.2.1 snj
22 1.2 christos #include <sys/cdefs.h>
23 1.1 christos #ifndef lint
24 1.3.2.1 snj __RCSID("$NetBSD: print-lmp.c,v 1.3.2.1 2017/02/19 07:37:08 snj Exp $");
25 1.1 christos #endif
26 1.1 christos
27 1.1 christos #ifdef HAVE_CONFIG_H
28 1.1 christos #include "config.h"
29 1.1 christos #endif
30 1.1 christos
31 1.3.2.1 snj #include <netdissect-stdinc.h>
32 1.1 christos
33 1.3.2.1 snj #include "netdissect.h"
34 1.1 christos #include "extract.h"
35 1.1 christos #include "addrtoname.h"
36 1.1 christos #include "gmpls.h"
37 1.1 christos
38 1.1 christos /*
39 1.1 christos * LMP common header
40 1.1 christos *
41 1.1 christos * 0 1 2 3
42 1.1 christos * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
43 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 1.1 christos * | Vers | (Reserved) | Flags | Msg Type |
45 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46 1.1 christos * | LMP Length | (Reserved) |
47 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48 1.1 christos */
49 1.1 christos
50 1.1 christos struct lmp_common_header {
51 1.3.2.1 snj uint8_t version_res[2];
52 1.3.2.1 snj uint8_t flags;
53 1.3.2.1 snj uint8_t msg_type;
54 1.3.2.1 snj uint8_t length[2];
55 1.3.2.1 snj uint8_t reserved[2];
56 1.1 christos };
57 1.1 christos
58 1.1 christos #define LMP_VERSION 1
59 1.3.2.1 snj #define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
60 1.1 christos
61 1.1 christos static const struct tok lmp_header_flag_values[] = {
62 1.1 christos { 0x01, "Control Channel Down"},
63 1.1 christos { 0x02, "LMP restart"},
64 1.1 christos { 0, NULL}
65 1.1 christos };
66 1.1 christos
67 1.1 christos static const struct tok lmp_obj_te_link_flag_values[] = {
68 1.1 christos { 0x01, "Fault Management Supported"},
69 1.1 christos { 0x02, "Link Verification Supported"},
70 1.1 christos { 0, NULL}
71 1.1 christos };
72 1.1 christos
73 1.1 christos static const struct tok lmp_obj_data_link_flag_values[] = {
74 1.1 christos { 0x01, "Data Link Port"},
75 1.1 christos { 0x02, "Allocated for user traffic"},
76 1.1 christos { 0x04, "Failed link"},
77 1.1 christos { 0, NULL}
78 1.1 christos };
79 1.1 christos
80 1.1 christos static const struct tok lmp_obj_channel_status_values[] = {
81 1.1 christos { 1, "Signal Okay"},
82 1.1 christos { 2, "Signal Degraded"},
83 1.1 christos { 3, "Signal Fail"},
84 1.1 christos { 0, NULL}
85 1.1 christos };
86 1.1 christos
87 1.1 christos static const struct tok lmp_obj_begin_verify_flag_values[] = {
88 1.1 christos { 0x0001, "Verify all links"},
89 1.1 christos { 0x0002, "Data link type"},
90 1.1 christos { 0, NULL}
91 1.1 christos };
92 1.1 christos
93 1.1 christos static const struct tok lmp_obj_begin_verify_error_values[] = {
94 1.1 christos { 0x01, "Link Verification Procedure Not supported"},
95 1.1 christos { 0x02, "Unwilling to verify"},
96 1.1 christos { 0x04, "Unsupported verification transport mechanism"},
97 1.1 christos { 0x08, "Link-Id configuration error"},
98 1.1 christos { 0x10, "Unknown object c-type"},
99 1.1 christos { 0, NULL}
100 1.1 christos };
101 1.1 christos
102 1.1 christos static const struct tok lmp_obj_link_summary_error_values[] = {
103 1.1 christos { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
104 1.1 christos { 0x02, "Renegotiate LINK-SUMMARY parameters"},
105 1.1 christos { 0x04, "Invalid TE-LINK Object"},
106 1.1 christos { 0x08, "Invalid DATA-LINK Object"},
107 1.1 christos { 0x10, "Unknown TE-LINK Object c-type"},
108 1.1 christos { 0x20, "Unknown DATA-LINK Object c-type"},
109 1.1 christos { 0, NULL}
110 1.1 christos };
111 1.1 christos
112 1.1 christos /* Service Config Supported Protocols Flags */
113 1.1 christos static const struct tok lmp_obj_service_config_sp_flag_values[] = {
114 1.1 christos { 0x01, "RSVP Supported"},
115 1.1 christos { 0x02, "LDP Supported"},
116 1.1 christos { 0, NULL}
117 1.1 christos };
118 1.1 christos
119 1.1 christos /* Service Config Client Port Service Attribute Transparency Flags */
120 1.1 christos static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
121 1.1 christos { 0x01, "Path/VC Overhead Transparency Supported"},
122 1.1 christos { 0x02, "Line/MS Overhead Transparency Supported"},
123 1.1 christos { 0x04, "Section/RS Overhead Transparency Supported"},
124 1.1 christos { 0, NULL}
125 1.1 christos };
126 1.1 christos
127 1.1 christos /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
128 1.1 christos static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
129 1.1 christos { 0x01, "Contiguous Concatenation Types Supported"},
130 1.1 christos { 0, NULL}
131 1.1 christos };
132 1.1 christos
133 1.1 christos /* Service Config Network Service Attributes Transparency Flags */
134 1.1 christos static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
135 1.1 christos { 0x01, "Standard SOH/RSOH Transparency Supported"},
136 1.1 christos { 0x02, "Standard LOH/MSOH Transparency Supported"},
137 1.1 christos { 0, NULL}
138 1.1 christos };
139 1.1 christos
140 1.1 christos /* Service Config Network Service Attributes TCM Monitoring Flags */
141 1.1 christos static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
142 1.1 christos { 0x01, "Transparent Tandem Connection Monitoring Supported"},
143 1.1 christos { 0, NULL}
144 1.1 christos };
145 1.1 christos
146 1.1 christos /* Network Service Attributes Network Diversity Flags */
147 1.1 christos static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
148 1.1 christos { 0x01, "Node Diversity Supported"},
149 1.1 christos { 0x02, "Link Diversity Supported"},
150 1.1 christos { 0x04, "SRLG Diversity Supported"},
151 1.1 christos { 0, NULL}
152 1.1 christos };
153 1.1 christos
154 1.1 christos #define LMP_MSGTYPE_CONFIG 1
155 1.1 christos #define LMP_MSGTYPE_CONFIG_ACK 2
156 1.1 christos #define LMP_MSGTYPE_CONFIG_NACK 3
157 1.1 christos #define LMP_MSGTYPE_HELLO 4
158 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN 5
159 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
160 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
161 1.1 christos #define LMP_MSGTYPE_VERIFY_END 8
162 1.1 christos #define LMP_MSGTYPE_VERIFY_END_ACK 9
163 1.1 christos #define LMP_MSGTYPE_TEST 10
164 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
165 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
166 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_ACK 13
167 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY 14
168 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
169 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
170 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS 17
171 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
172 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
173 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
174 1.1 christos /* LMP Service Discovery message types defined by UNI 1.0 */
175 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG 50
176 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
177 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
178 1.1 christos
179 1.1 christos static const struct tok lmp_msg_type_values[] = {
180 1.1 christos { LMP_MSGTYPE_CONFIG, "Config"},
181 1.1 christos { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
182 1.1 christos { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
183 1.1 christos { LMP_MSGTYPE_HELLO, "Hello"},
184 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
185 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
186 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
187 1.1 christos { LMP_MSGTYPE_VERIFY_END, "End Verify"},
188 1.1 christos { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
189 1.1 christos { LMP_MSGTYPE_TEST, "Test"},
190 1.1 christos { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
191 1.1 christos { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
192 1.1 christos { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
193 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
194 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
195 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
196 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
197 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
198 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
199 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
200 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
201 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
202 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
203 1.1 christos { 0, NULL}
204 1.1 christos };
205 1.1 christos
206 1.3.2.1 snj /*
207 1.1 christos * LMP object header
208 1.1 christos *
209 1.1 christos * 0 1 2 3
210 1.1 christos * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
211 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
212 1.1 christos * |N| C-Type | Class | Length |
213 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
214 1.1 christos * | |
215 1.1 christos * // (object contents) //
216 1.1 christos * | |
217 1.3.2.1 snj * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
218 1.1 christos */
219 1.1 christos
220 1.1 christos struct lmp_object_header {
221 1.3.2.1 snj uint8_t ctype;
222 1.3.2.1 snj uint8_t class_num;
223 1.3.2.1 snj uint8_t length[2];
224 1.1 christos };
225 1.1 christos
226 1.1 christos #define LMP_OBJ_CC_ID 1
227 1.1 christos #define LMP_OBJ_NODE_ID 2
228 1.1 christos #define LMP_OBJ_LINK_ID 3
229 1.1 christos #define LMP_OBJ_INTERFACE_ID 4
230 1.3.2.1 snj #define LMP_OBJ_MESSAGE_ID 5
231 1.1 christos #define LMP_OBJ_CONFIG 6
232 1.1 christos #define LMP_OBJ_HELLO 7
233 1.1 christos #define LMP_OBJ_VERIFY_BEGIN 8
234 1.1 christos #define LMP_OBJ_VERIFY_BEGIN_ACK 9
235 1.1 christos #define LMP_OBJ_VERIFY_ID 10
236 1.1 christos #define LMP_OBJ_TE_LINK 11
237 1.1 christos #define LMP_OBJ_DATA_LINK 12
238 1.1 christos #define LMP_OBJ_CHANNEL_STATUS 13
239 1.1 christos #define LMP_OBJ_CHANNEL_STATUS_REQ 14
240 1.1 christos #define LMP_OBJ_ERROR_CODE 20
241 1.1 christos
242 1.1 christos #define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
243 1.1 christos
244 1.1 christos static const struct tok lmp_obj_values[] = {
245 1.1 christos { LMP_OBJ_CC_ID, "Control Channel ID" },
246 1.1 christos { LMP_OBJ_NODE_ID, "Node ID" },
247 1.1 christos { LMP_OBJ_LINK_ID, "Link ID" },
248 1.1 christos { LMP_OBJ_INTERFACE_ID, "Interface ID" },
249 1.1 christos { LMP_OBJ_MESSAGE_ID, "Message ID" },
250 1.1 christos { LMP_OBJ_CONFIG, "Configuration" },
251 1.1 christos { LMP_OBJ_HELLO, "Hello" },
252 1.1 christos { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
253 1.1 christos { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
254 1.1 christos { LMP_OBJ_VERIFY_ID, "Verify ID" },
255 1.1 christos { LMP_OBJ_TE_LINK, "TE Link" },
256 1.1 christos { LMP_OBJ_DATA_LINK, "Data Link" },
257 1.1 christos { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
258 1.1 christos { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
259 1.1 christos { LMP_OBJ_ERROR_CODE, "Error Code" },
260 1.1 christos { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
261 1.1 christos
262 1.1 christos { 0, NULL}
263 1.1 christos };
264 1.1 christos
265 1.1 christos #define INT_SWITCHING_TYPE_SUBOBJ 1
266 1.1 christos #define WAVELENGTH_SUBOBJ 2
267 1.1 christos
268 1.1 christos static const struct tok lmp_data_link_subobj[] = {
269 1.1 christos { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
270 1.1 christos { WAVELENGTH_SUBOBJ , "Wavelength" },
271 1.1 christos { 0, NULL}
272 1.1 christos };
273 1.1 christos
274 1.1 christos #define LMP_CTYPE_IPV4 1
275 1.1 christos #define LMP_CTYPE_IPV6 2
276 1.1 christos
277 1.1 christos #define LMP_CTYPE_LOC 1
278 1.1 christos #define LMP_CTYPE_RMT 2
279 1.1 christos #define LMP_CTYPE_UNMD 3
280 1.3.2.1 snj
281 1.1 christos #define LMP_CTYPE_IPV4_LOC 1
282 1.1 christos #define LMP_CTYPE_IPV4_RMT 2
283 1.1 christos #define LMP_CTYPE_IPV6_LOC 3
284 1.1 christos #define LMP_CTYPE_IPV6_RMT 4
285 1.3.2.1 snj #define LMP_CTYPE_UNMD_LOC 5
286 1.3.2.1 snj #define LMP_CTYPE_UNMD_RMT 6
287 1.1 christos
288 1.1 christos #define LMP_CTYPE_1 1
289 1.1 christos #define LMP_CTYPE_2 2
290 1.1 christos
291 1.1 christos #define LMP_CTYPE_HELLO_CONFIG 1
292 1.1 christos #define LMP_CTYPE_HELLO 1
293 1.1 christos
294 1.1 christos #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
295 1.1 christos #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
296 1.1 christos
297 1.1 christos /* C-Types for Service Config Object */
298 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_SP 1
299 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
300 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
301 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
302 1.1 christos
303 1.3.2.1 snj /*
304 1.1 christos * Different link types allowed in the Client Port Service Attributes
305 1.1 christos * subobject defined for LMP Service Discovery in the UNI 1.0 spec
306 1.1 christos */
307 1.1 christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
308 1.1 christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
309 1.1 christos
310 1.1 christos /*
311 1.1 christos * the ctypes are not globally unique so for
312 1.1 christos * translating it to strings we build a table based
313 1.1 christos * on objects offsetted by the ctype
314 1.1 christos */
315 1.1 christos
316 1.1 christos static const struct tok lmp_ctype_values[] = {
317 1.1 christos { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
318 1.1 christos { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
319 1.1 christos { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
320 1.1 christos { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
321 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
322 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
323 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
324 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
325 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
326 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
327 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
328 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
329 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
330 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
331 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
332 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
333 1.1 christos { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
334 1.1 christos { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
335 1.1 christos { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
336 1.1 christos { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
337 1.1 christos { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
338 1.1 christos { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
339 1.1 christos { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
340 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
341 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
342 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
343 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
344 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
345 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
346 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
347 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
348 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
349 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
350 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
351 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
352 1.1 christos { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
353 1.1 christos { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
354 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
355 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
356 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
357 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
358 1.1 christos { 0, NULL}
359 1.1 christos };
360 1.1 christos
361 1.1 christos void
362 1.3.2.1 snj lmp_print(netdissect_options *ndo,
363 1.3.2.1 snj register const u_char *pptr, register u_int len)
364 1.3.2.1 snj {
365 1.1 christos const struct lmp_common_header *lmp_com_header;
366 1.1 christos const struct lmp_object_header *lmp_obj_header;
367 1.1 christos const u_char *tptr,*obj_tptr;
368 1.1 christos int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
369 1.1 christos int hexdump;
370 1.1 christos int offset,subobj_type,subobj_len,total_subobj_len;
371 1.1 christos int link_type;
372 1.1 christos
373 1.1 christos union { /* int to float conversion buffer */
374 1.3.2.1 snj float f;
375 1.3.2.1 snj uint32_t i;
376 1.1 christos } bw;
377 1.1 christos
378 1.1 christos tptr=pptr;
379 1.1 christos lmp_com_header = (const struct lmp_common_header *)pptr;
380 1.3.2.1 snj ND_TCHECK(*lmp_com_header);
381 1.1 christos
382 1.1 christos /*
383 1.1 christos * Sanity checking of the header.
384 1.1 christos */
385 1.1 christos if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
386 1.3.2.1 snj ND_PRINT((ndo, "LMP version %u packet not supported",
387 1.3.2.1 snj LMP_EXTRACT_VERSION(lmp_com_header->version_res[0])));
388 1.1 christos return;
389 1.1 christos }
390 1.1 christos
391 1.1 christos /* in non-verbose mode just lets print the basic Message Type*/
392 1.3.2.1 snj if (ndo->ndo_vflag < 1) {
393 1.3.2.1 snj ND_PRINT((ndo, "LMPv%u %s Message, length: %u",
394 1.1 christos LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
395 1.1 christos tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
396 1.3.2.1 snj len));
397 1.1 christos return;
398 1.1 christos }
399 1.1 christos
400 1.1 christos /* ok they seem to want to know everything - lets fully decode it */
401 1.1 christos
402 1.1 christos tlen=EXTRACT_16BITS(lmp_com_header->length);
403 1.1 christos
404 1.3.2.1 snj ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
405 1.1 christos LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
406 1.1 christos tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
407 1.1 christos bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
408 1.3.2.1 snj tlen));
409 1.1 christos
410 1.1 christos tptr+=sizeof(const struct lmp_common_header);
411 1.1 christos tlen-=sizeof(const struct lmp_common_header);
412 1.1 christos
413 1.1 christos while(tlen>0) {
414 1.1 christos /* did we capture enough for fully decoding the object header ? */
415 1.3.2.1 snj ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
416 1.1 christos
417 1.1 christos lmp_obj_header = (const struct lmp_object_header *)tptr;
418 1.1 christos lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
419 1.1 christos lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
420 1.1 christos
421 1.1 christos if(lmp_obj_len % 4 || lmp_obj_len < 4)
422 1.1 christos return;
423 1.1 christos
424 1.3.2.1 snj ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
425 1.1 christos tok2str(lmp_obj_values,
426 1.1 christos "Unknown",
427 1.1 christos lmp_obj_header->class_num),
428 1.1 christos lmp_obj_header->class_num,
429 1.1 christos tok2str(lmp_ctype_values,
430 1.1 christos "Unknown",
431 1.1 christos ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
432 1.1 christos lmp_obj_ctype,
433 1.1 christos (lmp_obj_header->ctype)&0x80 ? "" : "non-",
434 1.3.2.1 snj lmp_obj_len));
435 1.1 christos
436 1.1 christos obj_tptr=tptr+sizeof(struct lmp_object_header);
437 1.1 christos obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
438 1.1 christos
439 1.1 christos /* did we capture enough for fully decoding the object ? */
440 1.3.2.1 snj ND_TCHECK2(*tptr, lmp_obj_len);
441 1.1 christos hexdump=FALSE;
442 1.1 christos
443 1.1 christos switch(lmp_obj_header->class_num) {
444 1.1 christos
445 1.1 christos case LMP_OBJ_CC_ID:
446 1.1 christos switch(lmp_obj_ctype) {
447 1.1 christos case LMP_CTYPE_LOC:
448 1.1 christos case LMP_CTYPE_RMT:
449 1.3.2.1 snj ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
450 1.1 christos EXTRACT_32BITS(obj_tptr),
451 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
452 1.1 christos break;
453 1.1 christos
454 1.1 christos default:
455 1.1 christos hexdump=TRUE;
456 1.1 christos }
457 1.1 christos break;
458 1.1 christos
459 1.1 christos case LMP_OBJ_LINK_ID:
460 1.1 christos case LMP_OBJ_INTERFACE_ID:
461 1.1 christos switch(lmp_obj_ctype) {
462 1.1 christos case LMP_CTYPE_IPV4_LOC:
463 1.1 christos case LMP_CTYPE_IPV4_RMT:
464 1.3.2.1 snj ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
465 1.3.2.1 snj ipaddr_string(ndo, obj_tptr),
466 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
467 1.1 christos break;
468 1.1 christos case LMP_CTYPE_IPV6_LOC:
469 1.1 christos case LMP_CTYPE_IPV6_RMT:
470 1.3.2.1 snj ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)",
471 1.3.2.1 snj ip6addr_string(ndo, obj_tptr),
472 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
473 1.1 christos break;
474 1.1 christos case LMP_CTYPE_UNMD_LOC:
475 1.1 christos case LMP_CTYPE_UNMD_RMT:
476 1.3.2.1 snj ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
477 1.1 christos EXTRACT_32BITS(obj_tptr),
478 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
479 1.1 christos break;
480 1.1 christos default:
481 1.1 christos hexdump=TRUE;
482 1.1 christos }
483 1.1 christos break;
484 1.1 christos
485 1.1 christos case LMP_OBJ_MESSAGE_ID:
486 1.1 christos switch(lmp_obj_ctype) {
487 1.1 christos case LMP_CTYPE_1:
488 1.3.2.1 snj ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
489 1.1 christos EXTRACT_32BITS(obj_tptr),
490 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
491 1.1 christos break;
492 1.1 christos case LMP_CTYPE_2:
493 1.3.2.1 snj ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
494 1.1 christos EXTRACT_32BITS(obj_tptr),
495 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
496 1.1 christos break;
497 1.1 christos default:
498 1.1 christos hexdump=TRUE;
499 1.1 christos }
500 1.1 christos break;
501 1.1 christos
502 1.1 christos case LMP_OBJ_NODE_ID:
503 1.1 christos switch(lmp_obj_ctype) {
504 1.1 christos case LMP_CTYPE_LOC:
505 1.1 christos case LMP_CTYPE_RMT:
506 1.3.2.1 snj ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
507 1.3.2.1 snj ipaddr_string(ndo, obj_tptr),
508 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
509 1.1 christos break;
510 1.1 christos
511 1.1 christos default:
512 1.1 christos hexdump=TRUE;
513 1.1 christos }
514 1.1 christos break;
515 1.1 christos
516 1.1 christos case LMP_OBJ_CONFIG:
517 1.1 christos switch(lmp_obj_ctype) {
518 1.1 christos case LMP_CTYPE_HELLO_CONFIG:
519 1.3.2.1 snj ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
520 1.1 christos EXTRACT_16BITS(obj_tptr),
521 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+2)));
522 1.1 christos break;
523 1.1 christos
524 1.1 christos default:
525 1.1 christos hexdump=TRUE;
526 1.1 christos }
527 1.1 christos break;
528 1.3.2.1 snj
529 1.1 christos case LMP_OBJ_HELLO:
530 1.1 christos switch(lmp_obj_ctype) {
531 1.1 christos case LMP_CTYPE_HELLO:
532 1.3.2.1 snj ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
533 1.1 christos EXTRACT_32BITS(obj_tptr),
534 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+4)));
535 1.1 christos break;
536 1.1 christos
537 1.1 christos default:
538 1.1 christos hexdump=TRUE;
539 1.1 christos }
540 1.3.2.1 snj break;
541 1.3.2.1 snj
542 1.1 christos case LMP_OBJ_TE_LINK:
543 1.3.2.1 snj ND_PRINT((ndo, "\n\t Flags: [%s]",
544 1.1 christos bittok2str(lmp_obj_te_link_flag_values,
545 1.1 christos "none",
546 1.3.2.1 snj EXTRACT_16BITS(obj_tptr)>>8)));
547 1.3.2.1 snj
548 1.1 christos switch(lmp_obj_ctype) {
549 1.1 christos case LMP_CTYPE_IPV4:
550 1.3.2.1 snj ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
551 1.3.2.1 snj "\n\t Remote Link-ID: %s (0x%08x)",
552 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+4),
553 1.1 christos EXTRACT_32BITS(obj_tptr+4),
554 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+8),
555 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+8)));
556 1.1 christos break;
557 1.3.2.1 snj
558 1.1 christos case LMP_CTYPE_IPV6:
559 1.1 christos case LMP_CTYPE_UNMD:
560 1.1 christos default:
561 1.1 christos hexdump=TRUE;
562 1.1 christos }
563 1.1 christos break;
564 1.3.2.1 snj
565 1.1 christos case LMP_OBJ_DATA_LINK:
566 1.3.2.1 snj ND_PRINT((ndo, "\n\t Flags: [%s]",
567 1.1 christos bittok2str(lmp_obj_data_link_flag_values,
568 1.1 christos "none",
569 1.3.2.1 snj EXTRACT_16BITS(obj_tptr)>>8)));
570 1.3.2.1 snj
571 1.1 christos switch(lmp_obj_ctype) {
572 1.1 christos case LMP_CTYPE_IPV4:
573 1.1 christos case LMP_CTYPE_UNMD:
574 1.3.2.1 snj ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
575 1.3.2.1 snj "\n\t Remote Interface ID: %s (0x%08x)",
576 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+4),
577 1.1 christos EXTRACT_32BITS(obj_tptr+4),
578 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+8),
579 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+8)));
580 1.3.2.1 snj
581 1.3.2.1 snj total_subobj_len = lmp_obj_len - 16;
582 1.1 christos offset = 12;
583 1.1 christos while (total_subobj_len > 0 && hexdump == FALSE ) {
584 1.1 christos subobj_type = EXTRACT_16BITS(obj_tptr+offset)>>8;
585 1.1 christos subobj_len = EXTRACT_16BITS(obj_tptr+offset)&0x00FF;
586 1.3.2.1 snj ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u",
587 1.1 christos tok2str(lmp_data_link_subobj,
588 1.1 christos "Unknown",
589 1.1 christos subobj_type),
590 1.1 christos subobj_type,
591 1.3.2.1 snj subobj_len));
592 1.1 christos switch(subobj_type) {
593 1.1 christos case INT_SWITCHING_TYPE_SUBOBJ:
594 1.3.2.1 snj ND_PRINT((ndo, "\n\t Switching Type: %s (%u)",
595 1.3.2.1 snj tok2str(gmpls_switch_cap_values,
596 1.3.2.1 snj "Unknown",
597 1.1 christos EXTRACT_16BITS(obj_tptr+offset+2)>>8),
598 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+offset+2)>>8));
599 1.3.2.1 snj ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)",
600 1.3.2.1 snj tok2str(gmpls_encoding_values,
601 1.3.2.1 snj "Unknown",
602 1.1 christos EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF),
603 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF));
604 1.1 christos bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
605 1.3.2.1 snj ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps",
606 1.3.2.1 snj bw.f*8/1000000));
607 1.1 christos bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
608 1.3.2.1 snj ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps",
609 1.3.2.1 snj bw.f*8/1000000));
610 1.3.2.1 snj break;
611 1.1 christos case WAVELENGTH_SUBOBJ:
612 1.3.2.1 snj ND_PRINT((ndo, "\n\t Wavelength: %u",
613 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+offset+4)));
614 1.1 christos break;
615 1.1 christos default:
616 1.1 christos /* Any Unknown Subobject ==> Exit loop */
617 1.1 christos hexdump=TRUE;
618 1.1 christos break;
619 1.1 christos }
620 1.1 christos total_subobj_len-=subobj_len;
621 1.1 christos offset+=subobj_len;
622 1.1 christos }
623 1.3.2.1 snj
624 1.1 christos break;
625 1.1 christos case LMP_CTYPE_IPV6:
626 1.1 christos default:
627 1.1 christos hexdump=TRUE;
628 1.1 christos }
629 1.3.2.1 snj break;
630 1.3.2.1 snj
631 1.1 christos case LMP_OBJ_VERIFY_BEGIN:
632 1.1 christos switch(lmp_obj_ctype) {
633 1.1 christos case LMP_CTYPE_1:
634 1.3.2.1 snj ND_PRINT((ndo, "\n\t Flags: %s",
635 1.1 christos bittok2str(lmp_obj_begin_verify_flag_values,
636 1.1 christos "none",
637 1.3.2.1 snj EXTRACT_16BITS(obj_tptr))));
638 1.3.2.1 snj ND_PRINT((ndo, "\n\t Verify Interval: %u",
639 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+2)));
640 1.3.2.1 snj ND_PRINT((ndo, "\n\t Data links: %u",
641 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+4)));
642 1.3.2.1 snj ND_PRINT((ndo, "\n\t Encoding type: %s",
643 1.3.2.1 snj tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
644 1.3.2.1 snj ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
645 1.1 christos EXTRACT_16BITS(obj_tptr+10),
646 1.1 christos EXTRACT_16BITS(obj_tptr+10),
647 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
648 1.1 christos bw.i = EXTRACT_32BITS(obj_tptr+12);
649 1.3.2.1 snj ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
650 1.3.2.1 snj ND_PRINT((ndo, "\n\t Wavelength: %u",
651 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+16)));
652 1.1 christos break;
653 1.3.2.1 snj
654 1.1 christos default:
655 1.1 christos hexdump=TRUE;
656 1.1 christos }
657 1.3.2.1 snj break;
658 1.3.2.1 snj
659 1.1 christos case LMP_OBJ_VERIFY_BEGIN_ACK:
660 1.1 christos switch(lmp_obj_ctype) {
661 1.1 christos case LMP_CTYPE_1:
662 1.3.2.1 snj ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
663 1.3.2.1 snj "\n\t Verify Transport Response: %u",
664 1.1 christos EXTRACT_16BITS(obj_tptr),
665 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+2)));
666 1.1 christos break;
667 1.3.2.1 snj
668 1.1 christos default:
669 1.1 christos hexdump=TRUE;
670 1.1 christos }
671 1.3.2.1 snj break;
672 1.3.2.1 snj
673 1.1 christos case LMP_OBJ_VERIFY_ID:
674 1.1 christos switch(lmp_obj_ctype) {
675 1.1 christos case LMP_CTYPE_1:
676 1.3.2.1 snj ND_PRINT((ndo, "\n\t Verify ID: %u",
677 1.3.2.1 snj EXTRACT_32BITS(obj_tptr)));
678 1.1 christos break;
679 1.3.2.1 snj
680 1.1 christos default:
681 1.1 christos hexdump=TRUE;
682 1.1 christos }
683 1.3.2.1 snj break;
684 1.3.2.1 snj
685 1.1 christos case LMP_OBJ_CHANNEL_STATUS:
686 1.1 christos switch(lmp_obj_ctype) {
687 1.1 christos case LMP_CTYPE_IPV4:
688 1.1 christos case LMP_CTYPE_UNMD:
689 1.1 christos offset = 0;
690 1.1 christos /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
691 1.1 christos while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
692 1.3.2.1 snj ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
693 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+offset),
694 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+offset)));
695 1.3.2.1 snj
696 1.3.2.1 snj ND_PRINT((ndo, "\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
697 1.1 christos "Allocated" : "Non-allocated",
698 1.3.2.1 snj (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
699 1.3.2.1 snj
700 1.3.2.1 snj ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
701 1.1 christos "Transmit" : "Receive",
702 1.3.2.1 snj (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
703 1.3.2.1 snj
704 1.3.2.1 snj ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
705 1.1 christos tok2str(lmp_obj_channel_status_values,
706 1.1 christos "Unknown",
707 1.1 christos EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
708 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
709 1.1 christos offset+=8;
710 1.1 christos }
711 1.1 christos break;
712 1.1 christos case LMP_CTYPE_IPV6:
713 1.1 christos default:
714 1.1 christos hexdump=TRUE;
715 1.1 christos }
716 1.3.2.1 snj break;
717 1.3.2.1 snj
718 1.1 christos case LMP_OBJ_CHANNEL_STATUS_REQ:
719 1.1 christos switch(lmp_obj_ctype) {
720 1.1 christos case LMP_CTYPE_IPV4:
721 1.1 christos case LMP_CTYPE_UNMD:
722 1.1 christos offset = 0;
723 1.1 christos while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
724 1.3.2.1 snj ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
725 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+offset),
726 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+offset)));
727 1.1 christos offset+=4;
728 1.1 christos }
729 1.1 christos break;
730 1.1 christos case LMP_CTYPE_IPV6:
731 1.1 christos default:
732 1.1 christos hexdump=TRUE;
733 1.1 christos }
734 1.3.2.1 snj break;
735 1.3.2.1 snj
736 1.1 christos case LMP_OBJ_ERROR_CODE:
737 1.1 christos switch(lmp_obj_ctype) {
738 1.1 christos case LMP_CTYPE_BEGIN_VERIFY_ERROR:
739 1.3.2.1 snj ND_PRINT((ndo, "\n\t Error Code: %s",
740 1.1 christos bittok2str(lmp_obj_begin_verify_error_values,
741 1.1 christos "none",
742 1.3.2.1 snj EXTRACT_32BITS(obj_tptr))));
743 1.1 christos break;
744 1.3.2.1 snj
745 1.1 christos case LMP_CTYPE_LINK_SUMMARY_ERROR:
746 1.3.2.1 snj ND_PRINT((ndo, "\n\t Error Code: %s",
747 1.1 christos bittok2str(lmp_obj_link_summary_error_values,
748 1.1 christos "none",
749 1.3.2.1 snj EXTRACT_32BITS(obj_tptr))));
750 1.1 christos break;
751 1.1 christos default:
752 1.1 christos hexdump=TRUE;
753 1.1 christos }
754 1.3.2.1 snj break;
755 1.1 christos
756 1.1 christos case LMP_OBJ_SERVICE_CONFIG:
757 1.1 christos switch (lmp_obj_ctype) {
758 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_SP:
759 1.3.2.1 snj
760 1.3.2.1 snj ND_PRINT((ndo, "\n\t Flags: %s",
761 1.1 christos bittok2str(lmp_obj_service_config_sp_flag_values,
762 1.3.2.1 snj "none",
763 1.3.2.1 snj EXTRACT_16BITS(obj_tptr)>>8)));
764 1.1 christos
765 1.3.2.1 snj ND_PRINT((ndo, "\n\t UNI Version: %u",
766 1.3.2.1 snj EXTRACT_16BITS(obj_tptr) & 0x00FF));
767 1.1 christos
768 1.1 christos break;
769 1.3.2.1 snj
770 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_CPSA:
771 1.3.2.1 snj
772 1.1 christos link_type = EXTRACT_16BITS(obj_tptr)>>8;
773 1.3.2.1 snj
774 1.3.2.1 snj ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
775 1.1 christos tok2str(lmp_sd_service_config_cpsa_link_type_values,
776 1.1 christos "Unknown", link_type),
777 1.3.2.1 snj link_type));
778 1.3.2.1 snj
779 1.1 christos if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH) {
780 1.3.2.1 snj ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
781 1.1 christos tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
782 1.1 christos "Unknown",
783 1.1 christos EXTRACT_16BITS(obj_tptr) & 0x00FF),
784 1.3.2.1 snj EXTRACT_16BITS(obj_tptr) & 0x00FF));
785 1.1 christos }
786 1.3.2.1 snj
787 1.1 christos if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET) {
788 1.3.2.1 snj ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
789 1.1 christos tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
790 1.1 christos "Unknown",
791 1.1 christos EXTRACT_16BITS(obj_tptr) & 0x00FF),
792 1.3.2.1 snj EXTRACT_16BITS(obj_tptr) & 0x00FF));
793 1.1 christos }
794 1.3.2.1 snj
795 1.3.2.1 snj ND_PRINT((ndo, "\n\t Transparency: %s",
796 1.1 christos bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
797 1.1 christos "none",
798 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+2)>>8)));
799 1.3.2.1 snj
800 1.3.2.1 snj ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
801 1.1 christos bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
802 1.1 christos "none",
803 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+2)>>8 & 0x00FF)));
804 1.3.2.1 snj
805 1.3.2.1 snj ND_PRINT((ndo, "\n\t Minimum NCC: %u",
806 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+4)));
807 1.3.2.1 snj
808 1.3.2.1 snj ND_PRINT((ndo, "\n\t Maximum NCC: %u",
809 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+6)));
810 1.3.2.1 snj
811 1.3.2.1 snj ND_PRINT((ndo, "\n\t Minimum NVC:%u",
812 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+8)));
813 1.3.2.1 snj
814 1.3.2.1 snj ND_PRINT((ndo, "\n\t Maximum NVC:%u",
815 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+10)));
816 1.3.2.1 snj
817 1.3.2.1 snj ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
818 1.3.2.1 snj ipaddr_string(ndo, obj_tptr+12),
819 1.3.2.1 snj EXTRACT_32BITS(obj_tptr+12)));
820 1.3.2.1 snj
821 1.1 christos break;
822 1.3.2.1 snj
823 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
824 1.3.2.1 snj
825 1.3.2.1 snj ND_PRINT((ndo, "\n\t Transparency Flags: %s",
826 1.1 christos bittok2str(
827 1.1 christos lmp_obj_service_config_nsa_transparency_flag_values,
828 1.1 christos "none",
829 1.3.2.1 snj EXTRACT_32BITS(obj_tptr))));
830 1.1 christos
831 1.3.2.1 snj ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
832 1.1 christos bittok2str(
833 1.1 christos lmp_obj_service_config_nsa_tcm_flag_values,
834 1.1 christos "none",
835 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+6) & 0x00FF)));
836 1.3.2.1 snj
837 1.1 christos break;
838 1.3.2.1 snj
839 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
840 1.3.2.1 snj
841 1.3.2.1 snj ND_PRINT((ndo, "\n\t Diversity: Flags: %s",
842 1.1 christos bittok2str(
843 1.1 christos lmp_obj_service_config_nsa_network_diversity_flag_values,
844 1.1 christos "none",
845 1.3.2.1 snj EXTRACT_16BITS(obj_tptr+2) & 0x00FF)));
846 1.1 christos break;
847 1.1 christos
848 1.1 christos default:
849 1.1 christos hexdump = TRUE;
850 1.3.2.1 snj }
851 1.1 christos
852 1.1 christos break;
853 1.1 christos
854 1.1 christos default:
855 1.3.2.1 snj if (ndo->ndo_vflag <= 1)
856 1.3.2.1 snj print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
857 1.1 christos break;
858 1.1 christos }
859 1.1 christos /* do we want to see an additionally hexdump ? */
860 1.3.2.1 snj if (ndo->ndo_vflag > 1 || hexdump==TRUE)
861 1.3.2.1 snj print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
862 1.1 christos lmp_obj_len-sizeof(struct lmp_object_header));
863 1.1 christos
864 1.1 christos tptr+=lmp_obj_len;
865 1.1 christos tlen-=lmp_obj_len;
866 1.1 christos }
867 1.1 christos return;
868 1.1 christos trunc:
869 1.3.2.1 snj ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
870 1.1 christos }
871 1.3.2.1 snj /*
872 1.3.2.1 snj * Local Variables:
873 1.3.2.1 snj * c-style: whitesmith
874 1.3.2.1 snj * c-basic-offset: 8
875 1.3.2.1 snj * End:
876 1.3.2.1 snj */
877