xref: /onnv-gate/usr/src/cmd/ipf/lib/common/v6optvalue.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
5*0Sstevel@tonic-gate  *
6*0Sstevel@tonic-gate  * $Id: v6optvalue.c,v 1.1 2003/04/26 04:55:58 darrenr Exp $
7*0Sstevel@tonic-gate  */
8*0Sstevel@tonic-gate #include "ipf.h"
9*0Sstevel@tonic-gate 
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate 
getv6optbyname(optname)12*0Sstevel@tonic-gate u_32_t getv6optbyname(optname)
13*0Sstevel@tonic-gate char *optname;
14*0Sstevel@tonic-gate {
15*0Sstevel@tonic-gate #ifdef	USE_INET6
16*0Sstevel@tonic-gate 	struct ipopt_names *io;
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate 	for (io = v6ionames; io->on_name; io++)
19*0Sstevel@tonic-gate 		if (!strcasecmp(optname, io->on_name))
20*0Sstevel@tonic-gate 			return io->on_bit;
21*0Sstevel@tonic-gate #endif
22*0Sstevel@tonic-gate 	return -1;
23*0Sstevel@tonic-gate }
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate 
getv6optbyvalue(optval)26*0Sstevel@tonic-gate u_32_t getv6optbyvalue(optval)
27*0Sstevel@tonic-gate int optval;
28*0Sstevel@tonic-gate {
29*0Sstevel@tonic-gate #ifdef	USE_INET6
30*0Sstevel@tonic-gate 	struct ipopt_names *io;
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate 	for (io = v6ionames; io->on_name; io++)
33*0Sstevel@tonic-gate 		if (io->on_value == optval)
34*0Sstevel@tonic-gate 			return io->on_bit;
35*0Sstevel@tonic-gate #endif
36*0Sstevel@tonic-gate 	return -1;
37*0Sstevel@tonic-gate }
38