4 * Copyright (C) 1993-2001 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: icmpcode.c,v 1.7.2.1 2004/12/09 19:41:20 darrenr Exp
16 # define MIN(a,b) ((a) > (b) ? (b) : (a))
20 char *icmpcodes[MAX_ICMPCODE + 1] = {
21 "net-unr", "host-unr", "proto-unr", "port-unr", "needfrag", "srcfail",
22 "net-unk", "host-unk", "isolate", "net-prohib", "host-prohib",
23 "net-tos", "host-tos", "filter-prohib", "host-preced", "preced-cutoff",
27 * Return the number for the associated ICMP unreachable code.
35 if ((s = strrchr(str, ')')))
38 if (!ratoi(str, &i, 0, 255))
44 for (i = 0; icmpcodes[i]; i++)
45 if (!strncasecmp(str, icmpcodes[i], MIN(len,
46 strlen(icmpcodes[i])) ))