]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ipfilter/lib/geticmptype.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ipfilter / lib / geticmptype.c
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
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 }