xref: /titanic_50/usr/src/uts/common/inet/ipf/netinet/ip_lookup.h (revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1)
1 /*
2  * Copyright (C) 1993-2005  by Darren Reed.
3  * See the IPFILTER.LICENCE file for details on licencing.
4  *
5  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
6  * Use is subject to license terms.
7  */
8 
9 #pragma ident	"%Z%%M%	%I%	%E% SMI"
10 
11 #ifndef __IP_LOOKUP_H__
12 #define __IP_LOOKUP_H__
13 
14 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
15 # define	SIOCLOOKUPADDTABLE	_IOWR('r', 60, struct iplookupop)
16 # define	SIOCLOOKUPDELTABLE	_IOWR('r', 61, struct iplookupop)
17 # define	SIOCLOOKUPSTAT		_IOWR('r', 64, struct iplookupop)
18 # define	SIOCLOOKUPSTATW		_IOW('r', 64, struct iplookupop)
19 # define	SIOCLOOKUPFLUSH		_IOWR('r', 65, struct iplookupflush)
20 # define	SIOCLOOKUPADDNODE	_IOWR('r', 67, struct iplookupop)
21 # define	SIOCLOOKUPADDNODEW	_IOW('r', 67, struct iplookupop)
22 # define	SIOCLOOKUPDELNODE	_IOWR('r', 68, struct iplookupop)
23 # define	SIOCLOOKUPDELNODEW	_IOW('r', 68, struct iplookupop)
24 #else
25 # define	SIOCLOOKUPADDTABLE	_IOWR(r, 60, struct iplookupop)
26 # define	SIOCLOOKUPDELTABLE	_IOWR(r, 61, struct iplookupop)
27 # define	SIOCLOOKUPSTAT		_IOWR(r, 64, struct iplookupop)
28 # define	SIOCLOOKUPSTATW		_IOW(r, 64, struct iplookupop)
29 # define	SIOCLOOKUPFLUSH		_IOWR(r, 65, struct iplookupflush)
30 # define	SIOCLOOKUPADDNODE	_IOWR(r, 67, struct iplookupop)
31 # define	SIOCLOOKUPADDNODEW	_IOW(r, 67, struct iplookupop)
32 # define	SIOCLOOKUPDELNODE	_IOWR(r, 68, struct iplookupop)
33 # define	SIOCLOOKUPDELNODEW	_IOW(r, 68, struct iplookupop)
34 #endif
35 
36 typedef	struct	iplookupop	{
37 	int	iplo_type;	/* IPLT_* */
38 	int	iplo_unit;	/* IPL_LOG* */
39 	u_int	iplo_arg;
40 	char	iplo_name[FR_GROUPLEN];
41 	size_t	iplo_size;	/* sizeof struct at iplo_struct */
42 	void	*iplo_struct;
43 } iplookupop_t;
44 
45 typedef	struct	iplookupflush	{
46 	int	iplf_type;	/* IPLT_* */
47 	int	iplf_unit;	/* IPL_LOG* */
48 	u_int	iplf_arg;
49 	size_t	iplf_count;
50 	char	iplf_name[FR_GROUPLEN];
51 } iplookupflush_t;
52 
53 typedef	struct	iplookuplink	{
54 	int	ipll_type;	/* IPLT_* */
55 	int	ipll_unit;	/* IPL_LOG* */
56 	u_int	ipll_num;
57 	char	ipll_group[FR_GROUPLEN];
58 } iplookuplink_t;
59 
60 #define	IPLT_ALL	-1
61 #define	IPLT_NONE	0
62 #define	IPLT_POOL	1
63 #define	IPLT_HASH	2
64 
65 #define	IPLT_ANON	0x80000000
66 
67 
68 typedef	union	{
69 	struct	iplookupiterkey {
70 		char	ilik_ival;
71 		u_char	ilik_type;	/* IPLT_* */
72 		u_char	ilik_otype;
73 		char	ilik_unit;	/* IPL_LOG* */
74 	} ilik_unstr;
75 	u_32_t	ilik_key;
76 } iplookupiterkey_t;
77 
78 typedef	struct	ipflookupiter	{
79 	void			*ili_data;
80 	iplookupiterkey_t	ili_lkey;
81 	char			ili_name[FR_GROUPLEN];
82 } ipflookupiter_t;
83 
84 #define	ili_key		ili_lkey.ilik_key
85 #define	ili_ival	ili_lkey.ilik_unstr.ilik_ival
86 #define	ili_unit	ili_lkey.ilik_unstr.ilik_unit
87 #define	ili_type	ili_lkey.ilik_unstr.ilik_type
88 #define	ili_otype	ili_lkey.ilik_unstr.ilik_otype
89 
90 #define	IPFLOOKUPITER_LIST	0
91 #define	IPFLOOKUPITER_NODE	1
92 
93 
94 extern int ip_lookup_init __P((ipf_stack_t *));
95 extern int ip_lookup_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *, ipf_stack_t *));
96 extern void ip_lookup_unload __P((ipf_stack_t *));
97 extern void ip_lookup_deref __P((int, void *, ipf_stack_t *));
98 extern int ip_lookup_iterate __P((void *, int, void *, ipf_stack_t *));
99 extern void ip_lookup_iterderef __P((u_32_t, void *, ipf_stack_t  *));
100 
101 #endif /* __IP_LOOKUP_H__ */
102