]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ipfilter/lib/icmptypename.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ipfilter / lib / icmptypename.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 char *icmptypename(family, type)
11         int family, type;
12 {
13         icmptype_t *i;
14
15         if ((type < 0) || (type > 255))
16                 return NULL;
17
18         for (i = icmptypelist; i->it_name != NULL; i++) {
19                 if ((family == AF_INET) && (i->it_v4 == type))
20                         return i->it_name;
21 #ifdef USE_INET6
22                 if ((family == AF_INET6) && (i->it_v6 == type))
23                         return i->it_name;
24 #endif
25         }
26
27         return NULL;
28 }