1 | /* $Id: proxy.h 56300 2015-06-09 14:36:22Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT Network - common definitions and declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2015 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef _nat_proxy_h_
|
---|
19 | #define _nat_proxy_h_
|
---|
20 |
|
---|
21 | #if !defined(VBOX)
|
---|
22 | #include "vbox-compat.h"
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #include "lwip/err.h"
|
---|
26 | #include "lwip/ip_addr.h"
|
---|
27 | #include "winutils.h"
|
---|
28 |
|
---|
29 | /* forward */
|
---|
30 | struct netif;
|
---|
31 | struct tcpip_msg;
|
---|
32 | struct pbuf;
|
---|
33 | struct sockaddr;
|
---|
34 | struct sockaddr_in;
|
---|
35 | struct sockaddr_in6;
|
---|
36 |
|
---|
37 | struct ip4_lomap
|
---|
38 | {
|
---|
39 | ip_addr_t loaddr;
|
---|
40 | uint32_t off;
|
---|
41 | };
|
---|
42 |
|
---|
43 | struct ip4_lomap_desc
|
---|
44 | {
|
---|
45 | const struct ip4_lomap *lomap;
|
---|
46 | unsigned int num_lomap;
|
---|
47 | };
|
---|
48 |
|
---|
49 | struct proxy_options {
|
---|
50 | int ipv6_enabled;
|
---|
51 | int ipv6_defroute;
|
---|
52 | SOCKET icmpsock4;
|
---|
53 | SOCKET icmpsock6;
|
---|
54 | const char *tftp_root;
|
---|
55 | const struct sockaddr_in *src4;
|
---|
56 | const struct sockaddr_in6 *src6;
|
---|
57 | const struct ip4_lomap_desc *lomap_desc;
|
---|
58 | const char **nameservers;
|
---|
59 | };
|
---|
60 |
|
---|
61 | extern volatile struct proxy_options *g_proxy_options;
|
---|
62 | extern struct netif *g_proxy_netif;
|
---|
63 |
|
---|
64 | void proxy_init(struct netif *, struct proxy_options *);
|
---|
65 | SOCKET proxy_connected_socket(int, int, ipX_addr_t *, u16_t);
|
---|
66 | SOCKET proxy_bound_socket(int, int, struct sockaddr *);
|
---|
67 | void proxy_reset_socket(SOCKET);
|
---|
68 | int proxy_sendto(SOCKET, struct pbuf *, void *, size_t);
|
---|
69 | void proxy_lwip_post(struct tcpip_msg *);
|
---|
70 | const char *proxy_lwip_strerr(err_t);
|
---|
71 |
|
---|
72 | /* proxy_rtadvd.c */
|
---|
73 | void proxy_rtadvd_start(struct netif *);
|
---|
74 | void proxy_rtadvd_do_quick(void *);
|
---|
75 |
|
---|
76 | /* rtmon_*.c */
|
---|
77 | int rtmon_get_defaults(void);
|
---|
78 |
|
---|
79 | /* proxy_dhcp6ds.c */
|
---|
80 | err_t dhcp6ds_init(struct netif *);
|
---|
81 |
|
---|
82 | /* proxy_tftpd.c */
|
---|
83 | err_t tftpd_init(struct netif *, const char *);
|
---|
84 |
|
---|
85 | /* pxtcp.c */
|
---|
86 | void pxtcp_init(void);
|
---|
87 |
|
---|
88 | /* pxudp.c */
|
---|
89 | void pxudp_init(void);
|
---|
90 |
|
---|
91 | /* pxdns.c */
|
---|
92 | err_t pxdns_init(struct netif *);
|
---|
93 | void pxdns_set_nameservers(void *);
|
---|
94 |
|
---|
95 | /* pxping.c */
|
---|
96 | err_t pxping_init(struct netif *, SOCKET, SOCKET);
|
---|
97 |
|
---|
98 |
|
---|
99 | #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
100 | # define HAVE_SA_LEN 0
|
---|
101 | #else
|
---|
102 | # define HAVE_SA_LEN 1
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #define LWIP_ASSERT1(condition) LWIP_ASSERT(#condition, condition)
|
---|
106 |
|
---|
107 | /*
|
---|
108 | * TODO: DPRINTF0 should probably become LogRel but its usage needs to
|
---|
109 | * be cleaned up a bit before.
|
---|
110 | */
|
---|
111 | #define DPRINTF0(a) Log(a)
|
---|
112 |
|
---|
113 | #define DPRINTF(a) DPRINTF1(a)
|
---|
114 | #define DPRINTF1(a) Log2(a)
|
---|
115 | #define DPRINTF2(a) Log3(a)
|
---|
116 |
|
---|
117 | #endif /* _nat_proxy_h_ */
|
---|