4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
15 * Original code by Hannes Gredler (hannes@juniper.net)
16 * Support for LMP service discovery extensions (defined by UNI 1.0) added
17 * by Manu Pathak (mapathak@cisco.com), May 2005
20 #include <sys/cdefs.h>
23 static const char rcsid
[] _U_
=
24 "@(#) Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.5.2.4 2006/06/23 02:07:27 hannes Exp";
26 __RCSID("$NetBSD: tcpdump2rcsid.ex,v 1.1 2001/06/25 20:09:58 itojun Exp $");
34 #include <tcpdump-stdinc.h>
40 #include "interface.h"
42 #include "addrtoname.h"
49 * 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
50 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 * | Vers | (Reserved) | Flags | Msg Type |
52 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 * | LMP Length | (Reserved) |
54 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 struct lmp_common_header
{
58 u_int8_t version_res
[2];
66 #define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
68 static const struct tok lmp_header_flag_values
[] = {
69 { 0x01, "Control Channel Down"},
70 { 0x02, "LMP restart"},
74 static const struct tok lmp_obj_te_link_flag_values
[] = {
75 { 0x01, "Fault Management Supported"},
76 { 0x02, "Link Verification Supported"},
80 static const struct tok lmp_obj_data_link_flag_values
[] = {
81 { 0x01, "Data Link Port"},
82 { 0x02, "Allocated for user traffic"},
83 { 0x04, "Failed link"},
87 static const struct tok lmp_obj_channel_status_values
[] = {
89 { 2, "Signal Degraded"},
94 static const struct tok lmp_obj_begin_verify_flag_values
[] = {
95 { 0x0001, "Verify all links"},
96 { 0x0002, "Data link type"},
100 static const struct tok lmp_obj_begin_verify_error_values
[] = {
101 { 0x01, "\n\t\tLink Verification Procedure Not supported"},
102 { 0x02, "\n\t\tUnwilling to verify"},
103 { 0x04, "\n\t\tUnsupported verification transport mechanism"},
104 { 0x08, "\n\t\tLink_Id configuration error"},
105 { 0x10, "\n\t\tUnknown object c-type"},
109 static const struct tok lmp_obj_link_summary_error_values
[] = {
110 { 0x01, "\n\t\tUnacceptable non-negotiable LINK_SUMMARY parameters"},
111 { 0x02, "\n\t\tRenegotiate LINK_SUMMARY parameters"},
112 { 0x04, "\n\t\tInvalid TE-LINK Object"},
113 { 0x08, "\n\t\tInvalid DATA-LINK Object"},
114 { 0x10, "\n\t\tUnknown TE-LINK Object c-type"},
115 { 0x20, "\n\t\tUnknown DATA-LINK Object c-type"},
119 /* Service Config Supported Protocols Flags */
120 static const struct tok lmp_obj_service_config_sp_flag_values
[] = {
121 { 0x01, "RSVP Supported"},
122 { 0x02, "LDP Supported"},
126 /* Service Config Client Port Service Attribute Transparency Flags */
127 static const struct tok lmp_obj_service_config_cpsa_tp_flag_values
[] = {
128 { 0x01, "Path/VC Overhead Transparency Supported"},
129 { 0x02, "Line/MS Overhead Transparency Supported"},
130 { 0x04, "Section/RS Overhead Transparency Supported"},
134 /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
135 static const struct tok lmp_obj_service_config_cpsa_cct_flag_values
[] = {
136 { 0x01, "Contiguous Concatenation Types Supported"},
140 /* Service Config Network Service Attributes Transparency Flags */
141 static const struct tok lmp_obj_service_config_nsa_transparency_flag_values
[] = {
142 { 0x01, "Standard SOH/RSOH Transparency Supported"},
143 { 0x02, "Standard LOH/MSOH Transparency Supported"},
147 /* Service Config Network Service Attributes TCM Monitoring Flags */
148 static const struct tok lmp_obj_service_config_nsa_tcm_flag_values
[] = {
149 { 0x01, "Transparent Tandem Connection Monitoring Supported"},
153 /* Network Service Attributes Network Diversity Flags */
154 static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values
[] = {
155 { 0x01, "Node Diversity Supported"},
156 { 0x02, "Link Diversity Supported"},
157 { 0x04, "SRLG Diversity Supported"},
161 #define LMP_MSGTYPE_CONFIG 1
162 #define LMP_MSGTYPE_CONFIG_ACK 2
163 #define LMP_MSGTYPE_CONFIG_NACK 3
164 #define LMP_MSGTYPE_HELLO 4
165 #define LMP_MSGTYPE_VERIFY_BEGIN 5
166 #define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
167 #define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
168 #define LMP_MSGTYPE_VERIFY_END 8
169 #define LMP_MSGTYPE_VERIFY_END_ACK 9
170 #define LMP_MSGTYPE_TEST 10
171 #define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
172 #define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
173 #define LMP_MSGTYPE_TEST_STATUS_ACK 13
174 #define LMP_MSGTYPE_LINK_SUMMARY 14
175 #define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
176 #define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
177 #define LMP_MSGTYPE_CHANNEL_STATUS 17
178 #define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
179 #define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
180 #define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
181 /* LMP Service Discovery message types defined by UNI 1.0 */
182 #define LMP_MSGTYPE_SERVICE_CONFIG 50
183 #define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
184 #define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
186 static const struct tok lmp_msg_type_values
[] = {
187 { LMP_MSGTYPE_CONFIG
, "Config"},
188 { LMP_MSGTYPE_CONFIG_ACK
, "Config ACK"},
189 { LMP_MSGTYPE_CONFIG_NACK
, "Config NACK"},
190 { LMP_MSGTYPE_HELLO
, "Hello"},
191 { LMP_MSGTYPE_VERIFY_BEGIN
, "Begin Verify"},
192 { LMP_MSGTYPE_VERIFY_BEGIN_ACK
, "Begin Verify ACK"},
193 { LMP_MSGTYPE_VERIFY_BEGIN_NACK
, "Begin Verify NACK"},
194 { LMP_MSGTYPE_VERIFY_END
, "End Verify"},
195 { LMP_MSGTYPE_VERIFY_END_ACK
, "End Verify ACK"},
196 { LMP_MSGTYPE_TEST
, "Test"},
197 { LMP_MSGTYPE_TEST_STATUS_SUCCESS
, "Test Status Success"},
198 { LMP_MSGTYPE_TEST_STATUS_FAILURE
, "Test Status Failure"},
199 { LMP_MSGTYPE_TEST_STATUS_ACK
, "Test Status ACK"},
200 { LMP_MSGTYPE_LINK_SUMMARY
, "Link Summary"},
201 { LMP_MSGTYPE_LINK_SUMMARY_ACK
, "Link Summary ACK"},
202 { LMP_MSGTYPE_LINK_SUMMARY_NACK
, "Link Summary NACK"},
203 { LMP_MSGTYPE_CHANNEL_STATUS
, "Channel Status"},
204 { LMP_MSGTYPE_CHANNEL_STATUS_ACK
, "Channel Status ACK"},
205 { LMP_MSGTYPE_CHANNEL_STATUS_REQ
, "Channel Status Request"},
206 { LMP_MSGTYPE_CHANNEL_STATUS_RESP
, "Channel Status Response"},
207 { LMP_MSGTYPE_SERVICE_CONFIG
, "Service Config"},
208 { LMP_MSGTYPE_SERVICE_CONFIG_ACK
, "Service Config ACK"},
209 { LMP_MSGTYPE_SERVICE_CONFIG_NACK
, "Service Config NACK"},
217 * 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
218 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219 * |N| C-Type | Class | Length |
220 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
222 * // (object contents) //
224 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
227 struct lmp_object_header
{
233 #define LMP_OBJ_CC_ID 1
234 #define LMP_OBJ_NODE_ID 2
235 #define LMP_OBJ_LINK_ID 3
236 #define LMP_OBJ_INTERFACE_ID 4
237 #define LMP_OBJ_MESSAGE_ID 5
238 #define LMP_OBJ_CONFIG 6
239 #define LMP_OBJ_HELLO 7
240 #define LMP_OBJ_VERIFY_BEGIN 8
241 #define LMP_OBJ_VERIFY_BEGIN_ACK 9
242 #define LMP_OBJ_VERIFY_ID 10
243 #define LMP_OBJ_TE_LINK 11
244 #define LMP_OBJ_DATA_LINK 12
245 #define LMP_OBJ_CHANNEL_STATUS 13
246 #define LMP_OBJ_CHANNEL_STATUS_REQ 14
247 #define LMP_OBJ_ERROR_CODE 20
249 #define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
251 static const struct tok lmp_obj_values
[] = {
252 { LMP_OBJ_CC_ID
, "Control Channel ID" },
253 { LMP_OBJ_NODE_ID
, "Node ID" },
254 { LMP_OBJ_LINK_ID
, "Link ID" },
255 { LMP_OBJ_INTERFACE_ID
, "Interface ID" },
256 { LMP_OBJ_MESSAGE_ID
, "Message ID" },
257 { LMP_OBJ_CONFIG
, "Configuration" },
258 { LMP_OBJ_HELLO
, "Hello" },
259 { LMP_OBJ_VERIFY_BEGIN
, "Verify Begin" },
260 { LMP_OBJ_VERIFY_BEGIN_ACK
, "Verify Begin ACK" },
261 { LMP_OBJ_VERIFY_ID
, "Verify ID" },
262 { LMP_OBJ_TE_LINK
, "TE Link" },
263 { LMP_OBJ_DATA_LINK
, "Data Link" },
264 { LMP_OBJ_CHANNEL_STATUS
, "Channel Status" },
265 { LMP_OBJ_CHANNEL_STATUS_REQ
, "Channel Status Request" },
266 { LMP_OBJ_ERROR_CODE
, "Error Code" },
267 { LMP_OBJ_SERVICE_CONFIG
, "Service Config" },
272 #define INT_SWITCHING_TYPE_SUBOBJ 1
273 #define WAVELENGTH_SUBOBJ 2
275 static const struct tok lmp_data_link_subobj
[] = {
276 { INT_SWITCHING_TYPE_SUBOBJ
, "Interface Switching Type" },
277 { WAVELENGTH_SUBOBJ
, "Wavelength" },
281 #define LMP_CTYPE_IPV4 1
282 #define LMP_CTYPE_IPV6 2
284 #define LMP_CTYPE_LOC 1
285 #define LMP_CTYPE_RMT 2
286 #define LMP_CTYPE_UNMD 3
288 #define LMP_CTYPE_IPV4_LOC 1
289 #define LMP_CTYPE_IPV4_RMT 2
290 #define LMP_CTYPE_IPV6_LOC 3
291 #define LMP_CTYPE_IPV6_RMT 4
292 #define LMP_CTYPE_UNMD_LOC 5
293 #define LMP_CTYPE_UNMD_RMT 6
295 #define LMP_CTYPE_1 1
296 #define LMP_CTYPE_2 2
298 #define LMP_CTYPE_HELLO_CONFIG 1
299 #define LMP_CTYPE_HELLO 1
301 #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
302 #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
304 /* C-Types for Service Config Object */
305 #define LMP_CTYPE_SERVICE_CONFIG_SP 1
306 #define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
307 #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
308 #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
311 * Different link types allowed in the Client Port Service Attributes
312 * subobject defined for LMP Service Discovery in the UNI 1.0 spec
314 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
315 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
318 * the ctypes are not globally unique so for
319 * translating it to strings we build a table based
320 * on objects offsetted by the ctype
323 static const struct tok lmp_ctype_values
[] = {
324 { 256*LMP_OBJ_CC_ID
+LMP_CTYPE_LOC
, "Local" },
325 { 256*LMP_OBJ_CC_ID
+LMP_CTYPE_RMT
, "Remote" },
326 { 256*LMP_OBJ_NODE_ID
+LMP_CTYPE_LOC
, "Local" },
327 { 256*LMP_OBJ_NODE_ID
+LMP_CTYPE_RMT
, "Remote" },
328 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV4_LOC
, "IPv4 Local" },
329 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV4_RMT
, "IPv4 Remote" },
330 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV6_LOC
, "IPv6 Local" },
331 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV6_RMT
, "IPv6 Remote" },
332 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_UNMD_LOC
, "Unnumbered Local" },
333 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_UNMD_RMT
, "Unnumbered Remote" },
334 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV4_LOC
, "IPv4 Local" },
335 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV4_RMT
, "IPv4 Remote" },
336 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV6_LOC
, "IPv6 Local" },
337 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV6_RMT
, "IPv6 Remote" },
338 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_UNMD_LOC
, "Unnumbered Local" },
339 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_UNMD_RMT
, "Unnumbered Remote" },
340 { 256*LMP_OBJ_MESSAGE_ID
+LMP_CTYPE_1
, "1" },
341 { 256*LMP_OBJ_MESSAGE_ID
+LMP_CTYPE_2
, "2" },
342 { 256*LMP_OBJ_CONFIG
+LMP_CTYPE_1
, "1" },
343 { 256*LMP_OBJ_HELLO
+LMP_CTYPE_1
, "1" },
344 { 256*LMP_OBJ_VERIFY_BEGIN
+LMP_CTYPE_1
, "1" },
345 { 256*LMP_OBJ_VERIFY_BEGIN_ACK
+LMP_CTYPE_1
, "1" },
346 { 256*LMP_OBJ_VERIFY_ID
+LMP_CTYPE_1
, "1" },
347 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_IPV4
, "IPv4" },
348 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_IPV6
, "IPv6" },
349 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_UNMD
, "Unnumbered" },
350 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_IPV4
, "IPv4" },
351 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_IPV6
, "IPv6" },
352 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_UNMD
, "Unnumbered" },
353 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_IPV4
, "IPv4" },
354 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_IPV6
, "IPv6" },
355 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_UNMD
, "Unnumbered" },
356 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_IPV4
, "IPv4" },
357 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_IPV6
, "IPv6" },
358 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_UNMD
, "Unnumbered" },
359 { 256*LMP_OBJ_ERROR_CODE
+LMP_CTYPE_1
, "1" },
360 { 256*LMP_OBJ_ERROR_CODE
+LMP_CTYPE_2
, "2" },
361 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_SP
, "1" },
362 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_CPSA
, "2" },
363 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM
, "3" },
364 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY
, "4" },
369 lmp_print(register const u_char
*pptr
, register u_int len
) {
371 const struct lmp_common_header
*lmp_com_header
;
372 const struct lmp_object_header
*lmp_obj_header
;
373 const u_char
*tptr
,*obj_tptr
;
374 int tlen
,lmp_obj_len
,lmp_obj_ctype
,obj_tlen
;
376 int offset
,subobj_type
,subobj_len
,total_subobj_len
;
379 union { /* int to float conversion buffer */
385 lmp_com_header
= (const struct lmp_common_header
*)pptr
;
386 TCHECK(*lmp_com_header
);
389 * Sanity checking of the header.
391 if (LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]) != LMP_VERSION
) {
392 printf("LMP version %u packet not supported",
393 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]));
397 /* in non-verbose mode just lets print the basic Message Type*/
399 printf("LMPv%u %s Message, length: %u",
400 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]),
401 tok2str(lmp_msg_type_values
, "unknown (%u)",lmp_com_header
->msg_type
),
406 /* ok they seem to want to know everything - lets fully decode it */
408 tlen
=EXTRACT_16BITS(lmp_com_header
->length
);
410 printf("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
411 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]),
412 tok2str(lmp_msg_type_values
, "unknown, type: %u",lmp_com_header
->msg_type
),
413 bittok2str(lmp_header_flag_values
,"none",lmp_com_header
->flags
),
416 tptr
+=sizeof(const struct lmp_common_header
);
417 tlen
-=sizeof(const struct lmp_common_header
);
420 /* did we capture enough for fully decoding the object header ? */
421 if (!TTEST2(*tptr
, sizeof(struct lmp_object_header
)))
424 lmp_obj_header
= (const struct lmp_object_header
*)tptr
;
425 lmp_obj_len
=EXTRACT_16BITS(lmp_obj_header
->length
);
426 lmp_obj_ctype
=(lmp_obj_header
->ctype
)&0x7f;
428 if(lmp_obj_len
% 4 || lmp_obj_len
< 4)
431 printf("\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
432 tok2str(lmp_obj_values
,
434 lmp_obj_header
->class_num
),
435 lmp_obj_header
->class_num
,
436 tok2str(lmp_ctype_values
,
438 ((lmp_obj_header
->class_num
)<<8)+lmp_obj_ctype
),
440 (lmp_obj_header
->ctype
)&0x80 ? "" : "non-",
443 obj_tptr
=tptr
+sizeof(struct lmp_object_header
);
444 obj_tlen
=lmp_obj_len
-sizeof(struct lmp_object_header
);
446 /* did we capture enough for fully decoding the object ? */
447 if (!TTEST2(*tptr
, lmp_obj_len
))
451 switch(lmp_obj_header
->class_num
) {
454 switch(lmp_obj_ctype
) {
457 printf("\n\t Control Channel ID: %u (0x%08x)",
458 EXTRACT_32BITS(obj_tptr
),
459 EXTRACT_32BITS(obj_tptr
));
467 case LMP_OBJ_LINK_ID
:
468 case LMP_OBJ_INTERFACE_ID
:
469 switch(lmp_obj_ctype
) {
470 case LMP_CTYPE_IPV4_LOC
:
471 case LMP_CTYPE_IPV4_RMT
:
472 printf("\n\t IPv4 Link ID: %s (0x%08x)",
473 ipaddr_string(obj_tptr
),
474 EXTRACT_32BITS(obj_tptr
));
477 case LMP_CTYPE_IPV6_LOC
:
478 case LMP_CTYPE_IPV6_RMT
:
479 printf("\n\t IPv6 Link ID: %s (0x%08x)",
480 ip6addr_string(obj_tptr
),
481 EXTRACT_32BITS(obj_tptr
));
484 case LMP_CTYPE_UNMD_LOC
:
485 case LMP_CTYPE_UNMD_RMT
:
486 printf("\n\t Link ID: %u (0x%08x)",
487 EXTRACT_32BITS(obj_tptr
),
488 EXTRACT_32BITS(obj_tptr
));
495 case LMP_OBJ_MESSAGE_ID
:
496 switch(lmp_obj_ctype
) {
498 printf("\n\t Message ID: %u (0x%08x)",
499 EXTRACT_32BITS(obj_tptr
),
500 EXTRACT_32BITS(obj_tptr
));
503 printf("\n\t Message ID Ack: %u (0x%08x)",
504 EXTRACT_32BITS(obj_tptr
),
505 EXTRACT_32BITS(obj_tptr
));
512 case LMP_OBJ_NODE_ID
:
513 switch(lmp_obj_ctype
) {
516 printf("\n\t Node ID: %s (0x%08x)",
517 ipaddr_string(obj_tptr
),
518 EXTRACT_32BITS(obj_tptr
));
527 switch(lmp_obj_ctype
) {
528 case LMP_CTYPE_HELLO_CONFIG
:
529 printf("\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
530 EXTRACT_16BITS(obj_tptr
),
531 EXTRACT_16BITS(obj_tptr
+2));
540 switch(lmp_obj_ctype
) {
541 case LMP_CTYPE_HELLO
:
542 printf("\n\t TxSeqNum: %u\n\t RcvSeqNum: %u",
543 EXTRACT_32BITS(obj_tptr
),
544 EXTRACT_32BITS(obj_tptr
+4));
552 case LMP_OBJ_TE_LINK
:
553 printf("\n\t Flags: [%s]",
554 bittok2str(lmp_obj_te_link_flag_values
,
556 EXTRACT_16BITS(obj_tptr
)>>8));
558 switch(lmp_obj_ctype
) {
560 printf("\n\t Local Link-ID: %s (0x%08x) \
561 \n\t Remote Link-ID: %s (0x%08x)",
562 ipaddr_string(obj_tptr
+4),
563 EXTRACT_32BITS(obj_tptr
+4),
564 ipaddr_string(obj_tptr
+8),
565 EXTRACT_32BITS(obj_tptr
+8));
577 case LMP_OBJ_DATA_LINK
:
578 printf("\n\t Flags: [%s]",
579 bittok2str(lmp_obj_data_link_flag_values
,
581 EXTRACT_16BITS(obj_tptr
)>>8));
583 switch(lmp_obj_ctype
) {
586 printf("\n\t Local Interface ID: %s (0x%08x) \
587 \n\t Remote Interface ID: %s (0x%08x)",
588 ipaddr_string(obj_tptr
+4),
589 EXTRACT_32BITS(obj_tptr
+4),
590 ipaddr_string(obj_tptr
+8),
591 EXTRACT_32BITS(obj_tptr
+8));
593 total_subobj_len
= lmp_obj_len
- 16;
595 while (total_subobj_len
> 0 && hexdump
== FALSE
) {
596 subobj_type
= EXTRACT_16BITS(obj_tptr
+offset
)>>8;
597 subobj_len
= EXTRACT_16BITS(obj_tptr
+offset
)&0x00FF;
598 printf("\n\t Subobject, Type: %s (%u), Length: %u",
599 tok2str(lmp_data_link_subobj
,
604 switch(subobj_type
) {
605 case INT_SWITCHING_TYPE_SUBOBJ
:
606 printf("\n\t Switching Type: %s (%u)",
607 tok2str(gmpls_switch_cap_values
,
609 EXTRACT_16BITS(obj_tptr
+offset
+2)>>8),
610 EXTRACT_16BITS(obj_tptr
+offset
+2)>>8);
611 printf("\n\t Encoding Type: %s (%u)",
612 tok2str(gmpls_encoding_values
,
614 EXTRACT_16BITS(obj_tptr
+offset
+2)&0x00FF),
615 EXTRACT_16BITS(obj_tptr
+offset
+2)&0x00FF);
616 bw
.i
= EXTRACT_32BITS(obj_tptr
+offset
+4);
617 printf("\n\t Min Reservable Bandwidth: %.3f Mbps",
619 bw
.i
= EXTRACT_32BITS(obj_tptr
+offset
+8);
620 printf("\n\t Max Reservable Bandwidth: %.3f Mbps",
623 case WAVELENGTH_SUBOBJ
:
624 printf("\n\t Wavelength: %u",
625 EXTRACT_32BITS(obj_tptr
+offset
+4));
628 /* Any Unknown Subobject ==> Exit loop */
632 total_subobj_len
-=subobj_len
;
645 case LMP_OBJ_VERIFY_BEGIN
:
646 switch(lmp_obj_ctype
) {
648 printf("\n\t Flags: %s",
649 bittok2str(lmp_obj_begin_verify_flag_values
,
651 EXTRACT_16BITS(obj_tptr
)));
652 printf("\n\t Verify Interval: %u",
653 EXTRACT_16BITS(obj_tptr
+2));
654 printf("\n\t Data links: %u",
655 EXTRACT_32BITS(obj_tptr
+4));
656 printf("\n\t Encoding type: %s",
657 tok2str(gmpls_encoding_values
, "Unknown", *(obj_tptr
+8)));
658 printf("\n\t Verify Tranport Mechanism: %u (0x%x) %s",
659 EXTRACT_16BITS(obj_tptr
+10),
660 EXTRACT_16BITS(obj_tptr
+10),
661 EXTRACT_16BITS(obj_tptr
+10)&8000 ? "(Payload test messages capable)" : "");
662 bw
.i
= EXTRACT_32BITS(obj_tptr
+12);
663 printf("\n\t Transmission Rate: %.3f Mbps",bw
.f
*8/1000000);
664 printf("\n\t Wavelength: %u",
665 EXTRACT_32BITS(obj_tptr
+16));
673 case LMP_OBJ_VERIFY_BEGIN_ACK
:
674 switch(lmp_obj_ctype
) {
676 printf("\n\t Verify Dead Interval: %u \
677 \n\t Verify Transport Response: %u",
678 EXTRACT_16BITS(obj_tptr
),
679 EXTRACT_16BITS(obj_tptr
+2));
687 case LMP_OBJ_VERIFY_ID
:
688 switch(lmp_obj_ctype
) {
690 printf("\n\t Verify ID: %u",
691 EXTRACT_32BITS(obj_tptr
));
699 case LMP_OBJ_CHANNEL_STATUS
:
700 switch(lmp_obj_ctype
) {
704 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
705 while (offset
< (lmp_obj_len
-(int)sizeof(struct lmp_object_header
)) ) {
706 printf("\n\t Interface ID: %s (0x%08x)",
707 ipaddr_string(obj_tptr
+offset
),
708 EXTRACT_32BITS(obj_tptr
+offset
));
710 printf("\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr
+offset
+4)>>31) ?
711 "Allocated" : "Non-allocated",
712 (EXTRACT_32BITS(obj_tptr
+offset
+4)>>31));
714 printf("\n\t\t Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr
+offset
+4)>>30)&0x1 ?
715 "Transmit" : "Receive",
716 (EXTRACT_32BITS(obj_tptr
+offset
+4)>>30)&0x1);
718 printf("\n\t\t Channel Status: %s (%u)",
719 tok2str(lmp_obj_channel_status_values
,
721 EXTRACT_32BITS(obj_tptr
+offset
+4)&0x3FFFFFF),
722 EXTRACT_32BITS(obj_tptr
+offset
+4)&0x3FFFFFF);
734 case LMP_OBJ_CHANNEL_STATUS_REQ
:
735 switch(lmp_obj_ctype
) {
739 while (offset
< (lmp_obj_len
-(int)sizeof(struct lmp_object_header
)) ) {
740 printf("\n\t Interface ID: %s (0x%08x)",
741 ipaddr_string(obj_tptr
+offset
),
742 EXTRACT_32BITS(obj_tptr
+offset
));
754 case LMP_OBJ_ERROR_CODE
:
755 switch(lmp_obj_ctype
) {
756 case LMP_CTYPE_BEGIN_VERIFY_ERROR
:
757 printf("\n\t Error Code: %s",
758 bittok2str(lmp_obj_begin_verify_error_values
,
760 EXTRACT_32BITS(obj_tptr
)));
763 case LMP_CTYPE_LINK_SUMMARY_ERROR
:
764 printf("\n\t Error Code: %s",
765 bittok2str(lmp_obj_link_summary_error_values
,
767 EXTRACT_32BITS(obj_tptr
)));
774 case LMP_OBJ_SERVICE_CONFIG
:
775 switch (lmp_obj_ctype
) {
776 case LMP_CTYPE_SERVICE_CONFIG_SP
:
778 printf("\n\t Flags: %s",
779 bittok2str(lmp_obj_service_config_sp_flag_values
,
781 EXTRACT_16BITS(obj_tptr
)>>8));
783 printf("\n\t UNI Version: %u",
784 EXTRACT_16BITS(obj_tptr
) & 0x00FF);
788 case LMP_CTYPE_SERVICE_CONFIG_CPSA
:
790 link_type
= EXTRACT_16BITS(obj_tptr
)>>8;
792 printf("\n\t Link Type: %s (%u)",
793 tok2str(lmp_sd_service_config_cpsa_link_type_values
,
794 "Unknown", link_type
),
797 if (link_type
== LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH
) {
798 printf("\n\t Signal Type: %s (%u)",
799 tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values
,
801 EXTRACT_16BITS(obj_tptr
) & 0x00FF),
802 EXTRACT_16BITS(obj_tptr
) & 0x00FF);
805 if (link_type
== LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET
) {
806 printf("\n\t Signal Type: %s (%u)",
807 tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values
,
809 EXTRACT_16BITS(obj_tptr
) & 0x00FF),
810 EXTRACT_16BITS(obj_tptr
) & 0x00FF);
813 printf("\n\t Transparency: %s",
814 bittok2str(lmp_obj_service_config_cpsa_tp_flag_values
,
816 EXTRACT_16BITS(obj_tptr
+2)>>8));
818 printf("\n\t Contiguous Concatenation Types: %s",
819 bittok2str(lmp_obj_service_config_cpsa_cct_flag_values
,
821 EXTRACT_16BITS(obj_tptr
+2)>>8 & 0x00FF));
823 printf("\n\t Minimum NCC: %u",
824 EXTRACT_16BITS(obj_tptr
+4));
826 printf("\n\t Maximum NCC: %u",
827 EXTRACT_16BITS(obj_tptr
+6));
829 printf("\n\t Minimum NVC:%u",
830 EXTRACT_16BITS(obj_tptr
+8));
832 printf("\n\t Maximum NVC:%u",
833 EXTRACT_16BITS(obj_tptr
+10));
835 printf("\n\t Local Interface ID: %s (0x%08x)",
836 ipaddr_string(obj_tptr
+12),
837 EXTRACT_32BITS(obj_tptr
+12));
841 case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM
:
843 printf("\n\t Transparency Flags: %s",
845 lmp_obj_service_config_nsa_transparency_flag_values
,
847 EXTRACT_32BITS(obj_tptr
)));
849 printf("\n\t TCM Monitoring Flags: %s",
851 lmp_obj_service_config_nsa_tcm_flag_values
,
853 EXTRACT_16BITS(obj_tptr
+6) & 0x00FF));
857 case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY
:
859 printf("\n\t Diversity: Flags: %s",
861 lmp_obj_service_config_nsa_network_diversity_flag_values
,
863 EXTRACT_16BITS(obj_tptr
+2) & 0x00FF));
874 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
877 /* do we want to see an additionally hexdump ? */
878 if (vflag
> 1 || hexdump
==TRUE
)
879 print_unknown_data(tptr
+sizeof(sizeof(struct lmp_object_header
)),"\n\t ",
880 lmp_obj_len
-sizeof(struct lmp_object_header
));
887 printf("\n\t\t packet exceeded snapshot");