]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-usb.c
CI: Add warning exemptions for Sun C (suncc-5.15) on Solaris 10
[tcpdump] / print-usb.c
index dc697f5fc719a83c356e7b66170fb19d51c4979b..98bd91b20fb3f633d6f5e437067683c6c8a16738 100644 (file)
 
 /* \summary: USB printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 
@@ -147,8 +146,7 @@ get_direction(int transfer_type, int event_type)
        case URB_BULK:
        case URB_CONTROL:
        case URB_ISOCHRONOUS:
-               switch(event_type)
-               {
+               switch(event_type) {
                case URB_SUBMIT:
                        direction = 2;
                        break;
@@ -161,8 +159,7 @@ get_direction(int transfer_type, int event_type)
                }
                break;
        case URB_INTERRUPT:
-               switch(event_type)
-               {
+               switch(event_type) {
                case URB_SUBMIT:
                        direction = 1;
                        break;
@@ -195,8 +192,7 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
 
        ND_PRINT(" ");
        transfer_type = GET_U_1(uh->transfer_type);
-       switch(transfer_type)
-       {
+       switch(transfer_type) {
                case URB_ISOCHRONOUS:
                        ND_PRINT("ISOCHRONOUS");
                        break;
@@ -214,8 +210,7 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
        }
 
        event_type = GET_U_1(uh->event_type);
-       switch(event_type)
-       {
+       switch(event_type) {
                case URB_SUBMIT:
                        ND_PRINT(" SUBMIT");
                        break;
@@ -248,20 +243,14 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
  * is the number of bytes actually captured.
  */
 void
-usb_linux_48_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
-                           const u_char *p)
+usb_linux_48_byte_if_print(netdissect_options *ndo,
+                           const struct pcap_pkthdr *h _U_, const u_char *p)
 {
        ndo->ndo_protocol = "usb_linux_48_byte";
-       if (h->caplen < sizeof(pcap_usb_header)) {
-               ndo->ndo_ll_header_length += h->caplen;
-               nd_print_trunc(ndo);
-               return;
-       }
-       ndo->ndo_ll_header_length += sizeof (pcap_usb_header);
+       ND_TCHECK_LEN(p, sizeof(pcap_usb_header));
+       ndo->ndo_ll_hdr_len += sizeof (pcap_usb_header);
 
        usb_header_print(ndo, (const pcap_usb_header *) p);
-
-       return;
 }
 
 #ifdef DLT_USB_LINUX_MMAPPED
@@ -274,20 +263,14 @@ usb_linux_48_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
  * is the number of bytes actually captured.
  */
 void
-usb_linux_64_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
-                           const u_char *p)
+usb_linux_64_byte_if_print(netdissect_options *ndo,
+                           const struct pcap_pkthdr *h _U_, const u_char *p)
 {
        ndo->ndo_protocol = "usb_linux_64_byte";
-       if (h->caplen < sizeof(pcap_usb_header_mmapped)) {
-               ndo->ndo_ll_header_length += h->caplen;
-               nd_print_trunc(ndo);
-               return;
-       }
-       ndo->ndo_ll_header_length += sizeof (pcap_usb_header_mmapped);
+       ND_TCHECK_LEN(p, sizeof(pcap_usb_header_mmapped));
+       ndo->ndo_ll_hdr_len += sizeof (pcap_usb_header_mmapped);
 
        usb_header_print(ndo, (const pcap_usb_header *) p);
-
-       return;
 }
 #endif /* DLT_USB_LINUX_MMAPPED */