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