FreeBSD/contrib/tcpdump/print-ap1394.c
/*
 * This is the top level routine of the printer.  'p' points
 * to the ether header of the packet, 'h->ts' is the timestamp,
 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
 * is the number of bytes actually captured.
 */
This is the top level routine of the printer.
This is the top level routine of the printer .
u_int
ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{
	u_int length = h->len;
	u_int caplen = h->caplen;
	struct firewire_header *fp;
	u_short ether_type;
	if (caplen < FIREWIRE_HDRLEN) {
		ND_PRINT((ndo, "[|ap1394]"));
		return FIREWIRE_HDRLEN;
	}
	if (ndo->ndo_eflag)
		ap1394_hdr_print(ndo, p, length);
	length -= FIREWIRE_HDRLEN;
	caplen -= FIREWIRE_HDRLEN;
	fp = (struct firewire_header *)p;
	p += FIREWIRE_HDRLEN;
	ether_type = EXTRACT_16BITS(&fp->firewire_type);
	if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
		if (!ndo->ndo_eflag)
			ap1394_hdr_print(ndo, (u_char *)fp, length + FIREWIRE_HDRLEN);
		if (!ndo->ndo_suppress_default_print)
			ND_DEFAULTPRINT(p, caplen);
	}
	return FIREWIRE_HDRLEN;
}
u_int ap1394_if_print ( netdissect_options * ndo , const struct pcap_pkthdr * h , const u_char * p ) { u_int length = h -> len ; u_int caplen = h -> caplen ; struct firewire_header * fp ; u_short ether_type ; if ( caplen < FIREWIRE_HDRLEN ) { ND_PRINT ( ( ndo , " " ) ) ; return FIREWIRE_HDRLEN ; } if ( ndo -> ndo_eflag ) ap1394_hdr_print ( ndo , p , length ) ; length -= FIREWIRE_HDRLEN ; caplen -= FIREWIRE_HDRLEN ; fp = ( struct firewire_header * ) p ; p += FIREWIRE_HDRLEN ; ether_type = EXTRACT_16BITS ( & fp -> firewire_type ) ; if ( ethertype_print ( ndo , ether_type , p , length , caplen ) == 0 ) { if ( ! ndo -> ndo_eflag ) ap1394_hdr_print ( ndo , ( u_char * ) fp , length + FIREWIRE_HDRLEN ) ; if ( ! ndo -> ndo_suppress_default_print ) ND_DEFAULTPRINT ( p , caplen ) ; } return FIREWIRE_HDRLEN ; }
This is the top level routine of the printer.
This is the top level routine of the printer .
/* ether_type not known, print raw packet */