1 | /* $Id: proxy.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT Network - common definitions and declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_NAT_proxy_h
|
---|
29 | #define VBOX_INCLUDED_SRC_NAT_proxy_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #if !defined(VBOX)
|
---|
35 | #include "vbox-compat.h"
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #include "lwip/err.h"
|
---|
39 | #include "lwip/ip_addr.h"
|
---|
40 | #include "winutils.h"
|
---|
41 |
|
---|
42 | /* forward */
|
---|
43 | struct netif;
|
---|
44 | struct tcpip_msg;
|
---|
45 | struct pbuf;
|
---|
46 | struct sockaddr;
|
---|
47 | struct sockaddr_in;
|
---|
48 | struct sockaddr_in6;
|
---|
49 |
|
---|
50 | struct ip4_lomap
|
---|
51 | {
|
---|
52 | ip_addr_t loaddr;
|
---|
53 | uint32_t off;
|
---|
54 | };
|
---|
55 |
|
---|
56 | struct ip4_lomap_desc
|
---|
57 | {
|
---|
58 | const struct ip4_lomap *lomap;
|
---|
59 | unsigned int num_lomap;
|
---|
60 | };
|
---|
61 |
|
---|
62 | struct proxy_options {
|
---|
63 | ip_addr_t ipv4_addr;
|
---|
64 | ip_addr_t ipv4_mask;
|
---|
65 | ip6_addr_t ipv6_addr;
|
---|
66 | int ipv6_enabled;
|
---|
67 | int ipv6_defroute;
|
---|
68 | SOCKET icmpsock4;
|
---|
69 | SOCKET icmpsock6;
|
---|
70 | const char *tftp_root;
|
---|
71 | const struct sockaddr_in *src4;
|
---|
72 | const struct sockaddr_in6 *src6;
|
---|
73 | const struct ip4_lomap_desc *lomap_desc;
|
---|
74 | const char **nameservers;
|
---|
75 | };
|
---|
76 |
|
---|
77 | extern volatile struct proxy_options *g_proxy_options;
|
---|
78 | extern struct netif *g_proxy_netif;
|
---|
79 |
|
---|
80 | void proxy_init(struct netif *, struct proxy_options *);
|
---|
81 | SOCKET proxy_connected_socket(int, int, ipX_addr_t *, u16_t);
|
---|
82 | SOCKET proxy_bound_socket(int, int, struct sockaddr *);
|
---|
83 | #ifdef RT_OS_LINUX
|
---|
84 | int proxy_fixup_accepted_socket(SOCKET);
|
---|
85 | #endif
|
---|
86 | void proxy_reset_socket(SOCKET);
|
---|
87 | int proxy_sendto(SOCKET, struct pbuf *, void *, size_t);
|
---|
88 | void proxy_lwip_post(struct tcpip_msg *);
|
---|
89 | const char *proxy_lwip_strerr(err_t);
|
---|
90 |
|
---|
91 | /* proxy_rtadvd.c */
|
---|
92 | void proxy_rtadvd_start(struct netif *);
|
---|
93 | void proxy_rtadvd_do_quick(void *);
|
---|
94 |
|
---|
95 | /* rtmon_*.c */
|
---|
96 | int rtmon_get_defaults(void);
|
---|
97 |
|
---|
98 | /* proxy_dhcp6ds.c */
|
---|
99 | err_t dhcp6ds_init(struct netif *);
|
---|
100 |
|
---|
101 | /* proxy_tftpd.c */
|
---|
102 | err_t tftpd_init(struct netif *, const char *);
|
---|
103 |
|
---|
104 | /* pxtcp.c */
|
---|
105 | void pxtcp_init(void);
|
---|
106 |
|
---|
107 | /* pxudp.c */
|
---|
108 | void pxudp_init(void);
|
---|
109 |
|
---|
110 | /* pxdns.c */
|
---|
111 | err_t pxdns_init(struct netif *);
|
---|
112 | void pxdns_set_nameservers(void *);
|
---|
113 |
|
---|
114 | /* pxping.c */
|
---|
115 | err_t pxping_init(struct netif *, SOCKET, SOCKET);
|
---|
116 |
|
---|
117 |
|
---|
118 | #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
119 | # define HAVE_SA_LEN 0
|
---|
120 | #else
|
---|
121 | # define HAVE_SA_LEN 1
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #define LWIP_ASSERT1(condition) LWIP_ASSERT(#condition, condition)
|
---|
125 |
|
---|
126 | /*
|
---|
127 | * TODO: DPRINTF0 should probably become LogRel but its usage needs to
|
---|
128 | * be cleaned up a bit before.
|
---|
129 | */
|
---|
130 | #define DPRINTF0(a) Log(a)
|
---|
131 |
|
---|
132 | #define DPRINTF(a) DPRINTF1(a)
|
---|
133 | #define DPRINTF1(a) Log2(a)
|
---|
134 | #define DPRINTF2(a) Log3(a)
|
---|
135 |
|
---|
136 | #endif /* !VBOX_INCLUDED_SRC_NAT_proxy_h */
|
---|
137 |
|
---|