VirtualBox

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

Last change on this file since 19689 was 19313, checked in by vboxsync, 16 years ago

NAT: slirp servicing several guests

  • Property svn:eol-style set to native
File size: 28.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#include <iprt/req.h>
24#include "ip_icmp.h"
25#ifdef VBOX_WITH_SLIRP_DNS_PROXY
26# include "dnsproxy/dnsproxy.h"
27#endif
28
29/** Number of DHCP clients supported by NAT. */
30#define NB_ADDR 16
31
32/** Where to start DHCP IP number allocation. */
33#define START_ADDR 15
34
35/** DHCP Lease time. */
36#define LEASE_TIME (24 * 3600)
37
38/** Entry in the table of known DHCP clients. */
39typedef struct
40{
41 bool allocated;
42 uint8_t macaddr[6];
43} BOOTPClient;
44
45
46/** TFTP session entry. */
47struct tftp_session
48{
49 int in_use;
50 unsigned char filename[TFTP_FILENAME_MAX];
51
52 struct in_addr client_ip;
53 u_int16_t client_port;
54
55 int timestamp;
56};
57
58#ifdef VBOX_WITH_MULTI_DNS
59struct dns_domain_entry
60{
61 char *dd_pszDomain;
62 LIST_ENTRY(dns_domain_entry) dd_list;
63};
64LIST_HEAD(dns_domain_list_head, dns_domain_entry);
65
66struct dns_entry
67{
68 struct in_addr de_addr;
69 LIST_ENTRY(dns_entry) de_list;
70};
71LIST_HEAD(dns_list_head, dns_entry);
72#endif
73
74/** Main state/configuration structure for slirp NAT. */
75typedef struct NATState
76{
77 /* Stuff from boot.c */
78 BOOTPClient bootp_clients[NB_ADDR];
79 const char *bootp_filename;
80 /* Stuff from if.c */
81 int if_mtu, if_mru;
82 int if_comp;
83 int if_maxlinkhdr;
84 int if_queued;
85 int if_thresh;
86 struct mbuf if_fastq;
87 struct mbuf if_batchq;
88 struct mbuf *next_m;
89 /* Stuff from icmp.c */
90 struct icmpstat_t icmpstat;
91 /* Stuff from ip_input.c */
92 struct ipstat_t ipstat;
93 struct ipqhead ipq[IPREASS_NHASH];
94 int maxnipq; /* Administrative limit on # of reass queues*/
95 int maxfragsperpacket; /* Maximum number of IPv4 fragments allowed per packet */
96 int nipq; /* total number of reass queues */
97 uint16_t ip_currid;
98 /* Stuff from mbuf.c */
99 int mbuf_alloced, mbuf_max;
100 int msize;
101 struct mbuf m_freelist, m_usedlist;
102 /* Stuff from slirp.c */
103 void *pvUser;
104 uint32_t curtime;
105 uint32_t time_fasttimo;
106 uint32_t last_slowtimo;
107 bool do_slowtimo;
108 bool link_up;
109 struct timeval tt;
110 struct in_addr our_addr;
111 struct in_addr alias_addr;
112 struct in_addr special_addr;
113#ifdef VBOX_WITH_SLIRP_MT
114 PRTREQQUEUE pReqQueue;
115#endif
116#ifndef VBOX_WITH_MULTI_DNS
117 struct in_addr dns_addr;
118#else
119# ifdef RT_OS_WINDOWS
120 ULONG (WINAPI * pfGetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG);
121# endif
122 struct dns_list_head dns_list_head;
123 struct dns_domain_list_head dns_domain_list_head;
124#endif
125 struct in_addr tftp_server;
126 struct in_addr loopback_addr;
127 uint32_t netmask;
128#ifndef VBOX_WITH_NAT_SERVICE
129 uint8_t client_ethaddr[6];
130#endif
131 struct ex_list *exec_list;
132 char slirp_hostname[33];
133 bool fPassDomain;
134#ifndef VBOX_WITH_MULTI_DNS
135 const char *pszDomain;
136#endif
137 /* Stuff from tcp_input.c */
138 struct socket tcb;
139#ifdef VBOX_WITH_SLIRP_MT
140 RTCRITSECT tcb_mutex;
141#endif
142 struct socket *tcp_last_so;
143 tcp_seq tcp_iss;
144 /* Stuff from tcp_timer.c */
145 struct tcpstat_t tcpstat;
146 uint32_t tcp_now;
147 int tcp_reass_qsize;
148 int tcp_reass_maxqlen;
149 int tcp_reass_maxseg;
150 int tcp_reass_overflows;
151 /* Stuff from tftp.c */
152 struct tftp_session tftp_sessions[TFTP_SESSIONS_MAX];
153 const char *tftp_prefix;
154 /* Stuff from udp.c */
155 struct udpstat_t udpstat;
156 struct socket udb;
157#ifdef VBOX_WITH_SLIRP_MT
158 RTCRITSECT udb_mutex;
159#endif
160 struct socket *udp_last_so;
161 struct socket icmp_socket;
162 struct icmp_storage icmp_msg_head;
163# ifndef RT_OS_WINDOWS
164 /* counter of sockets needed for allocation enough room to
165 * process sockets with poll/epoll
166 *
167 * NSOCK_INC/DEC should be injected before every
168 * operation on socket queue (tcb, udb)
169 */
170 int nsock;
171# define NSOCK_INC() do {pData->nsock++;} while (0)
172# define NSOCK_DEC() do {pData->nsock--;} while (0)
173# else
174# define NSOCK_INC() do {} while (0)
175# define NSOCK_DEC() do {} while (0)
176# endif
177# ifdef RT_OS_WINDOWS
178 void *pvIcmpBuffer;
179 size_t szIcmpBuffer;
180 /* Accordin MSDN specification IcmpParseReplies
181 * function should be detected in runtime
182 */
183 long (WINAPI * pfIcmpParseReplies)(void *, long);
184 BOOL (WINAPI * pfIcmpCloseHandle)(HANDLE);
185 HMODULE hmIcmpLibrary;
186# endif
187#if defined(RT_OS_WINDOWS)
188# define VBOX_SOCKET_EVENT (pData->phEvents[VBOX_SOCKET_EVENT_INDEX])
189 HANDLE phEvents[VBOX_EVENT_COUNT];
190#endif
191#ifdef VBOX_WITH_SLIRP_DNS_PROXY
192 /* from dnsproxy/dnsproxy.h*/
193 unsigned int authoritative_port;
194 unsigned int authoritative_timeout;
195 unsigned int recursive_port;
196 unsigned int recursive_timeout;
197 unsigned int stats_timeout;
198 unsigned int port;
199
200 unsigned long active_queries;
201 unsigned long all_queries;
202 unsigned long authoritative_queries;
203 unsigned long recursive_queries;
204 unsigned long removed_queries;
205 unsigned long dropped_queries;
206 unsigned long answered_queries;
207 unsigned long dropped_answers;
208 unsigned long late_answers;
209 unsigned long hash_collisions;
210 /*dnsproxy/dnsproxy.c*/
211 unsigned short queryid;
212 struct sockaddr_in authoritative_addr;
213 struct sockaddr_in recursive_addr;
214 int sock_query;
215 int sock_answer;
216 /* dnsproxy/hash.c */
217 #define HASHSIZE 10
218 #define HASH(id) (id & ((1 << HASHSIZE) - 1))
219 struct request *request_hash[1 << HASHSIZE];
220 /* this field control behaviour of DHCP server */
221 bool use_dns_proxy;
222#endif
223 STAMPROFILE StatFill;
224 STAMPROFILE StatPoll;
225 STAMPROFILE StatFastTimer;
226 STAMPROFILE StatSlowTimer;
227 STAMCOUNTER StatTCP;
228 STAMCOUNTER StatUDP;
229 STAMCOUNTER StatTCPHot;
230 STAMCOUNTER StatUDPHot;
231} NATState;
232
233
234/** Default IP time to live. */
235#define ip_defttl IPDEFTTL
236
237/** Number of permanent buffers in mbuf. */
238#define mbuf_thresh 30
239
240/** Use a fixed time before sending keepalive. */
241#define tcp_keepidle TCPTV_KEEP_IDLE
242
243/** Use a fixed interval between keepalive. */
244#define tcp_keepintvl TCPTV_KEEPINTVL
245
246/** Maximum idle time before timing out a connection. */
247#define tcp_maxidle (TCPTV_KEEPCNT * tcp_keepintvl)
248
249/** Default TCP socket options. */
250#define so_options DO_KEEPALIVE
251
252/** Default TCP MSS value. */
253#define tcp_mssdflt TCP_MSS
254
255/** Default TCP round trip time. */
256#define tcp_rttdflt (TCPTV_SRTTDFLT / PR_SLOWHZ)
257
258/** Enable RFC1323 performance enhancements.
259 * @todo check if it really works, it was turned off before. */
260#define tcp_do_rfc1323 1
261
262/** TCP receive buffer size. */
263#define tcp_rcvspace TCP_RCVSPACE
264
265/** TCP receive buffer size. */
266#define tcp_sndspace TCP_SNDSPACE
267
268/* TCP duplicate ACK retransmit threshold. */
269#define tcprexmtthresh 3
270
271
272#define bootp_filename pData->bootp_filename
273#define bootp_clients pData->bootp_clients
274
275#define if_mtu pData->if_mtu
276#define if_mru pData->if_mru
277#define if_comp pData->if_comp
278#define if_maxlinkhdr pData->if_maxlinkhdr
279#define if_queued pData->if_queued
280#define if_thresh pData->if_thresh
281#define if_fastq pData->if_fastq
282#define if_batchq pData->if_batchq
283#define next_m pData->next_m
284
285#define icmpstat pData->icmpstat
286
287#define ipstat pData->ipstat
288#define ipq pData->ipq
289#define ip_currid pData->ip_currid
290
291#define mbuf_alloced pData->mbuf_alloced
292#define mbuf_max pData->mbuf_max
293#define msize pData->msize
294#define m_freelist pData->m_freelist
295#define m_usedlist pData->m_usedlist
296
297#define curtime pData->curtime
298#define time_fasttimo pData->time_fasttimo
299#define last_slowtimo pData->last_slowtimo
300#define do_slowtimo pData->do_slowtimo
301#define link_up pData->link_up
302#define cUsers pData->cUsers
303#define tt pData->tt
304#define our_addr pData->our_addr
305#define alias_addr pData->alias_addr
306#define special_addr pData->special_addr
307#define dns_addr pData->dns_addr
308#define loopback_addr pData->loopback_addr
309#define client_ethaddr pData->client_ethaddr
310#define exec_list pData->exec_list
311#define slirp_hostname pData->slirp_hostname
312
313#define tcb pData->tcb
314#define tcp_last_so pData->tcp_last_so
315#define tcp_iss pData->tcp_iss
316
317#define tcpstat pData->tcpstat
318#define tcp_now pData->tcp_now
319
320#define tftp_sessions pData->tftp_sessions
321#define tftp_prefix pData->tftp_prefix
322
323#define udpstat pData->udpstat
324#define udb pData->udb
325#define udp_last_so pData->udp_last_so
326
327#define maxfragsperpacket pData->maxfragsperpacket
328#define maxnipq pData->maxnipq
329#define nipq pData->nipq
330
331#define tcp_reass_qsize pData->tcp_reass_qsize
332#define tcp_reass_maxqlen pData->tcp_reass_maxqlen
333#define tcp_reass_maxseg pData->tcp_reass_maxseg
334#define tcp_reass_overflows pData->tcp_reass_overflows
335
336#define queue_tcp_label tcb
337#define queue_udp_label udb
338#define __X(x) x
339#define _X(x) __X(x)
340#define _str(x) #x
341#define str(x) _str(x)
342
343#ifdef VBOX_WITH_SLIRP_MT
344
345# define QSOCKET_LOCK(queue) \
346 do { \
347 int rc; \
348 /* Assert(strcmp(RTThreadSelfName(), "EMT") != 0); */ \
349 rc = RTCritSectEnter(&_X(queue) ## _mutex); \
350 AssertReleaseRC(rc); \
351 } while (0)
352# define QSOCKET_UNLOCK(queue) \
353 do { \
354 int rc; \
355 rc = RTCritSectLeave(&_X(queue) ## _mutex); \
356 AssertReleaseRC(rc); \
357 } while (0)
358# define QSOCKET_LOCK_CREATE(queue) \
359 do { \
360 int rc; \
361 rc = RTCritSectInit(&pData->queue ## _mutex); \
362 AssertReleaseRC(rc); \
363 } while (0)
364# define QSOCKET_LOCK_DESTROY(queue) \
365 do { \
366 int rc = RTCritSectDelete(&pData->queue ## _mutex); \
367 AssertReleaseRC(rc); \
368 } while (0)
369
370# define QSOCKET_FOREACH(so, sonext, label) \
371 QSOCKET_LOCK(__X(queue_## label ## _label)); \
372 (so) = (_X(queue_ ## label ## _label)).so_next; \
373 QSOCKET_UNLOCK(__X(queue_## label ##_label)); \
374 if ((so) != &(_X(queue_## label ## _label))) SOCKET_LOCK((so)); \
375 for(;;) \
376 { \
377 if ((so) == &(_X(queue_## label ## _label))) \
378 { \
379 break; \
380 } \
381 Log2(("%s:%d Processing so:%R[natsock]\n", __FUNCTION__, __LINE__, (so)));
382
383# define CONTINUE_NO_UNLOCK(label) goto loop_end_ ## label ## _mt_nounlock
384# define CONTINUE(label) goto loop_end_ ## label ## _mt
385/* @todo replace queue parameter with macrodinition */
386/* _mt_nounlock - user should lock so_next before calling CONTINUE_NO_UNLOCK */
387# define LOOP_LABEL(label, so, sonext) loop_end_ ## label ## _mt: \
388 (sonext) = (so)->so_next; \
389 SOCKET_UNLOCK(so); \
390 QSOCKET_LOCK(_X(queue_ ## label ## _label)); \
391 if ((sonext) != &(_X(queue_## label ## _label))) \
392 { \
393 SOCKET_LOCK((sonext)); \
394 QSOCKET_UNLOCK(_X(queue_ ## label ## _label)); \
395 } \
396 else \
397 { \
398 so = &_X(queue_ ## label ## _label); \
399 QSOCKET_UNLOCK(_X(queue_ ## label ## _label)); \
400 break; \
401 } \
402 (so) = (sonext); \
403 continue; \
404 loop_end_ ## label ## _mt_nounlock: \
405 (so) = (sonext)
406
407# define DO_TCP_OUTPUT(data, sotcb) \
408 do { \
409 PRTREQ pReq = NULL; \
410 int rc; \
411 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
412 AssertReleaseRC(rc); \
413 pReq->u.Internal.pfn = (PFNRT)tcp_output; \
414 pReq->u.Internal.cArgs = 2; \
415 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
416 pReq->u.Internal.aArgs[1] = (uintptr_t)(sotcb); \
417 pReq->fFlags = RTREQFLAGS_VOID; \
418 rc = RTReqQueue(pReq, 0); \
419 if (RT_LIKELY(rc) == VERR_TIMEOUT) \
420 { \
421 SOCKET_UNLOCK(so); \
422 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); \
423 AssertReleaseRC(rc); \
424 SOCKET_LOCK(so); \
425 RTReqFree(pReq); \
426 } \
427 else \
428 AssertReleaseRC(rc); \
429} while(0)
430
431# define DO_TCP_INPUT(data, mbuf, size, so) \
432 do { \
433 PRTREQ pReq = NULL; \
434 int rc; \
435 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
436 AssertReleaseRC(rc); \
437 pReq->u.Internal.pfn = (PFNRT)tcp_input; \
438 pReq->u.Internal.cArgs = 4; \
439 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
440 pReq->u.Internal.aArgs[1] = (uintptr_t)(mbuf); \
441 pReq->u.Internal.aArgs[2] = (uintptr_t)(size); \
442 pReq->u.Internal.aArgs[3] = (uintptr_t)(so); \
443 pReq->fFlags = RTREQFLAGS_VOID|RTREQFLAGS_NO_WAIT; \
444 rc = RTReqQueue(pReq, 0); \
445 AssertReleaseRC(rc); \
446 } while(0)
447
448# define DO_TCP_CONNECT(data, so) \
449 do { \
450 PRTREQ pReq = NULL; \
451 int rc; \
452 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
453 AssertReleaseRC(rc); \
454 pReq->u.Internal.pfn = (PFNRT)tcp_connect; \
455 pReq->u.Internal.cArgs = 2; \
456 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
457 pReq->u.Internal.aArgs[1] = (uintptr_t)(so); \
458 pReq->fFlags = RTREQFLAGS_VOID; \
459 rc = RTReqQueue(pReq, 0); /* don't wait, we have to release lock before*/ \
460 if (RT_LIKELY(rc) == VERR_TIMEOUT) \
461 { \
462 SOCKET_UNLOCK(so); \
463 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); \
464 AssertReleaseRC(rc); \
465 SOCKET_LOCK(so); \
466 RTReqFree(pReq); \
467 } \
468 else \
469 AssertReleaseRC(rc); \
470 } while(0)
471
472# define DO_SOREAD(ret, data, so, ifclose) \
473 do { \
474 PRTREQ pReq = NULL; \
475 int rc; \
476 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
477 AssertReleaseRC(rc); \
478 pReq->u.Internal.pfn = (PFNRT)soread_queue; \
479 pReq->u.Internal.cArgs = 4; \
480 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
481 pReq->u.Internal.aArgs[1] = (uintptr_t)(so); \
482 pReq->u.Internal.aArgs[2] = (uintptr_t)(ifclose); \
483 pReq->u.Internal.aArgs[3] = (uintptr_t)&(ret); \
484 pReq->fFlags = RTREQFLAGS_VOID; \
485 rc = RTReqQueue(pReq, 0); /* don't wait, we have to release lock before*/ \
486 if (RT_LIKELY(rc) == VERR_TIMEOUT) \
487 { \
488 SOCKET_UNLOCK(so); \
489 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); \
490 AssertReleaseRC(rc); \
491 SOCKET_LOCK(so); \
492 RTReqFree(pReq); \
493 } \
494 else \
495 AssertReleaseRC(rc); \
496 } while(0)
497
498# define DO_SOWRITE(ret, data, so) \
499 do { \
500 PRTREQ pReq = NULL; \
501 int rc; \
502 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
503 AssertReleaseRC(rc); \
504 pReq->u.Internal.pfn = (PFNRT)sowrite; \
505 pReq->u.Internal.cArgs = 2; \
506 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
507 pReq->u.Internal.aArgs[1] = (uintptr_t)(so); \
508 pReq->fFlags = RTREQFLAGS_RETURN_MASK; \
509 rc = RTReqQueue(pReq, 0); /* don't wait, we have to release lock before*/ \
510 if (RT_LIKELY(rc) == VERR_TIMEOUT) \
511 { \
512 SOCKET_UNLOCK(so); \
513 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); \
514 SOCKET_LOCK(so); \
515 ret = pReq->iStatus; \
516 RTReqFree(pReq); \
517 } \
518 else \
519 AssertReleaseRC(rc); \
520 } while(0)
521
522# define DO_SORECFROM(data, so) \
523 do { \
524 PRTREQ pReq = NULL; \
525 int rc; \
526 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
527 AssertReleaseRC(rc); \
528 pReq->u.Internal.pfn = (PFNRT)sorecvfrom; \
529 pReq->u.Internal.cArgs = 2; \
530 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
531 pReq->u.Internal.aArgs[1] = (uintptr_t)(so); \
532 pReq->fFlags = RTREQFLAGS_VOID; \
533 rc = RTReqQueue(pReq, 0); \
534 if (RT_LIKELY(rc) == VERR_TIMEOUT) \
535 { \
536 SOCKET_UNLOCK(so); \
537 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); \
538 AssertReleaseRC(rc); \
539 SOCKET_LOCK(so); \
540 RTReqFree(pReq); \
541 } \
542 else \
543 AssertReleaseRC(rc); \
544 } while(0)
545
546# define DO_UDP_DETACH(data, so, so_next) \
547 do { \
548 PRTREQ pReq = NULL; \
549 int rc; \
550 rc = RTReqAlloc((data)->pReqQueue, &pReq, RTREQTYPE_INTERNAL); \
551 AssertReleaseRC(rc); \
552 pReq->u.Internal.pfn = (PFNRT)udp_detach; \
553 pReq->u.Internal.cArgs = 2; \
554 pReq->u.Internal.aArgs[0] = (uintptr_t)(data); \
555 pReq->u.Internal.aArgs[1] = (uintptr_t)(so); \
556 pReq->fFlags = RTREQFLAGS_VOID; \
557 rc = RTReqQueue(pReq, 0); /* don't wait, we have to release lock before*/ \
558 if (RT_LIKELY(rc) == VERR_TIMEOUT) \
559 { \
560 SOCKET_UNLOCK(so); \
561 rc = RTReqWait(pReq, RT_INDEFINITE_WAIT); \
562 AssertReleaseRC(rc); \
563 if ((so_next) != &udb) SOCKET_LOCK((so_next)); \
564 RTReqFree(pReq); \
565 } \
566 else \
567 AssertReleaseRC(rc); \
568 } while(0)
569
570# define SOLOOKUP(so, label, src, sport, dst, dport) \
571 do { \
572 struct socket *sonxt; \
573 (so) = NULL; \
574 QSOCKET_FOREACH(so, sonxt, label) \
575 /* { */ \
576 if ( so->so_lport == (sport) \
577 && so->so_laddr.s_addr == (src).s_addr \
578 && so->so_faddr.s_addr == (dst).s_addr \
579 && so->so_fport == (dport)) \
580 { \
581 if (sonxt != &__X(queue_ ## label ## _label)) \
582 SOCKET_UNLOCK(sonxt); \
583 break; /*so is locked*/ \
584 } \
585 LOOP_LABEL(so, sonxt, label); \
586 } \
587 } \
588 } while (0)
589
590#else /* !VBOX_WITH_SLIRP_MT */
591
592# define QSOCKET_LOCK(queue) do {} while (0)
593# define QSOCKET_UNLOCK(queue) do {} while (0)
594# define QSOCKET_LOCK_CREATE(queue) do {} while (0)
595# define QSOCKET_LOCK_DESTROY(queue) do {} while (0)
596# define QSOCKET_FOREACH(so, sonext, label) \
597 for ((so) = __X(queue_ ## label ## _label).so_next; \
598 (so) != &(__X(queue_ ## label ## _label)); \
599 (so) = (sonext)) \
600 { \
601 (sonext) = (so)->so_next;
602# define CONTINUE(label) continue
603# define CONTINUE_NO_UNLOCK(label) continue
604# define LOOP_LABEL(label, so, sonext) /* empty*/
605# define DO_TCP_OUTPUT(data, sotcb) tcp_output((data), (sotcb))
606# define DO_TCP_INPUT(data, mbuf, size, so) tcp_input((data), (mbuf), (size), (so))
607# define DO_TCP_CONNECT(data, so) tcp_connect((data), (so))
608# define DO_SOREAD(ret, data, so, ifclose) \
609 do { \
610 (ret) = soread((data), (so), (ifclose)); \
611 } while(0)
612# define DO_SOWRITE(ret, data, so) \
613 do { \
614 (ret) = sowrite((data), (so)); \
615 } while(0)
616# define DO_SORECFROM(data, so) sorecvfrom((data), (so))
617# define SOLOOKUP(so, label, src, sport, dst, dport) \
618 do { \
619 (so) = solookup(&__X(queue_ ## label ## _label), (src), (sport), (dst), (dport)); \
620 } while (0)
621# define DO_UDP_DETACH(data, so, ignored) udp_detach((data), (so))
622
623#endif /* !VBOX_WITH_SLIRP_MT */
624
625#define TCP_OUTPUT(data, sotcb) DO_TCP_OUTPUT((data), (sotcb))
626#define TCP_INPUT(data, mbuf, size, so) DO_TCP_INPUT((data), (mbuf), (size), (so))
627#define TCP_CONNECT(data, so) DO_TCP_CONNECT((data), (so))
628#define SOREAD(ret, data, so, ifclose) DO_SOREAD((ret), (data), (so), (ifclose))
629#define SOWRITE(ret, data, so) DO_SOWRITE((ret), (data), (so))
630#define SORECVFROM(data, so) DO_SORECFROM((data), (so))
631#define UDP_DETACH(data, so, so_next) DO_UDP_DETACH((data), (so), (so_next))
632
633#ifdef VBOX_WITH_SLIRP_DNS_PROXY
634/* dnsproxy/dnsproxy.c */
635# define authoritative_port pData->authoritative_port
636# define authoritative_timeout pData->authoritative_timeout
637# define recursive_port pData->recursive_port
638# define recursive_timeout pData->recursive_timeout
639# define stats_timeout pData->stats_timeout
640/* dnsproxy/hash.c */
641# define dns_port pData->port
642# define request_hash pData->request_hash
643# define hash_collisions pData->hash_collisions
644# define active_queries pData->active_queries
645# define all_queries pData->all_queries
646# define authoritative_queries pData->authoritative_queries
647# define recursive_queries pData->recursive_queries
648# define removed_queries pData->removed_queries
649# define dropped_queries pData->dropped_queries
650# define answered_queries pData->answered_queries
651# define dropped_answers pData->dropped_answers
652# define late_answers pData->late_answers
653
654/* dnsproxy/dnsproxy.c */
655# define queryid pData->queryid
656# define authoritative_addr pData->authoritative_addr
657# define recursive_addr pData->recursive_addr
658# define sock_query pData->sock_query
659# define sock_answer pData->sock_answer
660#endif
661
662#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