VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/slirp_state.h@ 15956

Last change on this file since 15956 was 15672, checked in by vboxsync, 16 years ago

slirp:makes icmp support unaware of synchronization method on Windows
(need to be checked on Vista)

  • Property svn:eol-style set to native
File size: 7.0 KB
Line 
1/** @file
2 * NAT state/configuration.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
17 * Clara, CA 95054 USA or visit http://www.sun.com if you need
18 * additional information or have any questions.
19 */
20
21#ifndef _slirp_state_h_
22#define _slirp_state_h_
23#include "ip_icmp.h"
24
25/** Number of DHCP clients supported by NAT. */
26#define NB_ADDR 16
27
28/** Where to start DHCP IP number allocation. */
29#define START_ADDR 15
30
31/** DHCP Lease time. */
32#define LEASE_TIME (24 * 3600)
33
34/** Entry in the table of known DHCP clients. */
35typedef struct
36{
37 bool allocated;
38 uint8_t macaddr[6];
39} BOOTPClient;
40
41
42/** TFTP session entry. */
43struct tftp_session
44{
45 int in_use;
46 unsigned char filename[TFTP_FILENAME_MAX];
47
48 struct in_addr client_ip;
49 u_int16_t client_port;
50
51 int timestamp;
52};
53
54
55/** Main state/configuration structure for slirp NAT. */
56typedef struct NATState
57{
58 /* Stuff from boot.c */
59 BOOTPClient bootp_clients[NB_ADDR];
60 const char *bootp_filename;
61 /* Stuff from if.c */
62 int if_mtu, if_mru;
63 int if_comp;
64 int if_maxlinkhdr;
65 int if_queued;
66 int if_thresh;
67 struct mbuf if_fastq;
68 struct mbuf if_batchq;
69 struct mbuf *next_m;
70 /* Stuff from icmp.c */
71 struct icmpstat_t icmpstat;
72 /* Stuff from ip_input.c */
73 struct ipstat_t ipstat;
74 struct ipqhead ipq[IPREASS_NHASH];
75 int maxnipq; /* Administrative limit on # of reass queues*/
76 int maxfragsperpacket; /* Maximum number of IPv4 fragments allowed per packet */
77 int nipq; /* total number of reass queues */
78 uint16_t ip_currid;
79 /* Stuff from mbuf.c */
80 int mbuf_alloced, mbuf_max;
81 int msize;
82 struct mbuf m_freelist, m_usedlist;
83 /* Stuff from slirp.c */
84 void *pvUser;
85 uint32_t curtime;
86 uint32_t time_fasttimo;
87 uint32_t last_slowtimo;
88 bool do_slowtimo;
89 bool link_up;
90 struct timeval tt;
91 struct in_addr our_addr;
92 struct in_addr alias_addr;
93 struct in_addr special_addr;
94 struct in_addr dns_addr;
95 struct in_addr loopback_addr;
96 uint32_t netmask;
97 uint8_t client_ethaddr[6];
98 struct ex_list *exec_list;
99 char slirp_hostname[33];
100 bool fPassDomain;
101 const char *pszDomain;
102 /* Stuff from tcp_input.c */
103 struct socket tcb;
104 struct socket *tcp_last_so;
105 tcp_seq tcp_iss;
106 /* Stuff from tcp_timer.c */
107 struct tcpstat_t tcpstat;
108 uint32_t tcp_now;
109 int tcp_reass_qsize;
110 int tcp_reass_maxqlen;
111 int tcp_reass_maxseg;
112 int tcp_reass_overflows;
113 /* Stuff from tftp.c */
114 struct tftp_session tftp_sessions[TFTP_SESSIONS_MAX];
115 const char *tftp_prefix;
116 /* Stuff from udp.c */
117 struct udpstat_t udpstat;
118 struct socket udb;
119 struct socket *udp_last_so;
120 struct socket icmp_socket;
121 struct icmp_storage icmp_msg_head;
122# ifdef RT_OS_WINDOWS
123 void *pvIcmpBuffer;
124 size_t szIcmpBuffer;
125 /* Accordin MSDN specification IcmpParseReplies
126 * function should be detected in runtime
127 */
128 long (WINAPI * pfIcmpParseReplies)(void *, long);
129 BOOL (WINAPI * pfIcmpCloseHandle)(HANDLE);
130 HMODULE hmIcmpLibrary;
131# endif
132#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
133# define VBOX_SOCKET_EVENT (pData->phEvents[VBOX_SOCKET_EVENT_INDEX])
134 HANDLE phEvents[VBOX_EVENT_COUNT];
135#endif
136#if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
137 int fIcmp;
138#endif
139 STAMPROFILE StatFill;
140 STAMPROFILE StatPoll;
141 STAMPROFILE StatFastTimer;
142 STAMPROFILE StatSlowTimer;
143 STAMCOUNTER StatTCP;
144 STAMCOUNTER StatUDP;
145 STAMCOUNTER StatTCPHot;
146 STAMCOUNTER StatUDPHot;
147} NATState;
148
149
150/** Default IP time to live. */
151#define ip_defttl IPDEFTTL
152
153/** Number of permanent buffers in mbuf. */
154#define mbuf_thresh 30
155
156/** Use a fixed time before sending keepalive. */
157#define tcp_keepidle TCPTV_KEEP_IDLE
158
159/** Use a fixed interval between keepalive. */
160#define tcp_keepintvl TCPTV_KEEPINTVL
161
162/** Maximum idle time before timing out a connection. */
163#define tcp_maxidle (TCPTV_KEEPCNT * tcp_keepintvl)
164
165/** Default TCP socket options. */
166#define so_options DO_KEEPALIVE
167
168/** Default TCP MSS value. */
169#define tcp_mssdflt TCP_MSS
170
171/** Default TCP round trip time. */
172#define tcp_rttdflt (TCPTV_SRTTDFLT / PR_SLOWHZ)
173
174/** Enable RFC1323 performance enhancements.
175 * @todo check if it really works, it was turned off before. */
176#define tcp_do_rfc1323 1
177
178/** TCP receive buffer size. */
179#define tcp_rcvspace TCP_RCVSPACE
180
181/** TCP receive buffer size. */
182#define tcp_sndspace TCP_SNDSPACE
183
184/* TCP duplicate ACK retransmit threshold. */
185#define tcprexmtthresh 3
186
187
188#define bootp_filename pData->bootp_filename
189#define bootp_clients pData->bootp_clients
190
191#define if_mtu pData->if_mtu
192#define if_mru pData->if_mru
193#define if_comp pData->if_comp
194#define if_maxlinkhdr pData->if_maxlinkhdr
195#define if_queued pData->if_queued
196#define if_thresh pData->if_thresh
197#define if_fastq pData->if_fastq
198#define if_batchq pData->if_batchq
199#define next_m pData->next_m
200
201#define icmpstat pData->icmpstat
202
203#define ipstat pData->ipstat
204#define ipq pData->ipq
205#define ip_currid pData->ip_currid
206
207#define mbuf_alloced pData->mbuf_alloced
208#define mbuf_max pData->mbuf_max
209#define msize pData->msize
210#define m_freelist pData->m_freelist
211#define m_usedlist pData->m_usedlist
212
213#define curtime pData->curtime
214#define time_fasttimo pData->time_fasttimo
215#define last_slowtimo pData->last_slowtimo
216#define do_slowtimo pData->do_slowtimo
217#define link_up pData->link_up
218#define cUsers pData->cUsers
219#define tt pData->tt
220#define our_addr pData->our_addr
221#define alias_addr pData->alias_addr
222#define special_addr pData->special_addr
223#define dns_addr pData->dns_addr
224#define loopback_addr pData->loopback_addr
225#define client_ethaddr pData->client_ethaddr
226#define exec_list pData->exec_list
227#define slirp_hostname pData->slirp_hostname
228
229#define tcb pData->tcb
230#define tcp_last_so pData->tcp_last_so
231#define tcp_iss pData->tcp_iss
232
233#define tcpstat pData->tcpstat
234#define tcp_now pData->tcp_now
235
236#define tftp_sessions pData->tftp_sessions
237#define tftp_prefix pData->tftp_prefix
238
239#define udpstat pData->udpstat
240#define udb pData->udb
241#define udp_last_so pData->udp_last_so
242
243#define maxfragsperpacket pData->maxfragsperpacket
244#define maxnipq pData->maxnipq
245#define nipq pData->nipq
246
247#define tcp_reass_qsize pData->tcp_reass_qsize
248#define tcp_reass_maxqlen pData->tcp_reass_maxqlen
249#define tcp_reass_maxseg pData->tcp_reass_maxseg
250#define tcp_reass_overflows pData->tcp_reass_overflows
251
252#if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
253# define fIcmp pData->fIcmp
254#endif
255
256#endif /* !_slirp_state_h_ */
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