]> The Tcpdump Group git mirrors - tcpdump/commitdiff
print ATM cell payload type, do a denser hexdumping for printing location data
authorhannes <hannes>
Wed, 8 Feb 2006 16:50:16 +0000 (16:50 +0000)
committerhannes <hannes>
Wed, 8 Feb 2006 16:50:16 +0000 (16:50 +0000)
print-atm.c

index 05fca9de9ac0e2c1ace1575a0bb0cc890f686f77..4cbb475f1f2093c0e743546a58a1128e3dece5da 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.46 2006-02-08 16:18:56 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.47 2006-02-08 16:50:16 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -54,6 +54,17 @@ struct tok oam_f_values[] = {
     { 0, NULL }
 };
 
+struct tok atm_pty_values[] = {
+    { 0x0, "user data, uncongested, SDU 0" },
+    { 0x1, "user data, uncongested, SDU 1" },
+    { 0x2, "user data, congested, SDU 0" },
+    { 0x3, "user data, congested, SDU 1" },
+    { 0x4, "VCC OAM F5 flow segment" },
+    { 0x5, "VCC OAM F5 flow end-to-end" },
+    { 0x6, "Traffic Control and resource Mgmt" },
+    { 0, NULL }
+};
+
 #define OAM_CELLTYPE_FM 0x1
 #define OAM_CELLTYPE_PM 0x2
 #define OAM_CELLTYPE_AD 0x8
@@ -396,9 +407,11 @@ oam_print (const u_char *p, u_int length, u_int hec) {
     payload = (cell_header>>1)&0x7;
     clp = cell_header&0x1;
 
-    printf("%s, vpi %u, vci %u, payload %u, clp %u, length %u",
+    printf("%s, vpi %u, vci %u, payload [ %s ], clp %u, length %u",
            tok2str(oam_f_values, "OAM F5", vci),
-           vpi, vci, payload, clp, length);
+           vpi, vci,
+           tok2str(atm_pty_values, "Unknown", payload),
+           clp, length);
 
     if (!vflag) {
         return 1;
@@ -427,11 +440,15 @@ oam_print (const u_char *p, u_int length, u_int hec) {
                EXTRACT_LE_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag));
         printf("\n\tLocation-ID ");
         for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) {
-            printf("0x%02x ", oam_ptr.oam_fm_loopback->loopback_id[idx]);
+            if (idx % 2) {
+                printf("%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx]));
+            }
         }
         printf("\n\tSource-ID   ");
         for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) {
-            printf("0x%02x ", oam_ptr.oam_fm_loopback->source_id[idx]);
+            if (idx % 2) {
+                printf("%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx]));
+            }
         }
         break;
 
@@ -441,7 +458,9 @@ oam_print (const u_char *p, u_int length, u_int hec) {
         printf("\n\tFailure-type 0x%02x", oam_ptr.oam_fm_ais_rdi->failure_type);
         printf("\n\tLocation-ID ");
         for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
-            printf("0x%02x ", oam_ptr.oam_fm_ais_rdi->failure_location[idx]);
+            if (idx % 2) {
+                printf("%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx]));
+            }
         }
         break;