VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/NAT/proxy.h@ 97071

Last change on this file since 97071 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.2 KB
Line 
1/* $Id: proxy.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * NAT Network - common definitions and declarations.
4 */
5
6/*
7 * Copyright (C) 2013-2022 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 */
43struct netif;
44struct tcpip_msg;
45struct pbuf;
46struct sockaddr;
47struct sockaddr_in;
48struct sockaddr_in6;
49
50struct ip4_lomap
51{
52 ip_addr_t loaddr;
53 uint32_t off;
54};
55
56struct ip4_lomap_desc
57{
58 const struct ip4_lomap *lomap;
59 unsigned int num_lomap;
60};
61
62struct 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
77extern volatile struct proxy_options *g_proxy_options;
78extern struct netif *g_proxy_netif;
79
80void proxy_init(struct netif *, struct proxy_options *);
81SOCKET proxy_connected_socket(int, int, ipX_addr_t *, u16_t);
82SOCKET proxy_bound_socket(int, int, struct sockaddr *);
83#ifdef RT_OS_LINUX
84int proxy_fixup_accepted_socket(SOCKET);
85#endif
86void proxy_reset_socket(SOCKET);
87int proxy_sendto(SOCKET, struct pbuf *, void *, size_t);
88void proxy_lwip_post(struct tcpip_msg *);
89const char *proxy_lwip_strerr(err_t);
90
91/* proxy_rtadvd.c */
92void proxy_rtadvd_start(struct netif *);
93void proxy_rtadvd_do_quick(void *);
94
95/* rtmon_*.c */
96int rtmon_get_defaults(void);
97
98/* proxy_dhcp6ds.c */
99err_t dhcp6ds_init(struct netif *);
100
101/* proxy_tftpd.c */
102err_t tftpd_init(struct netif *, const char *);
103
104/* pxtcp.c */
105void pxtcp_init(void);
106
107/* pxudp.c */
108void pxudp_init(void);
109
110/* pxdns.c */
111err_t pxdns_init(struct netif *);
112void pxdns_set_nameservers(void *);
113
114/* pxping.c */
115err_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
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette