20
20
*/
21
21
#ifndef lint
22
22
static 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)" ;
24
24
#endif
25
25
26
26
#ifdef HAVE_CONFIG_H
@@ -53,6 +53,27 @@ struct firewire_header {
53
53
*/
54
54
#define FIREWIRE_HDRLEN 18
55
55
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
+
56
77
/*
57
78
* This is the top level routine of the printer. 'p' points
58
79
* 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)
73
94
return FIREWIRE_HDRLEN ;
74
95
}
75
96
97
+ if (eflag )
98
+ ap1394_hdr_print (p , length );
99
+
76
100
length -= FIREWIRE_HDRLEN ;
77
101
caplen -= FIREWIRE_HDRLEN ;
78
102
fp = (struct firewire_header * )p ;
@@ -84,6 +108,9 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
84
108
if (ether_encap_print (ether_type , p , length , caplen ,
85
109
& extracted_ether_type ) == 0 ) {
86
110
/* ether_type not known, print raw packet */
111
+ if (!eflag )
112
+ ap1394_hdr_print ((u_char * )fp , length + FIREWIRE_HDRLEN );
113
+
87
114
if (!xflag && !qflag )
88
115
default_print (p , caplen );
89
116
}
0 commit comments