xref: /netbsd-src/usr.sbin/npf/npftest/libnpftest/npf_test.h (revision bfcefd56cfc74946ba0f251734a8426a0b91e115)
1 /*	$NetBSD: npf_test.h,v 1.10 2013/09/24 02:44:20 rmind Exp $	*/
2 
3 /*
4  * Public Domain.
5  */
6 
7 #ifndef _LIB_NPF_TEST_H_
8 #define _LIB_NPF_TEST_H_
9 
10 #include <sys/types.h>
11 #include <sys/mbuf.h>
12 
13 #include <netinet/in_systm.h>
14 #include <netinet/in.h>
15 #include <netinet6/in6.h>
16 
17 #include <netinet/ip.h>
18 #include <netinet/ip6.h>
19 #include <netinet/tcp.h>
20 #include <netinet/udp.h>
21 #include <netinet/ip_icmp.h>
22 
23 #include <net/if.h>
24 #include <net/if_ether.h>
25 #include <net/ethertypes.h>
26 
27 /* Test interfaces and IP addresses. */
28 #define	IFNAME_EXT	"npftest0"
29 #define	IFNAME_INT	"npftest1"
30 
31 #define	LOCAL_IP1	"10.1.1.1"
32 #define	LOCAL_IP2	"10.1.1.2"
33 #define	LOCAL_IP3	"10.1.1.3"
34 
35 /* Note: RFC 5737 compliant addresses. */
36 #define	PUB_IP1		"192.0.2.1"
37 #define	PUB_IP2		"192.0.2.2"
38 #define	REMOTE_IP1	"192.0.2.3"
39 #define	REMOTE_IP2	"192.0.2.4"
40 
41 void		npf_test_init(void);
42 int		npf_test_load(const void *);
43 unsigned	npf_test_addif(const char *, unsigned, bool);
44 unsigned	npf_test_getif(const char *);
45 
46 int		npf_test_statetrack(const void *, size_t, unsigned,
47 		    bool, int64_t *);
48 void		npf_test_conc(bool, unsigned);
49 
50 struct mbuf *	mbuf_getwithdata(const void *, size_t);
51 struct mbuf *	mbuf_construct_ether(int);
52 struct mbuf *	mbuf_construct(int);
53 struct mbuf *	mbuf_construct6(int);
54 void *		mbuf_return_hdrs(struct mbuf *, bool, struct ip **);
55 void		mbuf_icmp_append(struct mbuf *, struct mbuf *);
56 
57 bool		npf_nbuf_test(bool);
58 bool		npf_bpf_test(bool);
59 bool		npf_table_test(bool);
60 bool		npf_state_test(bool);
61 
62 bool		npf_rule_test(bool);
63 bool		npf_nat_test(bool);
64 
65 #endif
66