]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rx.c
From Kevin Steves: get rid of extra leading spaces.
[tcpdump] / print-rx.c
index ffaefe45d2b93e65fe3c509297ce69cd8cec0c56..b5ec2d99478f8ca4374b40a08a5c89d2c5f177cf 100644 (file)
@@ -33,8 +33,8 @@
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.34 2002-09-05 21:25:46 guy Exp $";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.37.2.1 2006-04-07 08:40:20 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -375,6 +375,7 @@ static struct tok rx_ack_reasons[] = {
        { 6,            "ping" },
        { 7,            "ping response" },
        { 8,            "delay" },
+       { 9,            "idle" },
        { 0,            NULL },
 };
 
@@ -402,7 +403,6 @@ static void rx_cache_insert(const u_char *, const struct ip *, int);
 static int     rx_cache_find(const struct rx_header *, const struct ip *,
                              int, int32_t *);
 
-static void ack_print(const u_char *, int);
 static void fs_print(const u_char *, int);
 static void fs_reply_print(const u_char *, int, int32_t);
 static void acl_print(u_char *, int, u_char *);
@@ -489,9 +489,7 @@ rx_print(register const u_char *bp, int length, int sport, int dport,
         * as well.
         */
 
-       if (rxh->type == RX_PACKET_TYPE_ACK)
-           ack_print(bp, length);
-       else if (rxh->type == RX_PACKET_TYPE_DATA &&
+       if (rxh->type == RX_PACKET_TYPE_DATA &&
            EXTRACT_32BITS(&rxh->seq) == 1 &&
            rxh->flags & RX_CLIENT_INITIATED) {
 
@@ -765,75 +763,6 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
                        printf("\""); \
                }
 
-static void
-ack_print(register const u_char *bp, int length)
-{
-        u_char nAcks;
-       int i;
-
-       if (vflag <= 1)
-               return;
-
-       if (length <= (int)sizeof(struct rx_header))
-               return;
-
-       bp += sizeof(struct rx_header);
-
-       /*
-        * Packets < firstPacket are implicitly acknowledged and may
-        * be discarded by the sender.
-        *
-        * Packets >= firstPacket+nAcks are implicitly NOT acknowledged.
-        *
-        * No packets with sequence numbers >= firstPacket should be
-        * discarded by the sender (they may thrown out at any time by
-        * the receiver)
-        */
-#define RX_ACK_REASONS "RDOXSprn"
-       /* Requested, Duplicate, Out_of_sequence, eXceeds_window, no_Space,
-        * Ping, ping_Response, No_{progress, particular_reason}.
-        */
-#if 0
-       struct rx_ackPacket {
-         u_short bufferSpace;  /* Skip! */
-         u_short maxSkew;      /* Skip! */
-         u_long  firstPacket;
-         u_long  previousPacket; /* Obsolete! */
-         u_long  serial;       /* Serial that prompted the ack, */
-         u_char  reason;       /* and the reason why. */
-         u_char  nAcks;
-         u_char  acks[RX_MAXACKS]; /* Selective acks (not a bitmap). */
-       };
-#endif
-#define RX_ACK_TYPE_NACK 0
-
-       TCHECK2(bp[0], 8);      /* bufferSpace and maxSkew */
-       bp += 4;
-       printf(" fir %u", (unsigned)EXTRACT_32BITS(bp));
-       bp += 4;
-       TCHECK2(bp[0], 8);      /* previousPacket and serial */
-       bp += 4;
-       printf(" %u", (unsigned)EXTRACT_32BITS(bp));
-       bp += 4;
-       TCHECK2(bp[0], 1);
-       printf("%c", RX_ACK_REASONS[(*bp - 1) & 07u]);
-       bp += 1;                /* reason */
-       TCHECK2(bp[0], 1);
-       nAcks = *bp;
-       bp += 1;                /* nAcks */
-
-       for (i = 0; i < nAcks; i++) {
-           TCHECK2(bp[0], 1);
-           putchar(*bp == RX_ACK_TYPE_NACK? '-' : '*');
-           bp += 1;
-       }
-
-       return;
-
-trunc:
-       printf(" [|ack]");
-}
-
 /*
  * Handle calls to the AFS file service (fs)
  */
@@ -2370,6 +2299,7 @@ rx_ack_print(register const u_char *bp, int length)
 {
        struct rx_ackPacket *rxa;
        int i, start, last;
+       u_int32_t firstPacket;
 
        if (length < (int)sizeof(struct rx_header))
                return;
@@ -2398,8 +2328,9 @@ rx_ack_print(register const u_char *bp, int length)
                       (int) EXTRACT_16BITS(&rxa->bufferSpace),
                       (int) EXTRACT_16BITS(&rxa->maxSkew));
 
+       firstPacket = EXTRACT_32BITS(&rxa->firstPacket);
        printf(" first %d serial %d reason %s",
-              EXTRACT_32BITS(&rxa->firstPacket), EXTRACT_32BITS(&rxa->serial),
+              firstPacket, EXTRACT_32BITS(&rxa->serial),
               tok2str(rx_ack_reasons, "#%d", (int) rxa->reason));
 
        /*
@@ -2442,7 +2373,7 @@ rx_ack_print(register const u_char *bp, int length)
 
                                if (last == -2) {
                                        printf(" acked %d",
-                                              rxa->firstPacket + i);
+                                              firstPacket + i);
                                        start = i;
                                }
 
@@ -2456,7 +2387,7 @@ rx_ack_print(register const u_char *bp, int length)
                                 */
 
                                else if (last != i - 1) {
-                                       printf(",%d", rxa->firstPacket + i);
+                                       printf(",%d", firstPacket + i);
                                        start = i;
                                }
 
@@ -2482,7 +2413,7 @@ rx_ack_print(register const u_char *bp, int length)
                                 * range.
                                 */
                        } else if (last == i - 1 && start != last)
-                               printf("-%d", rxa->firstPacket + i - 1);
+                               printf("-%d", firstPacket + i - 1);
 
                /*
                 * So, what's going on here?  We ran off the end of the
@@ -2496,7 +2427,7 @@ rx_ack_print(register const u_char *bp, int length)
                 */
 
                if (last == i - 1 && start != last)
-                       printf("-%d", rxa->firstPacket + i - 1);
+                       printf("-%d", firstPacket + i - 1);
 
                /*
                 * Same as above, just without comments
@@ -2506,18 +2437,18 @@ rx_ack_print(register const u_char *bp, int length)
                        if (rxa->acks[i] == RX_ACK_TYPE_NACK) {
                                if (last == -2) {
                                        printf(" nacked %d",
-                                              rxa->firstPacket + i);
+                                              firstPacket + i);
                                        start = i;
                                } else if (last != i - 1) {
-                                       printf(",%d", rxa->firstPacket + i);
+                                       printf(",%d", firstPacket + i);
                                        start = i;
                                }
                                last = i;
                        } else if (last == i - 1 && start != last)
-                               printf("-%d", rxa->firstPacket + i - 1);
+                               printf("-%d", firstPacket + i - 1);
 
                if (last == i - 1 && start != last)
-                       printf("-%d", rxa->firstPacket + i - 1);
+                       printf("-%d", firstPacket + i - 1);
 
                bp += rxa->nAcks;
        }