1 | /* $Id: proxy.h 76576 2019-01-01 06:05:25Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT Network - common definitions and declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2019 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 VBOX_INCLUDED_SRC_NAT_proxy_h
|
---|
19 | #define VBOX_INCLUDED_SRC_NAT_proxy_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #if !defined(VBOX)
|
---|
25 | #include "vbox-compat.h"
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | #include "lwip/err.h"
|
---|
29 | #include "lwip/ip_addr.h"
|
---|
30 | #include "winutils.h"
|
---|
31 |
|
---|
32 | /* forward */
|
---|
33 | struct netif;
|
---|
34 | struct tcpip_msg;
|
---|
35 | struct pbuf;
|
---|
36 | struct sockaddr;
|
---|
37 | struct sockaddr_in;
|
---|
38 | struct sockaddr_in6;
|
---|
39 |
|
---|
40 | struct ip4_lomap
|
---|
41 | {
|
---|
42 | ip_addr_t loaddr;
|
---|
43 | uint32_t off;
|
---|
44 | };
|
---|
45 |
|
---|
46 | struct ip4_lomap_desc
|
---|
47 | {
|
---|
48 | const struct ip4_lomap *lomap;
|
---|
49 | unsigned int num_lomap;
|
---|
50 | };
|
---|
51 |
|
---|
52 | struct proxy_options {
|
---|
53 | int ipv6_enabled;
|
---|
54 | int ipv6_defroute;
|
---|
55 | SOCKET icmpsock4;
|
---|
56 | SOCKET icmpsock6;
|
---|
57 | const char *tftp_root;
|
---|
58 | const struct sockaddr_in *src4;
|
---|
59 | const struct sockaddr_in6 *src6;
|
---|
60 | const struct ip4_lomap_desc *lomap_desc;
|
---|
61 | const char **nameservers;
|
---|
62 | };
|
---|
63 |
|
---|
64 | extern volatile struct proxy_options *g_proxy_options;
|
---|
65 | extern struct netif *g_proxy_netif;
|
---|
66 |
|
---|
67 | void proxy_init(struct netif *, struct proxy_options *);
|
---|
68 | SOCKET proxy_connected_socket(int, int, ipX_addr_t *, u16_t);
|
---|
69 | SOCKET proxy_bound_socket(int, int, struct sockaddr *);
|
---|
70 | void proxy_reset_socket(SOCKET);
|
---|
71 | int proxy_sendto(SOCKET, struct pbuf *, void *, size_t);
|
---|
72 | void proxy_lwip_post(struct tcpip_msg *);
|
---|
73 | const char *proxy_lwip_strerr(err_t);
|
---|
74 |
|
---|
75 | /* proxy_rtadvd.c */
|
---|
76 | void proxy_rtadvd_start(struct netif *);
|
---|
77 | void proxy_rtadvd_do_quick(void *);
|
---|
78 |
|
---|
79 | /* rtmon_*.c */
|
---|
80 | int rtmon_get_defaults(void);
|
---|
81 |
|
---|
82 | /* proxy_dhcp6ds.c */
|
---|
83 | err_t dhcp6ds_init(struct netif *);
|
---|
84 |
|
---|
85 | /* proxy_tftpd.c */
|
---|
86 | err_t tftpd_init(struct netif *, const char *);
|
---|
87 |
|
---|
88 | /* pxtcp.c */
|
---|
89 | void pxtcp_init(void);
|
---|
90 |
|
---|
91 | /* pxudp.c */
|
---|
92 | void pxudp_init(void);
|
---|
93 |
|
---|
94 | /* pxdns.c */
|
---|
95 | err_t pxdns_init(struct netif *);
|
---|
96 | void pxdns_set_nameservers(void *);
|
---|
97 |
|
---|
98 | /* pxping.c */
|
---|
99 | err_t pxping_init(struct netif *, SOCKET, SOCKET);
|
---|
100 |
|
---|
101 |
|
---|
102 | #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
103 | # define HAVE_SA_LEN 0
|
---|
104 | #else
|
---|
105 | # define HAVE_SA_LEN 1
|
---|
106 | #endif
|
---|
107 |
|
---|
108 | #define LWIP_ASSERT1(condition) LWIP_ASSERT(#condition, condition)
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * TODO: DPRINTF0 should probably become LogRel but its usage needs to
|
---|
112 | * be cleaned up a bit before.
|
---|
113 | */
|
---|
114 | #define DPRINTF0(a) Log(a)
|
---|
115 |
|
---|
116 | #define DPRINTF(a) DPRINTF1(a)
|
---|
117 | #define DPRINTF1(a) Log2(a)
|
---|
118 | #define DPRINTF2(a) Log3(a)
|
---|
119 |
|
---|
120 | #endif /* !VBOX_INCLUDED_SRC_NAT_proxy_h */
|
---|
121 |
|
---|