xref: /illumos-gate/usr/src/uts/common/inet/ipf/netinet/ip_lookup.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
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 #ifndef __IP_LOOKUP_H__
10 #define __IP_LOOKUP_H__
11 
12 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
13 # define	SIOCLOOKUPADDTABLE	_IOWR('r', 60, struct iplookupop)
14 # define	SIOCLOOKUPDELTABLE	_IOWR('r', 61, struct iplookupop)
15 # define	SIOCLOOKUPSTAT		_IOWR('r', 64, struct iplookupop)
16 # define	SIOCLOOKUPSTATW		_IOW('r', 64, struct iplookupop)
17 # define	SIOCLOOKUPFLUSH		_IOWR('r', 65, struct iplookupflush)
18 # define	SIOCLOOKUPADDNODE	_IOWR('r', 67, struct iplookupop)
19 # define	SIOCLOOKUPADDNODEW	_IOW('r', 67, struct iplookupop)
20 # define	SIOCLOOKUPDELNODE	_IOWR('r', 68, struct iplookupop)
21 # define	SIOCLOOKUPDELNODEW	_IOW('r', 68, struct iplookupop)
22 #else
23 # define	SIOCLOOKUPADDTABLE	_IOWR(r, 60, struct iplookupop)
24 # define	SIOCLOOKUPDELTABLE	_IOWR(r, 61, struct iplookupop)
25 # define	SIOCLOOKUPSTAT		_IOWR(r, 64, struct iplookupop)
26 # define	SIOCLOOKUPSTATW		_IOW(r, 64, struct iplookupop)
27 # define	SIOCLOOKUPFLUSH		_IOWR(r, 65, struct iplookupflush)
28 # define	SIOCLOOKUPADDNODE	_IOWR(r, 67, struct iplookupop)
29 # define	SIOCLOOKUPADDNODEW	_IOW(r, 67, struct iplookupop)
30 # define	SIOCLOOKUPDELNODE	_IOWR(r, 68, struct iplookupop)
31 # define	SIOCLOOKUPDELNODEW	_IOW(r, 68, struct iplookupop)
32 #endif
33 
34 typedef	struct	iplookupop	{
35 	int	iplo_type;	/* IPLT_* */
36 	int	iplo_unit;	/* IPL_LOG* */
37 	u_int	iplo_arg;
38 	char	iplo_name[FR_GROUPLEN];
39 	size_t	iplo_size;	/* sizeof struct at iplo_struct */
40 	void	*iplo_struct;
41 } iplookupop_t;
42 
43 typedef	struct	iplookupflush	{
44 	int	iplf_type;	/* IPLT_* */
45 	int	iplf_unit;	/* IPL_LOG* */
46 	u_int	iplf_arg;
47 	size_t	iplf_count;
48 	char	iplf_name[FR_GROUPLEN];
49 } iplookupflush_t;
50 
51 typedef	struct	iplookuplink	{
52 	int	ipll_type;	/* IPLT_* */
53 	int	ipll_unit;	/* IPL_LOG* */
54 	u_int	ipll_num;
55 	char	ipll_group[FR_GROUPLEN];
56 } iplookuplink_t;
57 
58 #define	IPLT_ALL	-1
59 #define	IPLT_NONE	0
60 #define	IPLT_POOL	1
61 #define	IPLT_HASH	2
62 
63 #define	IPLT_ANON	0x80000000
64 
65 
66 typedef	union	{
67 	struct	iplookupiterkey {
68 		char	ilik_ival;
69 		u_char	ilik_type;	/* IPLT_* */
70 		u_char	ilik_otype;
71 		char	ilik_unit;	/* IPL_LOG* */
72 	} ilik_unstr;
73 	u_32_t	ilik_key;
74 } iplookupiterkey_t;
75 
76 typedef	struct	ipflookupiter	{
77 	void			*ili_data;
78 	iplookupiterkey_t	ili_lkey;
79 	char			ili_name[FR_GROUPLEN];
80 } ipflookupiter_t;
81 
82 #define	ili_key		ili_lkey.ilik_key
83 #define	ili_ival	ili_lkey.ilik_unstr.ilik_ival
84 #define	ili_unit	ili_lkey.ilik_unstr.ilik_unit
85 #define	ili_type	ili_lkey.ilik_unstr.ilik_type
86 #define	ili_otype	ili_lkey.ilik_unstr.ilik_otype
87 
88 #define	IPFLOOKUPITER_LIST	0
89 #define	IPFLOOKUPITER_NODE	1
90 
91 
92 extern int ip_lookup_init __P((ipf_stack_t *));
93 extern int ip_lookup_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *, ipf_stack_t *));
94 extern void ip_lookup_unload __P((ipf_stack_t *));
95 extern void ip_lookup_deref __P((int, void *, ipf_stack_t *));
96 extern int ip_lookup_iterate __P((void *, int, void *, ipf_stack_t *));
97 extern void ip_lookup_iterderef __P((u_32_t, void *, ipf_stack_t  *));
98 
99 #endif /* __IP_LOOKUP_H__ */
100