2020 */
2121#ifndef lint
2222static const char rcsid [] _U_ =
23- "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.1 2004-03-17 19:40:42 guy Exp $ (LBL)" ;
23+ "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.2 2004-03-17 22:11:34 guy Exp $ (LBL)" ;
2424#endif
2525
2626#ifdef HAVE_CONFIG_H
@@ -53,6 +53,27 @@ struct firewire_header {
5353 */
5454#define FIREWIRE_HDRLEN 18
5555
56+ static inline void
57+ ap1394_hdr_print (register const u_char * bp , u_int length )
58+ {
59+ register const struct firewire_header * fp ;
60+ fp = (const struct firewire_header * )bp ;
61+
62+ (void )printf ("%s > %s" ,
63+ linkaddr_string (fp -> firewire_dhost , FIREWIRE_EUI64_LEN ),
64+ linkaddr_string (fp -> firewire_shost , FIREWIRE_EUI64_LEN ));
65+
66+ if (!qflag ) {
67+ (void )printf (", ethertype %s (0x%04x)" ,
68+ tok2str (ethertype_values ,"Unknown" , ntohs (fp -> firewire_type )),
69+ ntohs (fp -> firewire_type ));
70+ } else {
71+ (void )printf (", %s" , tok2str (ethertype_values ,"Unknown Ethertype (0x%04x)" , ntohs (fp -> firewire_type )));
72+ }
73+
74+ (void )printf (", length %u: " , length );
75+ }
76+
5677/*
5778 * This is the top level routine of the printer. 'p' points
5879 * to the ether header of the packet, 'h->ts' is the timestamp,
@@ -73,6 +94,9 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
7394 return FIREWIRE_HDRLEN ;
7495 }
7596
97+ if (eflag )
98+ ap1394_hdr_print (p , length );
99+
76100 length -= FIREWIRE_HDRLEN ;
77101 caplen -= FIREWIRE_HDRLEN ;
78102 fp = (struct firewire_header * )p ;
@@ -84,6 +108,9 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
84108 if (ether_encap_print (ether_type , p , length , caplen ,
85109 & extracted_ether_type ) == 0 ) {
86110 /* ether_type not known, print raw packet */
111+ if (!eflag )
112+ ap1394_hdr_print ((u_char * )fp , length + FIREWIRE_HDRLEN );
113+
87114 if (!xflag && !qflag )
88115 default_print (p , caplen );
89116 }
0 commit comments