VirtualBox

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

Last change on this file since 19014 was 18902, checked in by vboxsync, 16 years ago

NAT: removed VBOX_WITH_SIMPLIFIED_SLIRP_SYNC as the poller API was removed some days ago

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