* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
+ *
* From: NetBSD: print-arcnet.c,v 1.2 2000/04/24 13:02:28 itojun Exp
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.4 2001-07-05 18:54:14 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.9 2002-08-01 08:52:59 risso Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-
-struct mbuf;
-struct rtentry;
-
-#include <netinet/in.h>
+#include <tcpdump-stdinc.h>
#include <stdio.h>
#include <pcap.h>
#include "interface.h"
#include "arcnet.h"
-const u_char *packetp;
-const u_char *snapend;
-
int arcnet_encap_print(u_char arctype, const u_char *p,
u_int length, u_int caplen);
-struct arctype_map {
- const int arctype;
- char * const name;
-} arctypemap[] = {
+struct tok arctypemap[] = {
{ ARCTYPE_IP_OLD, "oldip" },
{ ARCTYPE_ARP_OLD, "oldarp" },
{ ARCTYPE_IP, "ip" },
arcnet_print(const u_char *bp, u_int length, int phds, int flag, u_int seqid)
{
const struct arc_header *ap;
- struct arctype_map *atmp;
- char *arctypename;
- char typebuf[3];
+ const char *arctypename;
ap = (const struct arc_header *)bp;
return;
}
- for (arctypename = NULL, atmp = arctypemap; atmp->arctype; atmp++) {
- if (atmp->arctype == ap->arc_type) {
- arctypename = atmp->name;
- break;
- }
- }
- if (!arctypename) {
- arctypename = typebuf;
- (void)snprintf(typebuf, sizeof(typebuf), "%02x", ap->arc_type);
- }
+ arctypename = tok2str(arctypemap, "%02x", ap->arc_type);
if (!phds) {
(void)printf("%02x %02x %s %d: ",
{
u_int caplen = h->caplen;
u_int length = h->len;
- struct arc_header *ap;
+ const struct arc_header *ap;
int phds, flag = 0, archdrlen = 0;
u_int seqid = 0;
goto out;
}
- ap = (struct arc_header *)p;
+ ap = (const struct arc_header *)p;
arc_type = ap->arc_type;
switch (arc_type) {