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