]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-usb.c
the failed/passed count was not kept in the right place
[tcpdump] / print-usb.c
index e2c1d78da90d23f442ea648bd9deb207f20181ed..07a0a5d18bef179050aa9e84ffcab03e8ff4a3ac 100644 (file)
@@ -135,7 +135,6 @@ typedef struct _usb_isodesc {
        nd_byte         pad[4];
 } usb_isodesc;
 
-static const char tstr[] = "[|usb]";
 
 /* returns direction: 1=inbound 2=outbound -1=invalid */
 static int
@@ -188,7 +187,14 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
        int direction;
        uint8_t transfer_type, event_type;
 
-       transfer_type = EXTRACT_U_1(uh->transfer_type);
+       ndo->ndo_protocol = "usb";
+
+       nd_print_protocol_caps(ndo);
+       if (ndo->ndo_qflag)
+               return;
+
+       ND_PRINT(" ");
+       transfer_type = GET_U_1(uh->transfer_type);
        switch(transfer_type)
        {
                case URB_ISOCHRONOUS:
@@ -207,7 +213,7 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
                        ND_PRINT(" ?");
        }
 
-       event_type = EXTRACT_U_1(uh->event_type);
+       event_type = GET_U_1(uh->event_type);
        switch(event_type)
        {
                case URB_SUBMIT:
@@ -228,7 +234,9 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
                ND_PRINT(" from");
        else if(direction == 2)
                ND_PRINT(" to");
-       ND_PRINT(" %u:%u:%u", EXTRACT_HE_U_2(uh->bus_id), EXTRACT_U_1(uh->device_address), EXTRACT_U_1(uh->endpoint_number) & 0x7f);
+       ND_PRINT(" %u:%u:%u", GET_HE_U_2(uh->bus_id),
+                GET_U_1(uh->device_address),
+                GET_U_1(uh->endpoint_number) & 0x7f);
 }
 
 /*
@@ -243,8 +251,9 @@ u_int
 usb_linux_48_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                            const u_char *p)
 {
+       ndo->ndo_protocol = "usb_linux_48_byte_if";
        if (h->caplen < sizeof(pcap_usb_header)) {
-               ND_PRINT("%s", tstr);
+               nd_print_trunc(ndo);
                return(sizeof(pcap_usb_header));
        }
 
@@ -266,8 +275,9 @@ u_int
 usb_linux_64_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
                            const u_char *p)
 {
+       ndo->ndo_protocol = "usb_linux_64_byte_if";
        if (h->caplen < sizeof(pcap_usb_header_mmapped)) {
-               ND_PRINT("%s", tstr);
+               nd_print_trunc(ndo);
                return(sizeof(pcap_usb_header_mmapped));
        }