xref: /NextBSD/contrib/ipfilter/lib/geticmptype.c (revision e1dd16d965b177f109afb771e59432e36f335d0a)
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id$
7  */
8 #include "ipf.h"
9 
geticmptype(family,name)10 int geticmptype(family, name)
11 	int family;
12 	char *name;
13 {
14 	icmptype_t *i;
15 
16 	for (i = icmptypelist; i->it_name != NULL; i++) {
17 		if (!strcmp(name, i->it_name)) {
18 			if (family == AF_INET)
19 				return i->it_v4;
20 #ifdef USE_INET6
21 			if (family == AF_INET6)
22 				return i->it_v6;
23 #endif
24 			return -1;
25 		}
26 	}
27 
28 	return -1;
29 }
30