xref: /netbsd-src/usr.sbin/npf/npftest/libnpftest/npf_test.h (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1 /*	$NetBSD: npf_test.h,v 1.11 2013/11/08 00:38:27 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 #define	IFNAME_TEST	"npftest2"
31 
32 #define	LOCAL_IP1	"10.1.1.1"
33 #define	LOCAL_IP2	"10.1.1.2"
34 #define	LOCAL_IP3	"10.1.1.3"
35 
36 /* Note: RFC 5737 compliant addresses. */
37 #define	PUB_IP1		"192.0.2.1"
38 #define	PUB_IP2		"192.0.2.2"
39 #define	REMOTE_IP1	"192.0.2.3"
40 #define	REMOTE_IP2	"192.0.2.4"
41 
42 void		npf_test_init(void);
43 int		npf_test_load(const void *);
44 ifnet_t *	npf_test_addif(const char *, bool, bool);
45 ifnet_t *	npf_test_getif(const char *);
46 
47 int		npf_test_statetrack(const void *, size_t, ifnet_t *,
48 		    bool, int64_t *);
49 void		npf_test_conc(bool, unsigned);
50 
51 struct mbuf *	mbuf_getwithdata(const void *, size_t);
52 struct mbuf *	mbuf_construct_ether(int);
53 struct mbuf *	mbuf_construct(int);
54 struct mbuf *	mbuf_construct6(int);
55 void *		mbuf_return_hdrs(struct mbuf *, bool, struct ip **);
56 void		mbuf_icmp_append(struct mbuf *, struct mbuf *);
57 
58 bool		npf_nbuf_test(bool);
59 bool		npf_bpf_test(bool);
60 bool		npf_table_test(bool);
61 bool		npf_state_test(bool);
62 
63 bool		npf_rule_test(bool);
64 bool		npf_nat_test(bool);
65 
66 #endif
67