xref: /freebsd/sbin/ipf/libipf/optvalue.c (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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