VirtualBox

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

Last change on this file since 15580 was 15453, checked in by vboxsync, 16 years ago

slirp: removed the old 64-bit incompatible reassemble code

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