freebsd-dev/contrib/ipfilter/lib/icmptypename.c
Cy Schubert bfc88dcbf7 Update ipfilter 4.1.28 --> 5.1.2.
Approved by:		glebius (mentor)
BSD Licensed by:	Darren Reed <darrenr@reed.wattle.id.au> (author)
2013-09-06 23:11:19 +00:00

29 lines
494 B
C

/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id$
*/
#include "ipf.h"
char *icmptypename(family, type)
int family, type;
{
icmptype_t *i;
if ((type < 0) || (type > 255))
return NULL;
for (i = icmptypelist; i->it_name != NULL; i++) {
if ((family == AF_INET) && (i->it_v4 == type))
return i->it_name;
#ifdef USE_INET6
if ((family == AF_INET6) && (i->it_v6 == type))
return i->it_name;
#endif
}
return NULL;
}