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
10char *
11icmptypename(int family, int 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}
29