xref: /freebsd/sbin/ipf/libipf/optvalue.c (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
1 
2 /*
3  * Copyright (C) 2012 by Darren Reed.
4  *
5  * See the IPFILTER.LICENCE file for details on licencing.
6  *
7  * $Id$
8  */
9 #include "ipf.h"
10 
11 
12 u_32_t
13 getoptbyname(char *optname)
14 {
15 	struct ipopt_names *io;
16 
17 	for (io = ionames; io->on_name; io++)
18 		if (!strcasecmp(optname, io->on_name))
19 			return (io->on_bit);
20 	return (-1);
21 }
22 
23 
24 u_32_t
25 getoptbyvalue(int optval)
26 {
27 	struct ipopt_names *io;
28 
29 	for (io = ionames; io->on_name; io++)
30 		if (io->on_value == optval)
31 			return (io->on_bit);
32 	return (-1);
33 }
34