VirtualBox

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

Last change on this file since 87710 was 87637, checked in by vboxsync, 4 years ago

NAT/Net: Get IPv6 address from the API instead of always constructing
one based on IPV4. bugref:8124, bugref:9929.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.9 KB
Line 
1/* $Id: proxy.h 87637 2021-02-08 13:18:11Z vboxsync $ */
2/** @file
3 * NAT Network - common definitions and declarations.
4 */
5
6/*
7 * Copyright (C) 2013-2020 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 */
33struct netif;
34struct tcpip_msg;
35struct pbuf;
36struct sockaddr;
37struct sockaddr_in;
38struct sockaddr_in6;
39
40struct ip4_lomap
41{
42 ip_addr_t loaddr;
43 uint32_t off;
44};
45
46struct ip4_lomap_desc
47{
48 const struct ip4_lomap *lomap;
49 unsigned int num_lomap;
50};
51
52struct proxy_options {
53 ip_addr_t ipv4_addr;
54 ip_addr_t ipv4_mask;
55 ip6_addr_t ipv6_addr;
56 int ipv6_enabled;
57 int ipv6_defroute;
58 SOCKET icmpsock4;
59 SOCKET icmpsock6;
60 const char *tftp_root;
61 const struct sockaddr_in *src4;
62 const struct sockaddr_in6 *src6;
63 const struct ip4_lomap_desc *lomap_desc;
64 const char **nameservers;
65};
66
67extern volatile struct proxy_options *g_proxy_options;
68extern struct netif *g_proxy_netif;
69
70void proxy_init(struct netif *, struct proxy_options *);
71SOCKET proxy_connected_socket(int, int, ipX_addr_t *, u16_t);
72SOCKET proxy_bound_socket(int, int, struct sockaddr *);
73#ifdef RT_OS_LINUX
74int proxy_fixup_accepted_socket(SOCKET);
75#endif
76void proxy_reset_socket(SOCKET);
77int proxy_sendto(SOCKET, struct pbuf *, void *, size_t);
78void proxy_lwip_post(struct tcpip_msg *);
79const char *proxy_lwip_strerr(err_t);
80
81/* proxy_rtadvd.c */
82void proxy_rtadvd_start(struct netif *);
83void proxy_rtadvd_do_quick(void *);
84
85/* rtmon_*.c */
86int rtmon_get_defaults(void);
87
88/* proxy_dhcp6ds.c */
89err_t dhcp6ds_init(struct netif *);
90
91/* proxy_tftpd.c */
92err_t tftpd_init(struct netif *, const char *);
93
94/* pxtcp.c */
95void pxtcp_init(void);
96
97/* pxudp.c */
98void pxudp_init(void);
99
100/* pxdns.c */
101err_t pxdns_init(struct netif *);
102void pxdns_set_nameservers(void *);
103
104/* pxping.c */
105err_t pxping_init(struct netif *, SOCKET, SOCKET);
106
107
108#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
109# define HAVE_SA_LEN 0
110#else
111# define HAVE_SA_LEN 1
112#endif
113
114#define LWIP_ASSERT1(condition) LWIP_ASSERT(#condition, condition)
115
116/*
117 * TODO: DPRINTF0 should probably become LogRel but its usage needs to
118 * be cleaned up a bit before.
119 */
120#define DPRINTF0(a) Log(a)
121
122#define DPRINTF(a) DPRINTF1(a)
123#define DPRINTF1(a) Log2(a)
124#define DPRINTF2(a) Log3(a)
125
126#endif /* !VBOX_INCLUDED_SRC_NAT_proxy_h */
127
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