1 | #ifndef _nat_proxy_h_
|
---|
2 | #define _nat_proxy_h_
|
---|
3 |
|
---|
4 | #if !defined(VBOX)
|
---|
5 | #include "vbox-compat.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #include "lwip/err.h"
|
---|
9 | #include "lwip/ip_addr.h"
|
---|
10 | #include "winutils.h"
|
---|
11 |
|
---|
12 | /* forward */
|
---|
13 | struct netif;
|
---|
14 | struct tcpip_msg;
|
---|
15 | struct pbuf;
|
---|
16 | struct sockaddr;
|
---|
17 | struct sockaddr_in;
|
---|
18 | struct sockaddr_in6;
|
---|
19 |
|
---|
20 | struct ip4_lomap
|
---|
21 | {
|
---|
22 | ip_addr_t loaddr;
|
---|
23 | uint32_t off;
|
---|
24 | };
|
---|
25 |
|
---|
26 | struct ip4_lomap_desc
|
---|
27 | {
|
---|
28 | const struct ip4_lomap *lomap;
|
---|
29 | unsigned int num_lomap;
|
---|
30 | };
|
---|
31 |
|
---|
32 | struct proxy_options {
|
---|
33 | int ipv6_enabled;
|
---|
34 | int ipv6_defroute;
|
---|
35 | const char *tftp_root;
|
---|
36 | const struct sockaddr_in *src4;
|
---|
37 | const struct sockaddr_in6 *src6;
|
---|
38 | const struct ip4_lomap_desc *lomap_desc;
|
---|
39 | const char **nameservers;
|
---|
40 | };
|
---|
41 |
|
---|
42 | extern volatile struct proxy_options *g_proxy_options;
|
---|
43 | extern struct netif *g_proxy_netif;
|
---|
44 |
|
---|
45 | void proxy_init(struct netif *, struct proxy_options *);
|
---|
46 | SOCKET proxy_connected_socket(int, int, ipX_addr_t *, u16_t);
|
---|
47 | SOCKET proxy_bound_socket(int, int, struct sockaddr *);
|
---|
48 | void proxy_reset_socket(SOCKET);
|
---|
49 | void proxy_sendto(SOCKET, struct pbuf *, void *, size_t);
|
---|
50 | void proxy_lwip_post(struct tcpip_msg *);
|
---|
51 | const char *proxy_lwip_strerr(err_t);
|
---|
52 |
|
---|
53 | /* proxy_rtadvd.c */
|
---|
54 | void proxy_rtadvd_start(struct netif *);
|
---|
55 | void proxy_rtadvd_do_quick(void *);
|
---|
56 |
|
---|
57 | /* rtmon_*.c */
|
---|
58 | int rtmon_get_defaults(void);
|
---|
59 |
|
---|
60 | /* proxy_dhcp6ds.c */
|
---|
61 | err_t dhcp6ds_init(struct netif *);
|
---|
62 |
|
---|
63 | /* proxy_tftpd.c */
|
---|
64 | err_t tftpd_init(struct netif *, const char *);
|
---|
65 |
|
---|
66 | /* pxtcp.c */
|
---|
67 | void pxtcp_init(void);
|
---|
68 |
|
---|
69 | /* pxudp.c */
|
---|
70 | void pxudp_init(void);
|
---|
71 |
|
---|
72 | /* pxdns.c */
|
---|
73 | err_t pxdns_init(struct netif *);
|
---|
74 | void pxdns_set_nameservers(void *);
|
---|
75 |
|
---|
76 |
|
---|
77 | #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
78 | # define HAVE_SA_LEN 0
|
---|
79 | #else
|
---|
80 | # define HAVE_SA_LEN 1
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | #define LWIP_ASSERT1(condition) LWIP_ASSERT(#condition, condition)
|
---|
84 | /* TODO: review debug levels and types */
|
---|
85 | #if !LWIP_PROXY_DEBUG
|
---|
86 | # define DPRINTF_LEVEL(y, x) do {} while (0)
|
---|
87 | #else
|
---|
88 | # define DPRINTF_LEVEL(level, x) do { LWIP_DEBUGF(LWIP_PROXY_DEBUG | (level), x); } while (0)
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #define DPRINTF(x) DPRINTF_LEVEL(0, x)
|
---|
92 | #define DPRINTF0(x) DPRINTF_LEVEL(LWIP_DBG_LEVEL_WARNING, x)
|
---|
93 | #define DPRINTF1(x) DPRINTF_LEVEL(LWIP_DBG_LEVEL_SERIOUS, x)
|
---|
94 | #define DPRINTF2(x) DPRINTF_LEVEL(LWIP_DBG_LEVEL_SEVERE, x)
|
---|
95 |
|
---|
96 | #endif /* _nat_proxy_h_ */
|
---|