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