1145519Sdarrenr/* 2145510Sdarrenr * Copyright (C) 2012 by Darren Reed. 3170268Sdarrenr * 4255332Scy * See the IPFILTER.LICENCE file for details on licencing. 5255332Scy * 6255332Scy * $Id$ 7255332Scy */ 8255332Scy#include "ipf.h" 9255332Scy 10170268Sdarrenrchar *icmptypename(family, type) 11145510Sdarrenr int family, type; 12145510Sdarrenr{ 13145510Sdarrenr icmptype_t *i; 14145510Sdarrenr 15145510Sdarrenr if ((type < 0) || (type > 255)) 16145510Sdarrenr return NULL; 17145510Sdarrenr 18255332Scy for (i = icmptypelist; i->it_name != NULL; i++) { 19255332Scy if ((family == AF_INET) && (i->it_v4 == type)) 20255332Scy return i->it_name; 21145510Sdarrenr#ifdef USE_INET6 22145510Sdarrenr if ((family == AF_INET6) && (i->it_v6 == type)) 23145510Sdarrenr return i->it_name; 24145510Sdarrenr#endif 25145510Sdarrenr } 26145510Sdarrenr 27145510Sdarrenr return NULL; 28145510Sdarrenr} 29255332Scy