summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib/geticmptype.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ipfilter/lib/geticmptype.c')
-rw-r--r--contrib/ipfilter/lib/geticmptype.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/ipfilter/lib/geticmptype.c b/contrib/ipfilter/lib/geticmptype.c
new file mode 100644
index 0000000..5c962e9
--- /dev/null
+++ b/contrib/ipfilter/lib/geticmptype.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id$
+ */
+#include "ipf.h"
+
+int geticmptype(family, name)
+ int family;
+ char *name;
+{
+ icmptype_t *i;
+
+ for (i = icmptypelist; i->it_name != NULL; i++) {
+ if (!strcmp(name, i->it_name)) {
+ if (family == AF_INET)
+ return i->it_v4;
+#ifdef USE_INET6
+ if (family == AF_INET6)
+ return i->it_v6;
+#endif
+ return -1;
+ }
+ }
+
+ return -1;
+}
OpenPOWER on IntegriCloud