VirtualBox

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

最後變更 在這個檔案從15638是 15638,由 vboxsync 提交於 16 年 前

slirp:icmp: missed changes (build fix)

  • 屬性 svn:eol-style 設為 native
檔案大小: 6.8 KB
 
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.alldomusa.eu.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 STAMPROFILE StatFill;
137 STAMPROFILE StatPoll;
138 STAMPROFILE StatFastTimer;
139 STAMPROFILE StatSlowTimer;
140 STAMCOUNTER StatTCP;
141 STAMCOUNTER StatUDP;
142 STAMCOUNTER StatTCPHot;
143 STAMCOUNTER StatUDPHot;
144} NATState;
145
146
147/** Default IP time to live. */
148#define ip_defttl IPDEFTTL
149
150/** Number of permanent buffers in mbuf. */
151#define mbuf_thresh 30
152
153/** Use a fixed time before sending keepalive. */
154#define tcp_keepidle TCPTV_KEEP_IDLE
155
156/** Use a fixed interval between keepalive. */
157#define tcp_keepintvl TCPTV_KEEPINTVL
158
159/** Maximum idle time before timing out a connection. */
160#define tcp_maxidle (TCPTV_KEEPCNT * tcp_keepintvl)
161
162/** Default TCP socket options. */
163#define so_options DO_KEEPALIVE
164
165/** Default TCP MSS value. */
166#define tcp_mssdflt TCP_MSS
167
168/** Default TCP round trip time. */
169#define tcp_rttdflt (TCPTV_SRTTDFLT / PR_SLOWHZ)
170
171/** Enable RFC1323 performance enhancements.
172 * @todo check if it really works, it was turned off before. */
173#define tcp_do_rfc1323 1
174
175/** TCP receive buffer size. */
176#define tcp_rcvspace TCP_RCVSPACE
177
178/** TCP receive buffer size. */
179#define tcp_sndspace TCP_SNDSPACE
180
181/* TCP duplicate ACK retransmit threshold. */
182#define tcprexmtthresh 3
183
184
185#define bootp_filename pData->bootp_filename
186#define bootp_clients pData->bootp_clients
187
188#define if_mtu pData->if_mtu
189#define if_mru pData->if_mru
190#define if_comp pData->if_comp
191#define if_maxlinkhdr pData->if_maxlinkhdr
192#define if_queued pData->if_queued
193#define if_thresh pData->if_thresh
194#define if_fastq pData->if_fastq
195#define if_batchq pData->if_batchq
196#define next_m pData->next_m
197
198#define icmpstat pData->icmpstat
199
200#define ipstat pData->ipstat
201#define ipq pData->ipq
202#define ip_currid pData->ip_currid
203
204#define mbuf_alloced pData->mbuf_alloced
205#define mbuf_max pData->mbuf_max
206#define msize pData->msize
207#define m_freelist pData->m_freelist
208#define m_usedlist pData->m_usedlist
209
210#define curtime pData->curtime
211#define time_fasttimo pData->time_fasttimo
212#define last_slowtimo pData->last_slowtimo
213#define do_slowtimo pData->do_slowtimo
214#define link_up pData->link_up
215#define cUsers pData->cUsers
216#define tt pData->tt
217#define our_addr pData->our_addr
218#define alias_addr pData->alias_addr
219#define special_addr pData->special_addr
220#define dns_addr pData->dns_addr
221#define loopback_addr pData->loopback_addr
222#define client_ethaddr pData->client_ethaddr
223#define exec_list pData->exec_list
224#define slirp_hostname pData->slirp_hostname
225
226#define tcb pData->tcb
227#define tcp_last_so pData->tcp_last_so
228#define tcp_iss pData->tcp_iss
229
230#define tcpstat pData->tcpstat
231#define tcp_now pData->tcp_now
232
233#define tftp_sessions pData->tftp_sessions
234#define tftp_prefix pData->tftp_prefix
235
236#define udpstat pData->udpstat
237#define udb pData->udb
238#define udp_last_so pData->udp_last_so
239
240#define maxfragsperpacket pData->maxfragsperpacket
241#define maxnipq pData->maxnipq
242#define nipq pData->nipq
243
244#define tcp_reass_qsize pData->tcp_reass_qsize
245#define tcp_reass_maxqlen pData->tcp_reass_maxqlen
246#define tcp_reass_maxseg pData->tcp_reass_maxseg
247#define tcp_reass_overflows pData->tcp_reass_overflows
248
249#endif /* !_slirp_state_h_ */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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