xref: /freebsd/sbin/ipf/libipf/v6optvalue.c (revision 41edb306f05651fcaf6c74f9e3557f59f80292e1)
1*41edb306SCy Schubert /*	$FreeBSD$	*/
2*41edb306SCy Schubert 
3*41edb306SCy Schubert /*
4*41edb306SCy Schubert  * Copyright (C) 2012 by Darren Reed.
5*41edb306SCy Schubert  *
6*41edb306SCy Schubert  * See the IPFILTER.LICENCE file for details on licencing.
7*41edb306SCy Schubert  *
8*41edb306SCy Schubert  * $Id$
9*41edb306SCy Schubert  */
10*41edb306SCy Schubert #include "ipf.h"
11*41edb306SCy Schubert 
12*41edb306SCy Schubert 
13*41edb306SCy Schubert 
14*41edb306SCy Schubert u_32_t getv6optbyname(optname)
15*41edb306SCy Schubert 	char *optname;
16*41edb306SCy Schubert {
17*41edb306SCy Schubert #ifdef	USE_INET6
18*41edb306SCy Schubert 	struct ipopt_names *io;
19*41edb306SCy Schubert 
20*41edb306SCy Schubert 	for (io = v6ionames; io->on_name; io++)
21*41edb306SCy Schubert 		if (!strcasecmp(optname, io->on_name))
22*41edb306SCy Schubert 			return io->on_bit;
23*41edb306SCy Schubert #endif
24*41edb306SCy Schubert 	return -1;
25*41edb306SCy Schubert }
26*41edb306SCy Schubert 
27*41edb306SCy Schubert 
28*41edb306SCy Schubert u_32_t getv6optbyvalue(optval)
29*41edb306SCy Schubert 	int optval;
30*41edb306SCy Schubert {
31*41edb306SCy Schubert #ifdef	USE_INET6
32*41edb306SCy Schubert 	struct ipopt_names *io;
33*41edb306SCy Schubert 
34*41edb306SCy Schubert 	for (io = v6ionames; io->on_name; io++)
35*41edb306SCy Schubert 		if (io->on_value == optval)
36*41edb306SCy Schubert 			return io->on_bit;
37*41edb306SCy Schubert #endif
38*41edb306SCy Schubert 	return -1;
39*41edb306SCy Schubert }
40