VirtualBox

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

Last change on this file since 37808 was 36216, checked in by vboxsync, 14 years ago

NAT: limitations, not required any more.

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