aboutsummaryrefslogtreecommitdiffstats
path: root/nametoaddr.c
diff options
context:
space:
mode:
authorguy <guy>2005-03-17 07:02:31 +0000
committerguy <guy>2005-03-17 07:02:31 +0000
commitafe114b0708f5986a90de7329360d3ec328b20a4 (patch)
tree992bb4ee089382c1e4ea3dad502b527a36639923 /nametoaddr.c
parent16889bae3e84aaaf62e2c9f6dd478fdadbb953f1 (diff)
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}".
Diffstat (limited to 'nametoaddr.c')
-rw-r--r--nametoaddr.c26
1 files changed, 25 insertions, 1 deletions
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)