From afe114b0708f5986a90de7329360d3ec328b20a4 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Mar 2005 07:02:31 +0000 Subject: For "ether proto", allow LLC value names as well as Ethernet type value names, so that, as the tcpdump man page claims to be the case, "ether proto \{iso,stp,ipx,netbeui}" are equivalent to "{iso,stp,ipx,netbeui}". --- nametoaddr.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'nametoaddr.c') diff --git a/nametoaddr.c b/nametoaddr.c index 02f1b48..b6c6a66 100644 --- a/nametoaddr.c +++ b/nametoaddr.c @@ -24,7 +24,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.73 2003-12-24 09:14:21 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.74 2005-03-17 07:02:32 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -268,6 +268,30 @@ pcap_nametoeproto(const char *s) return PROTO_UNDEF; } +#include "llc.h" + +/* Static data base of LLC values. */ +static struct eproto llc_db[] = { + { "iso", LLCSAP_ISONS }, + { "stp", LLCSAP_8021D }, + { "ipx", LLCSAP_IPX }, + { "netbeui", LLCSAP_NETBEUI }, + { (char *)0, 0 } +}; + +int +pcap_nametollc(const char *s) +{ + struct eproto *p = llc_db; + + while (p->s != 0) { + if (strcmp(p->s, s) == 0) + return p->p; + p += 1; + } + return PROTO_UNDEF; +} + /* Hex digit to integer. */ static inline int xdtoi(c) -- cgit v1.2.3