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