xref: /netbsd-src/external/bsd/ipf/dist/lib/v6optvalue.c (revision 13885a665959c62f13a82b3caedf986eaa17aa31)
1*13885a66Sdarrenr /*	$NetBSD: v6optvalue.c,v 1.2 2012/07/22 14:27:37 darrenr Exp $	*/
2bc4097aaSchristos 
3bc4097aaSchristos /*
4c9d5dc6cSdarrenr  * Copyright (C) 2012 by Darren Reed.
5bc4097aaSchristos  *
6bc4097aaSchristos  * See the IPFILTER.LICENCE file for details on licencing.
7bc4097aaSchristos  *
8*13885a66Sdarrenr  * Id: v6optvalue.c,v 1.1.1.2 2012/07/22 13:44:43 darrenr Exp $
9bc4097aaSchristos  */
10bc4097aaSchristos #include "ipf.h"
11bc4097aaSchristos 
12bc4097aaSchristos 
13bc4097aaSchristos 
getv6optbyname(optname)14bc4097aaSchristos u_32_t getv6optbyname(optname)
15bc4097aaSchristos 	char *optname;
16bc4097aaSchristos {
17bc4097aaSchristos #ifdef	USE_INET6
18bc4097aaSchristos 	struct ipopt_names *io;
19bc4097aaSchristos 
20bc4097aaSchristos 	for (io = v6ionames; io->on_name; io++)
21bc4097aaSchristos 		if (!strcasecmp(optname, io->on_name))
22bc4097aaSchristos 			return io->on_bit;
23bc4097aaSchristos #endif
24bc4097aaSchristos 	return -1;
25bc4097aaSchristos }
26bc4097aaSchristos 
27bc4097aaSchristos 
getv6optbyvalue(optval)28bc4097aaSchristos u_32_t getv6optbyvalue(optval)
29bc4097aaSchristos 	int optval;
30bc4097aaSchristos {
31bc4097aaSchristos #ifdef	USE_INET6
32bc4097aaSchristos 	struct ipopt_names *io;
33bc4097aaSchristos 
34bc4097aaSchristos 	for (io = v6ionames; io->on_name; io++)
35bc4097aaSchristos 		if (io->on_value == optval)
36bc4097aaSchristos 			return io->on_bit;
37bc4097aaSchristos #endif
38bc4097aaSchristos 	return -1;
39bc4097aaSchristos }
40