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.
13 * Original code by Hannes Gredler (hannes@juniper.net)
14 * Support for LMP service discovery extensions (defined by UNI 1.0) added
15 * by Manu Pathak (mapathak@cisco.com), May 2005
19 static const char rcsid
[] _U_
=
20 "@(#) $Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.5.2.4 2006/06/23 02:07:27 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
42 * 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 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 * | Vers | (Reserved) | Flags | Msg Type |
45 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46 * | LMP Length | (Reserved) |
47 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
50 struct lmp_common_header
{
51 u_int8_t version_res
[2];
59 #define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
61 static const struct tok lmp_header_flag_values
[] = {
62 { 0x01, "Control Channel Down"},
63 { 0x02, "LMP restart"},
67 static const struct tok lmp_obj_te_link_flag_values
[] = {
68 { 0x01, "Fault Management Supported"},
69 { 0x02, "Link Verification Supported"},
73 static const struct tok lmp_obj_data_link_flag_values
[] = {
74 { 0x01, "Data Link Port"},
75 { 0x02, "Allocated for user traffic"},
76 { 0x04, "Failed link"},
80 static const struct tok lmp_obj_channel_status_values
[] = {
82 { 2, "Signal Degraded"},
87 static const struct tok lmp_obj_begin_verify_flag_values
[] = {
88 { 0x0001, "Verify all links"},
89 { 0x0002, "Data link type"},
93 static const struct tok lmp_obj_begin_verify_error_values
[] = {
94 { 0x01, "\n\t\tLink Verification Procedure Not supported"},
95 { 0x02, "\n\t\tUnwilling to verify"},
96 { 0x04, "\n\t\tUnsupported verification transport mechanism"},
97 { 0x08, "\n\t\tLink_Id configuration error"},
98 { 0x10, "\n\t\tUnknown object c-type"},
102 static const struct tok lmp_obj_link_summary_error_values
[] = {
103 { 0x01, "\n\t\tUnacceptable non-negotiable LINK_SUMMARY parameters"},
104 { 0x02, "\n\t\tRenegotiate LINK_SUMMARY parameters"},
105 { 0x04, "\n\t\tInvalid TE-LINK Object"},
106 { 0x08, "\n\t\tInvalid DATA-LINK Object"},
107 { 0x10, "\n\t\tUnknown TE-LINK Object c-type"},
108 { 0x20, "\n\t\tUnknown DATA-LINK Object c-type"},
112 /* Service Config Supported Protocols Flags */
113 static const struct tok lmp_obj_service_config_sp_flag_values
[] = {
114 { 0x01, "RSVP Supported"},
115 { 0x02, "LDP Supported"},
119 /* Service Config Client Port Service Attribute Transparency Flags */
120 static const struct tok lmp_obj_service_config_cpsa_tp_flag_values
[] = {
121 { 0x01, "Path/VC Overhead Transparency Supported"},
122 { 0x02, "Line/MS Overhead Transparency Supported"},
123 { 0x04, "Section/RS Overhead Transparency Supported"},
127 /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
128 static const struct tok lmp_obj_service_config_cpsa_cct_flag_values
[] = {
129 { 0x01, "Contiguous Concatenation Types Supported"},
133 /* Service Config Network Service Attributes Transparency Flags */
134 static const struct tok lmp_obj_service_config_nsa_transparency_flag_values
[] = {
135 { 0x01, "Standard SOH/RSOH Transparency Supported"},
136 { 0x02, "Standard LOH/MSOH Transparency Supported"},
140 /* Service Config Network Service Attributes TCM Monitoring Flags */
141 static const struct tok lmp_obj_service_config_nsa_tcm_flag_values
[] = {
142 { 0x01, "Transparent Tandem Connection Monitoring Supported"},
146 /* Network Service Attributes Network Diversity Flags */
147 static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values
[] = {
148 { 0x01, "Node Diversity Supported"},
149 { 0x02, "Link Diversity Supported"},
150 { 0x04, "SRLG Diversity Supported"},
154 #define LMP_MSGTYPE_CONFIG 1
155 #define LMP_MSGTYPE_CONFIG_ACK 2
156 #define LMP_MSGTYPE_CONFIG_NACK 3
157 #define LMP_MSGTYPE_HELLO 4
158 #define LMP_MSGTYPE_VERIFY_BEGIN 5
159 #define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
160 #define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
161 #define LMP_MSGTYPE_VERIFY_END 8
162 #define LMP_MSGTYPE_VERIFY_END_ACK 9
163 #define LMP_MSGTYPE_TEST 10
164 #define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
165 #define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
166 #define LMP_MSGTYPE_TEST_STATUS_ACK 13
167 #define LMP_MSGTYPE_LINK_SUMMARY 14
168 #define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
169 #define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
170 #define LMP_MSGTYPE_CHANNEL_STATUS 17
171 #define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
172 #define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
173 #define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
174 /* LMP Service Discovery message types defined by UNI 1.0 */
175 #define LMP_MSGTYPE_SERVICE_CONFIG 50
176 #define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
177 #define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
179 static const struct tok lmp_msg_type_values
[] = {
180 { LMP_MSGTYPE_CONFIG
, "Config"},
181 { LMP_MSGTYPE_CONFIG_ACK
, "Config ACK"},
182 { LMP_MSGTYPE_CONFIG_NACK
, "Config NACK"},
183 { LMP_MSGTYPE_HELLO
, "Hello"},
184 { LMP_MSGTYPE_VERIFY_BEGIN
, "Begin Verify"},
185 { LMP_MSGTYPE_VERIFY_BEGIN_ACK
, "Begin Verify ACK"},
186 { LMP_MSGTYPE_VERIFY_BEGIN_NACK
, "Begin Verify NACK"},
187 { LMP_MSGTYPE_VERIFY_END
, "End Verify"},
188 { LMP_MSGTYPE_VERIFY_END_ACK
, "End Verify ACK"},
189 { LMP_MSGTYPE_TEST
, "Test"},
190 { LMP_MSGTYPE_TEST_STATUS_SUCCESS
, "Test Status Success"},
191 { LMP_MSGTYPE_TEST_STATUS_FAILURE
, "Test Status Failure"},
192 { LMP_MSGTYPE_TEST_STATUS_ACK
, "Test Status ACK"},
193 { LMP_MSGTYPE_LINK_SUMMARY
, "Link Summary"},
194 { LMP_MSGTYPE_LINK_SUMMARY_ACK
, "Link Summary ACK"},
195 { LMP_MSGTYPE_LINK_SUMMARY_NACK
, "Link Summary NACK"},
196 { LMP_MSGTYPE_CHANNEL_STATUS
, "Channel Status"},
197 { LMP_MSGTYPE_CHANNEL_STATUS_ACK
, "Channel Status ACK"},
198 { LMP_MSGTYPE_CHANNEL_STATUS_REQ
, "Channel Status Request"},
199 { LMP_MSGTYPE_CHANNEL_STATUS_RESP
, "Channel Status Response"},
200 { LMP_MSGTYPE_SERVICE_CONFIG
, "Service Config"},
201 { LMP_MSGTYPE_SERVICE_CONFIG_ACK
, "Service Config ACK"},
202 { LMP_MSGTYPE_SERVICE_CONFIG_NACK
, "Service Config NACK"},
210 * 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 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
212 * |N| C-Type | Class | Length |
213 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
215 * // (object contents) //
217 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
220 struct lmp_object_header
{
226 #define LMP_OBJ_CC_ID 1
227 #define LMP_OBJ_NODE_ID 2
228 #define LMP_OBJ_LINK_ID 3
229 #define LMP_OBJ_INTERFACE_ID 4
230 #define LMP_OBJ_MESSAGE_ID 5
231 #define LMP_OBJ_CONFIG 6
232 #define LMP_OBJ_HELLO 7
233 #define LMP_OBJ_VERIFY_BEGIN 8
234 #define LMP_OBJ_VERIFY_BEGIN_ACK 9
235 #define LMP_OBJ_VERIFY_ID 10
236 #define LMP_OBJ_TE_LINK 11
237 #define LMP_OBJ_DATA_LINK 12
238 #define LMP_OBJ_CHANNEL_STATUS 13
239 #define LMP_OBJ_CHANNEL_STATUS_REQ 14
240 #define LMP_OBJ_ERROR_CODE 20
242 #define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
244 static const struct tok lmp_obj_values
[] = {
245 { LMP_OBJ_CC_ID
, "Control Channel ID" },
246 { LMP_OBJ_NODE_ID
, "Node ID" },
247 { LMP_OBJ_LINK_ID
, "Link ID" },
248 { LMP_OBJ_INTERFACE_ID
, "Interface ID" },
249 { LMP_OBJ_MESSAGE_ID
, "Message ID" },
250 { LMP_OBJ_CONFIG
, "Configuration" },
251 { LMP_OBJ_HELLO
, "Hello" },
252 { LMP_OBJ_VERIFY_BEGIN
, "Verify Begin" },
253 { LMP_OBJ_VERIFY_BEGIN_ACK
, "Verify Begin ACK" },
254 { LMP_OBJ_VERIFY_ID
, "Verify ID" },
255 { LMP_OBJ_TE_LINK
, "TE Link" },
256 { LMP_OBJ_DATA_LINK
, "Data Link" },
257 { LMP_OBJ_CHANNEL_STATUS
, "Channel Status" },
258 { LMP_OBJ_CHANNEL_STATUS_REQ
, "Channel Status Request" },
259 { LMP_OBJ_ERROR_CODE
, "Error Code" },
260 { LMP_OBJ_SERVICE_CONFIG
, "Service Config" },
265 #define INT_SWITCHING_TYPE_SUBOBJ 1
266 #define WAVELENGTH_SUBOBJ 2
268 static const struct tok lmp_data_link_subobj
[] = {
269 { INT_SWITCHING_TYPE_SUBOBJ
, "Interface Switching Type" },
270 { WAVELENGTH_SUBOBJ
, "Wavelength" },
274 #define LMP_CTYPE_IPV4 1
275 #define LMP_CTYPE_IPV6 2
277 #define LMP_CTYPE_LOC 1
278 #define LMP_CTYPE_RMT 2
279 #define LMP_CTYPE_UNMD 3
281 #define LMP_CTYPE_IPV4_LOC 1
282 #define LMP_CTYPE_IPV4_RMT 2
283 #define LMP_CTYPE_IPV6_LOC 3
284 #define LMP_CTYPE_IPV6_RMT 4
285 #define LMP_CTYPE_UNMD_LOC 5
286 #define LMP_CTYPE_UNMD_RMT 6
288 #define LMP_CTYPE_1 1
289 #define LMP_CTYPE_2 2
291 #define LMP_CTYPE_HELLO_CONFIG 1
292 #define LMP_CTYPE_HELLO 1
294 #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
295 #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
297 /* C-Types for Service Config Object */
298 #define LMP_CTYPE_SERVICE_CONFIG_SP 1
299 #define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
300 #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
301 #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
304 * Different link types allowed in the Client Port Service Attributes
305 * subobject defined for LMP Service Discovery in the UNI 1.0 spec
307 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
308 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
311 * the ctypes are not globally unique so for
312 * translating it to strings we build a table based
313 * on objects offsetted by the ctype
316 static const struct tok lmp_ctype_values
[] = {
317 { 256*LMP_OBJ_CC_ID
+LMP_CTYPE_LOC
, "Local" },
318 { 256*LMP_OBJ_CC_ID
+LMP_CTYPE_RMT
, "Remote" },
319 { 256*LMP_OBJ_NODE_ID
+LMP_CTYPE_LOC
, "Local" },
320 { 256*LMP_OBJ_NODE_ID
+LMP_CTYPE_RMT
, "Remote" },
321 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV4_LOC
, "IPv4 Local" },
322 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV4_RMT
, "IPv4 Remote" },
323 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV6_LOC
, "IPv6 Local" },
324 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV6_RMT
, "IPv6 Remote" },
325 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_UNMD_LOC
, "Unnumbered Local" },
326 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_UNMD_RMT
, "Unnumbered Remote" },
327 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV4_LOC
, "IPv4 Local" },
328 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV4_RMT
, "IPv4 Remote" },
329 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV6_LOC
, "IPv6 Local" },
330 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV6_RMT
, "IPv6 Remote" },
331 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_UNMD_LOC
, "Unnumbered Local" },
332 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_UNMD_RMT
, "Unnumbered Remote" },
333 { 256*LMP_OBJ_MESSAGE_ID
+LMP_CTYPE_1
, "1" },
334 { 256*LMP_OBJ_MESSAGE_ID
+LMP_CTYPE_2
, "2" },
335 { 256*LMP_OBJ_CONFIG
+LMP_CTYPE_1
, "1" },
336 { 256*LMP_OBJ_HELLO
+LMP_CTYPE_1
, "1" },
337 { 256*LMP_OBJ_VERIFY_BEGIN
+LMP_CTYPE_1
, "1" },
338 { 256*LMP_OBJ_VERIFY_BEGIN_ACK
+LMP_CTYPE_1
, "1" },
339 { 256*LMP_OBJ_VERIFY_ID
+LMP_CTYPE_1
, "1" },
340 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_IPV4
, "IPv4" },
341 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_IPV6
, "IPv6" },
342 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_UNMD
, "Unnumbered" },
343 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_IPV4
, "IPv4" },
344 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_IPV6
, "IPv6" },
345 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_UNMD
, "Unnumbered" },
346 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_IPV4
, "IPv4" },
347 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_IPV6
, "IPv6" },
348 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_UNMD
, "Unnumbered" },
349 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_IPV4
, "IPv4" },
350 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_IPV6
, "IPv6" },
351 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_UNMD
, "Unnumbered" },
352 { 256*LMP_OBJ_ERROR_CODE
+LMP_CTYPE_1
, "1" },
353 { 256*LMP_OBJ_ERROR_CODE
+LMP_CTYPE_2
, "2" },
354 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_SP
, "1" },
355 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_CPSA
, "2" },
356 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM
, "3" },
357 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY
, "4" },
362 lmp_print(register const u_char
*pptr
, register u_int len
) {
364 const struct lmp_common_header
*lmp_com_header
;
365 const struct lmp_object_header
*lmp_obj_header
;
366 const u_char
*tptr
,*obj_tptr
;
367 int tlen
,lmp_obj_len
,lmp_obj_ctype
,obj_tlen
;
369 int offset
,subobj_type
,subobj_len
,total_subobj_len
;
372 union { /* int to float conversion buffer */
378 lmp_com_header
= (const struct lmp_common_header
*)pptr
;
379 TCHECK(*lmp_com_header
);
382 * Sanity checking of the header.
384 if (LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]) != LMP_VERSION
) {
385 printf("LMP version %u packet not supported",
386 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]));
390 /* in non-verbose mode just lets print the basic Message Type*/
392 printf("LMPv%u %s Message, length: %u",
393 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]),
394 tok2str(lmp_msg_type_values
, "unknown (%u)",lmp_com_header
->msg_type
),
399 /* ok they seem to want to know everything - lets fully decode it */
401 tlen
=EXTRACT_16BITS(lmp_com_header
->length
);
403 printf("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
404 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]),
405 tok2str(lmp_msg_type_values
, "unknown, type: %u",lmp_com_header
->msg_type
),
406 bittok2str(lmp_header_flag_values
,"none",lmp_com_header
->flags
),
409 tptr
+=sizeof(const struct lmp_common_header
);
410 tlen
-=sizeof(const struct lmp_common_header
);
413 /* did we capture enough for fully decoding the object header ? */
414 if (!TTEST2(*tptr
, sizeof(struct lmp_object_header
)))
417 lmp_obj_header
= (const struct lmp_object_header
*)tptr
;
418 lmp_obj_len
=EXTRACT_16BITS(lmp_obj_header
->length
);
419 lmp_obj_ctype
=(lmp_obj_header
->ctype
)&0x7f;
421 if(lmp_obj_len
% 4 || lmp_obj_len
< 4)
424 printf("\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
425 tok2str(lmp_obj_values
,
427 lmp_obj_header
->class_num
),
428 lmp_obj_header
->class_num
,
429 tok2str(lmp_ctype_values
,
431 ((lmp_obj_header
->class_num
)<<8)+lmp_obj_ctype
),
433 (lmp_obj_header
->ctype
)&0x80 ? "" : "non-",
436 obj_tptr
=tptr
+sizeof(struct lmp_object_header
);
437 obj_tlen
=lmp_obj_len
-sizeof(struct lmp_object_header
);
439 /* did we capture enough for fully decoding the object ? */
440 if (!TTEST2(*tptr
, lmp_obj_len
))
444 switch(lmp_obj_header
->class_num
) {
447 switch(lmp_obj_ctype
) {
450 printf("\n\t Control Channel ID: %u (0x%08x)",
451 EXTRACT_32BITS(obj_tptr
),
452 EXTRACT_32BITS(obj_tptr
));
460 case LMP_OBJ_LINK_ID
:
461 case LMP_OBJ_INTERFACE_ID
:
462 switch(lmp_obj_ctype
) {
463 case LMP_CTYPE_IPV4_LOC
:
464 case LMP_CTYPE_IPV4_RMT
:
465 printf("\n\t IPv4 Link ID: %s (0x%08x)",
466 ipaddr_string(obj_tptr
),
467 EXTRACT_32BITS(obj_tptr
));
470 case LMP_CTYPE_IPV6_LOC
:
471 case LMP_CTYPE_IPV6_RMT
:
472 printf("\n\t IPv6 Link ID: %s (0x%08x)",
473 ip6addr_string(obj_tptr
),
474 EXTRACT_32BITS(obj_tptr
));
477 case LMP_CTYPE_UNMD_LOC
:
478 case LMP_CTYPE_UNMD_RMT
:
479 printf("\n\t Link ID: %u (0x%08x)",
480 EXTRACT_32BITS(obj_tptr
),
481 EXTRACT_32BITS(obj_tptr
));
488 case LMP_OBJ_MESSAGE_ID
:
489 switch(lmp_obj_ctype
) {
491 printf("\n\t Message ID: %u (0x%08x)",
492 EXTRACT_32BITS(obj_tptr
),
493 EXTRACT_32BITS(obj_tptr
));
496 printf("\n\t Message ID Ack: %u (0x%08x)",
497 EXTRACT_32BITS(obj_tptr
),
498 EXTRACT_32BITS(obj_tptr
));
505 case LMP_OBJ_NODE_ID
:
506 switch(lmp_obj_ctype
) {
509 printf("\n\t Node ID: %s (0x%08x)",
510 ipaddr_string(obj_tptr
),
511 EXTRACT_32BITS(obj_tptr
));
520 switch(lmp_obj_ctype
) {
521 case LMP_CTYPE_HELLO_CONFIG
:
522 printf("\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
523 EXTRACT_16BITS(obj_tptr
),
524 EXTRACT_16BITS(obj_tptr
+2));
533 switch(lmp_obj_ctype
) {
534 case LMP_CTYPE_HELLO
:
535 printf("\n\t TxSeqNum: %u\n\t RcvSeqNum: %u",
536 EXTRACT_32BITS(obj_tptr
),
537 EXTRACT_32BITS(obj_tptr
+4));
545 case LMP_OBJ_TE_LINK
:
546 printf("\n\t Flags: [%s]",
547 bittok2str(lmp_obj_te_link_flag_values
,
549 EXTRACT_16BITS(obj_tptr
)>>8));
551 switch(lmp_obj_ctype
) {
553 printf("\n\t Local Link-ID: %s (0x%08x) \
554 \n\t Remote Link-ID: %s (0x%08x)",
555 ipaddr_string(obj_tptr
+4),
556 EXTRACT_32BITS(obj_tptr
+4),
557 ipaddr_string(obj_tptr
+8),
558 EXTRACT_32BITS(obj_tptr
+8));
570 case LMP_OBJ_DATA_LINK
:
571 printf("\n\t Flags: [%s]",
572 bittok2str(lmp_obj_data_link_flag_values
,
574 EXTRACT_16BITS(obj_tptr
)>>8));
576 switch(lmp_obj_ctype
) {
579 printf("\n\t Local Interface ID: %s (0x%08x) \
580 \n\t Remote Interface ID: %s (0x%08x)",
581 ipaddr_string(obj_tptr
+4),
582 EXTRACT_32BITS(obj_tptr
+4),
583 ipaddr_string(obj_tptr
+8),
584 EXTRACT_32BITS(obj_tptr
+8));
586 total_subobj_len
= lmp_obj_len
- 16;
588 while (total_subobj_len
> 0 && hexdump
== FALSE
) {
589 subobj_type
= EXTRACT_16BITS(obj_tptr
+offset
)>>8;
590 subobj_len
= EXTRACT_16BITS(obj_tptr
+offset
)&0x00FF;
591 printf("\n\t Subobject, Type: %s (%u), Length: %u",
592 tok2str(lmp_data_link_subobj
,
597 switch(subobj_type
) {
598 case INT_SWITCHING_TYPE_SUBOBJ
:
599 printf("\n\t Switching Type: %s (%u)",
600 tok2str(gmpls_switch_cap_values
,
602 EXTRACT_16BITS(obj_tptr
+offset
+2)>>8),
603 EXTRACT_16BITS(obj_tptr
+offset
+2)>>8);
604 printf("\n\t Encoding Type: %s (%u)",
605 tok2str(gmpls_encoding_values
,
607 EXTRACT_16BITS(obj_tptr
+offset
+2)&0x00FF),
608 EXTRACT_16BITS(obj_tptr
+offset
+2)&0x00FF);
609 bw
.i
= EXTRACT_32BITS(obj_tptr
+offset
+4);
610 printf("\n\t Min Reservable Bandwidth: %.3f Mbps",
612 bw
.i
= EXTRACT_32BITS(obj_tptr
+offset
+8);
613 printf("\n\t Max Reservable Bandwidth: %.3f Mbps",
616 case WAVELENGTH_SUBOBJ
:
617 printf("\n\t Wavelength: %u",
618 EXTRACT_32BITS(obj_tptr
+offset
+4));
621 /* Any Unknown Subobject ==> Exit loop */
625 total_subobj_len
-=subobj_len
;
638 case LMP_OBJ_VERIFY_BEGIN
:
639 switch(lmp_obj_ctype
) {
641 printf("\n\t Flags: %s",
642 bittok2str(lmp_obj_begin_verify_flag_values
,
644 EXTRACT_16BITS(obj_tptr
)));
645 printf("\n\t Verify Interval: %u",
646 EXTRACT_16BITS(obj_tptr
+2));
647 printf("\n\t Data links: %u",
648 EXTRACT_32BITS(obj_tptr
+4));
649 printf("\n\t Encoding type: %s",
650 tok2str(gmpls_encoding_values
, "Unknown", *(obj_tptr
+8)));
651 printf("\n\t Verify Tranport Mechanism: %u (0x%x) %s",
652 EXTRACT_16BITS(obj_tptr
+10),
653 EXTRACT_16BITS(obj_tptr
+10),
654 EXTRACT_16BITS(obj_tptr
+10)&8000 ? "(Payload test messages capable)" : "");
655 bw
.i
= EXTRACT_32BITS(obj_tptr
+12);
656 printf("\n\t Transmission Rate: %.3f Mbps",bw
.f
*8/1000000);
657 printf("\n\t Wavelength: %u",
658 EXTRACT_32BITS(obj_tptr
+16));
666 case LMP_OBJ_VERIFY_BEGIN_ACK
:
667 switch(lmp_obj_ctype
) {
669 printf("\n\t Verify Dead Interval: %u \
670 \n\t Verify Transport Response: %u",
671 EXTRACT_16BITS(obj_tptr
),
672 EXTRACT_16BITS(obj_tptr
+2));
680 case LMP_OBJ_VERIFY_ID
:
681 switch(lmp_obj_ctype
) {
683 printf("\n\t Verify ID: %u",
684 EXTRACT_32BITS(obj_tptr
));
692 case LMP_OBJ_CHANNEL_STATUS
:
693 switch(lmp_obj_ctype
) {
697 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
698 while (offset
< (lmp_obj_len
-(int)sizeof(struct lmp_object_header
)) ) {
699 printf("\n\t Interface ID: %s (0x%08x)",
700 ipaddr_string(obj_tptr
+offset
),
701 EXTRACT_32BITS(obj_tptr
+offset
));
703 printf("\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr
+offset
+4)>>31) ?
704 "Allocated" : "Non-allocated",
705 (EXTRACT_32BITS(obj_tptr
+offset
+4)>>31));
707 printf("\n\t\t Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr
+offset
+4)>>30)&0x1 ?
708 "Transmit" : "Receive",
709 (EXTRACT_32BITS(obj_tptr
+offset
+4)>>30)&0x1);
711 printf("\n\t\t Channel Status: %s (%u)",
712 tok2str(lmp_obj_channel_status_values
,
714 EXTRACT_32BITS(obj_tptr
+offset
+4)&0x3FFFFFF),
715 EXTRACT_32BITS(obj_tptr
+offset
+4)&0x3FFFFFF);
727 case LMP_OBJ_CHANNEL_STATUS_REQ
:
728 switch(lmp_obj_ctype
) {
732 while (offset
< (lmp_obj_len
-(int)sizeof(struct lmp_object_header
)) ) {
733 printf("\n\t Interface ID: %s (0x%08x)",
734 ipaddr_string(obj_tptr
+offset
),
735 EXTRACT_32BITS(obj_tptr
+offset
));
747 case LMP_OBJ_ERROR_CODE
:
748 switch(lmp_obj_ctype
) {
749 case LMP_CTYPE_BEGIN_VERIFY_ERROR
:
750 printf("\n\t Error Code: %s",
751 bittok2str(lmp_obj_begin_verify_error_values
,
753 EXTRACT_32BITS(obj_tptr
)));
756 case LMP_CTYPE_LINK_SUMMARY_ERROR
:
757 printf("\n\t Error Code: %s",
758 bittok2str(lmp_obj_link_summary_error_values
,
760 EXTRACT_32BITS(obj_tptr
)));
767 case LMP_OBJ_SERVICE_CONFIG
:
768 switch (lmp_obj_ctype
) {
769 case LMP_CTYPE_SERVICE_CONFIG_SP
:
771 printf("\n\t Flags: %s",
772 bittok2str(lmp_obj_service_config_sp_flag_values
,
774 EXTRACT_16BITS(obj_tptr
)>>8));
776 printf("\n\t UNI Version: %u",
777 EXTRACT_16BITS(obj_tptr
) & 0x00FF);
781 case LMP_CTYPE_SERVICE_CONFIG_CPSA
:
783 link_type
= EXTRACT_16BITS(obj_tptr
)>>8;
785 printf("\n\t Link Type: %s (%u)",
786 tok2str(lmp_sd_service_config_cpsa_link_type_values
,
787 "Unknown", link_type
),
790 if (link_type
== LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH
) {
791 printf("\n\t Signal Type: %s (%u)",
792 tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values
,
794 EXTRACT_16BITS(obj_tptr
) & 0x00FF),
795 EXTRACT_16BITS(obj_tptr
) & 0x00FF);
798 if (link_type
== LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET
) {
799 printf("\n\t Signal Type: %s (%u)",
800 tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values
,
802 EXTRACT_16BITS(obj_tptr
) & 0x00FF),
803 EXTRACT_16BITS(obj_tptr
) & 0x00FF);
806 printf("\n\t Transparency: %s",
807 bittok2str(lmp_obj_service_config_cpsa_tp_flag_values
,
809 EXTRACT_16BITS(obj_tptr
+2)>>8));
811 printf("\n\t Contiguous Concatenation Types: %s",
812 bittok2str(lmp_obj_service_config_cpsa_cct_flag_values
,
814 EXTRACT_16BITS(obj_tptr
+2)>>8 & 0x00FF));
816 printf("\n\t Minimum NCC: %u",
817 EXTRACT_16BITS(obj_tptr
+4));
819 printf("\n\t Maximum NCC: %u",
820 EXTRACT_16BITS(obj_tptr
+6));
822 printf("\n\t Minimum NVC:%u",
823 EXTRACT_16BITS(obj_tptr
+8));
825 printf("\n\t Maximum NVC:%u",
826 EXTRACT_16BITS(obj_tptr
+10));
828 printf("\n\t Local Interface ID: %s (0x%08x)",
829 ipaddr_string(obj_tptr
+12),
830 EXTRACT_32BITS(obj_tptr
+12));
834 case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM
:
836 printf("\n\t Transparency Flags: %s",
838 lmp_obj_service_config_nsa_transparency_flag_values
,
840 EXTRACT_32BITS(obj_tptr
)));
842 printf("\n\t TCM Monitoring Flags: %s",
844 lmp_obj_service_config_nsa_tcm_flag_values
,
846 EXTRACT_16BITS(obj_tptr
+6) & 0x00FF));
850 case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY
:
852 printf("\n\t Diversity: Flags: %s",
854 lmp_obj_service_config_nsa_network_diversity_flag_values
,
856 EXTRACT_16BITS(obj_tptr
+2) & 0x00FF));
867 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
870 /* do we want to see an additionally hexdump ? */
871 if (vflag
> 1 || hexdump
==TRUE
)
872 print_unknown_data(tptr
+sizeof(sizeof(struct lmp_object_header
)),"\n\t ",
873 lmp_obj_len
-sizeof(struct lmp_object_header
));
880 printf("\n\t\t packet exceeded snapshot");