1 | /* -*- indent-tabs-mode: nil; -*- */
|
---|
2 | #ifndef _portfwd_h_
|
---|
3 | #define _portfwd_h_
|
---|
4 |
|
---|
5 | #ifndef RT_OS_WINDOWS
|
---|
6 | #include <sys/types.h>
|
---|
7 | #include <sys/socket.h>
|
---|
8 | #include <netinet/in.h>
|
---|
9 | #else
|
---|
10 | # include <ws2ipdef.h>
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #include "lwip/ip_addr.h"
|
---|
14 |
|
---|
15 |
|
---|
16 | struct fwspec {
|
---|
17 | int sdom; /* PF_INET, PF_INET6 */
|
---|
18 | int stype; /* SOCK_STREAM, SOCK_DGRAM */
|
---|
19 |
|
---|
20 | /* listen on */
|
---|
21 | union {
|
---|
22 | struct sockaddr sa;
|
---|
23 | struct sockaddr_in sin; /* sdom == PF_INET */
|
---|
24 | struct sockaddr_in6 sin6; /* sdom == PF_INET6 */
|
---|
25 | } src;
|
---|
26 |
|
---|
27 | /* forward to */
|
---|
28 | union {
|
---|
29 | struct sockaddr sa;
|
---|
30 | struct sockaddr_in sin; /* sdom == PF_INET */
|
---|
31 | struct sockaddr_in6 sin6; /* sdom == PF_INET6 */
|
---|
32 | } dst;
|
---|
33 | };
|
---|
34 |
|
---|
35 |
|
---|
36 | void portfwd_init(void);
|
---|
37 | int portfwd_rule_add(struct fwspec *);
|
---|
38 | int portfwd_rule_del(struct fwspec *);
|
---|
39 |
|
---|
40 |
|
---|
41 | int fwspec_set(struct fwspec *, int, int,
|
---|
42 | const char *, uint16_t,
|
---|
43 | const char *, uint16_t);
|
---|
44 |
|
---|
45 | int fwspec_equal(struct fwspec *, struct fwspec *);
|
---|
46 |
|
---|
47 | void fwtcp_init(void);
|
---|
48 | void fwudp_init(void);
|
---|
49 |
|
---|
50 | void fwtcp_add(struct fwspec *);
|
---|
51 | void fwtcp_del(struct fwspec *);
|
---|
52 | void fwudp_add(struct fwspec *);
|
---|
53 | void fwudp_del(struct fwspec *);
|
---|
54 |
|
---|
55 | int fwany_ipX_addr_set_src(ipX_addr_t *, const struct sockaddr *);
|
---|
56 |
|
---|
57 | /* XXX: for testing */
|
---|
58 | #ifdef VBOX
|
---|
59 | #define PROXY_GUEST_IPV4 "10.0.2.15"
|
---|
60 | #else
|
---|
61 | #define PROXY_GUEST_IPV4 "192.168.2.11"
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #endif /* _portfwd_h_ */
|
---|