xref: /freebsd/sbin/ipf/libipf/v6optvalue.c (revision 2582ae5740181e0d2bab10003d66ae91c9b56329)
141edb306SCy Schubert /*	$FreeBSD$	*/
241edb306SCy Schubert 
341edb306SCy Schubert /*
441edb306SCy Schubert  * Copyright (C) 2012 by Darren Reed.
541edb306SCy Schubert  *
641edb306SCy Schubert  * See the IPFILTER.LICENCE file for details on licencing.
741edb306SCy Schubert  *
841edb306SCy Schubert  * $Id$
941edb306SCy Schubert  */
1041edb306SCy Schubert #include "ipf.h"
1141edb306SCy Schubert 
1241edb306SCy Schubert 
1341edb306SCy Schubert 
14efeb8bffSCy Schubert u_32_t getv6optbyname(char *optname)
1541edb306SCy Schubert {
1641edb306SCy Schubert #ifdef	USE_INET6
1741edb306SCy Schubert 	struct ipopt_names *io;
1841edb306SCy Schubert 
1941edb306SCy Schubert 	for (io = v6ionames; io->on_name; io++)
2041edb306SCy Schubert 		if (!strcasecmp(optname, io->on_name))
21*2582ae57SCy Schubert 			return(io->on_bit);
2241edb306SCy Schubert #endif
23*2582ae57SCy Schubert 	return(-1);
2441edb306SCy Schubert }
2541edb306SCy Schubert 
2641edb306SCy Schubert 
27efeb8bffSCy Schubert u_32_t getv6optbyvalue(int optval)
2841edb306SCy Schubert {
2941edb306SCy Schubert #ifdef	USE_INET6
3041edb306SCy Schubert 	struct ipopt_names *io;
3141edb306SCy Schubert 
3241edb306SCy Schubert 	for (io = v6ionames; io->on_name; io++)
3341edb306SCy Schubert 		if (io->on_value == optval)
34*2582ae57SCy Schubert 			return(io->on_bit);
3541edb306SCy Schubert #endif
36*2582ae57SCy Schubert 	return(-1);
3741edb306SCy Schubert }
38