VirtualBox

Ignore:
Timestamp:
May 16, 2012 3:02:49 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77992
Message:

NAT: exposing Slirp queue routines for testing.

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/misc.c

    r40423 r41322  
    2525 */
    2626
     27#ifndef VBOX_NAT_TST_QUEUE
    2728#include <slirp.h>
    2829#include "zone.h"
    2930
    30 #ifndef HAVE_INET_ATON
     31# ifndef HAVE_INET_ATON
    3132int
    3233inet_aton(const char *cp, struct in_addr *ia)
     
    3839    return 1;
    3940}
    40 #endif
     41# endif
    4142
    4243/*
     
    4849    our_addr.s_addr = loopback_addr.s_addr;
    4950}
    50 
     51#else /* VBOX_NAT_TST_QUEUE */
     52# include "misc.h"
     53#endif
    5154struct quehead
    5255{
     
    7881}
    7982
    80 
     83#ifndef VBOX_NAT_TST_QUEUE
    8184/*
    8285 * Set fd blocking and non-blocking
     
    8588fd_nonblock(int fd)
    8689{
    87 #ifdef FIONBIO
     90# ifdef FIONBIO
    8891    int opt = 1;
    8992
    9093    ioctlsocket(fd, FIONBIO, &opt);
    91 #else
     94# else /* !FIONBIO */
    9295    int opt;
    9396
     
    9598    opt |= O_NONBLOCK;
    9699    fcntl(fd, F_SETFL, opt);
    97 #endif
    98 }
    99 
    100 #if !defined(VBOX_NAT_MEM_DEBUG) && defined(LOG_ENABLED)
    101 # undef LogFlowFunc
    102 # define LogFlowFunc(x)
    103 
    104 # undef LogFlowFuncEnter
    105 # define LogFlowFuncEnter()
    106 
    107 # undef LogFlowFuncLeave
    108 # define LogFlowFuncLeave()
    109 
    110 # undef Log2
    111 # define Log2(x)
    112 #else
     100# endif
     101}
     102
     103# if !defined(VBOX_NAT_MEM_DEBUG) && defined(LOG_ENABLED)
     104#  undef LogFlowFunc
     105#  define LogFlowFunc(x)
     106
     107#  undef LogFlowFuncEnter
     108#  define LogFlowFuncEnter()
     109
     110#  undef LogFlowFuncLeave
     111#  define LogFlowFuncLeave()
     112
     113#  undef Log2
     114#  define Log2(x)
     115# else /* VBOX_NAT_MEM_DEBUG */
    113116# define NAT_MEM_LOG_ENABLED
    114 #endif
     117# endif
    115118
    116119
     
    150153
    151154    LogFlowFunc(("ENTER: %R[mzone], size:%d, pflags:%p, %RTbool\n", zone, size, pflags, fWait));
    152 #ifndef NAT_MEM_LOG_ENABLED
     155# ifndef NAT_MEM_LOG_ENABLED
    153156    NOREF(size);
    154157    NOREF(pflags);
    155158    NOREF(fWait);
    156 #endif
     159# endif
    157160    RTCritSectEnter(&zone->csZone);
    158161    for (;;)
     
    228231    struct item *it;
    229232    uma_zone_t zone;
    230 #ifndef NAT_MEM_LOG_ENABLED
     233# ifndef NAT_MEM_LOG_ENABLED
    231234    NOREF(size);
    232235    NOREF(flags);
    233 #endif
     236# endif
    234237
    235238    Assert(item);
     
    263266{
    264267    uma_zone_t zone = NULL;
    265 #ifndef NAT_MEM_LOG_ENABLED
     268# ifndef NAT_MEM_LOG_ENABLED
    266269    NOREF(flags1);
    267270    NOREF(flags2);
    268 #endif
     271# endif
    269272    LogFlowFunc(("ENTER: name:%s size:%d, ctor:%p, dtor:%p, init:%p, fini:%p, flags1:%RX32, flags2:%RX32\n",
    270273                name, ctor, dtor, init, fini, flags1, flags2));
     
    354357    reference counters */
    355358    struct item *it = NULL;
    356 #ifndef NAT_MEM_LOG_ENABLED
     359# ifndef NAT_MEM_LOG_ENABLED
    357360    NOREF(zone);
    358 #endif
     361# endif
    359362    LogFlowFunc(("ENTER: zone:%R[mzone], mem:%p\n", zone, mem));
    360363    it = (struct item *)mem; /* 1st element */
     
    370373{
    371374    void *mem;
    372 #ifndef NAT_MEM_LOG_ENABLED
     375# ifndef NAT_MEM_LOG_ENABLED
    373376    NOREF(how);
    374 #endif
     377# endif
    375378    Assert(zone->magic == ZONE_MAGIC);
    376379    LogFlowFunc(("ENTER: zone:%R[mzone], args:%p, how:%RX32\n", zone, args, how));
     
    406409    Assert((mem));
    407410    LogFlowFunc(("ENTER: zone:%R[mzone], mem:%p, flags:%p\n", zone, mem, flags));
    408 #ifndef NAT_MEM_LOG_ENABLED
     411# ifndef NAT_MEM_LOG_ENABLED
    409412    NOREF(flags);
    410 #endif
     413# endif
    411414
    412415    RTCritSectEnter(&zone->csZone);
     
    466469    LogFlowFunc(("ENTER: mem:%p, arg:%p\n", mem, arg));
    467470    Assert(mem);
    468 #ifndef NAT_MEM_LOG_ENABLED
     471# ifndef NAT_MEM_LOG_ENABLED
    469472    NOREF(arg);
    470 #endif
     473# endif
    471474    RTMemFree(mem);
    472475    LogFlowFuncLeave();
     
    475478void *uma_zalloc(uma_zone_t zone, int len)
    476479{
    477 #ifndef NAT_MEM_LOG_ENABLED
     480# ifndef NAT_MEM_LOG_ENABLED
    478481    NOREF(zone);
    479482    NOREF(len);
    480 #endif
     483# endif
    481484    LogFlowFunc(("ENTER: zone:%R[mzone], len:%d\n", zone, len));
    482485    LogFlowFunc(("LEAVE: NULL"));
     
    542545{
    543546    LogFlowFuncEnter();
    544 #define ZONE_DESTROY(zone) do { zone_destroy((zone)); (zone) = NULL;} while (0)
     547# define ZONE_DESTROY(zone) do { zone_destroy((zone)); (zone) = NULL;} while (0)
    545548    ZONE_DESTROY(pData->zone_clust);
    546549    ZONE_DESTROY(pData->zone_pack);
     
    549552    ZONE_DESTROY(pData->zone_jumbo9);
    550553    ZONE_DESTROY(pData->zone_jumbo16);
    551 #undef ZONE_DESTROY
     554# undef ZONE_DESTROY
    552555    /** @todo do finalize here.*/
    553556    LogFlowFuncLeave();
     
    563566    if_mru = 1500;
    564567}
     568#endif /* VBOX_NAT_TST_QUEUE */
  • trunk/src/VBox/Devices/Network/slirp/misc.h

    r38492 r41322  
    2828#define _MISC_H_
    2929
     30#ifdef VBOX_NAT_TST_QUEUE
     31typedef void *PNATState;
     32#endif
    3033
    31 void getouraddr (PNATState);
    3234void slirp_insque  (PNATState, void *, void *);
    3335void slirp_remque  (PNATState, void *);
     36# ifndef VBOX_NAT_TST_QUEUE
     37void getouraddr (PNATState);
    3438void fd_nonblock (int);
    3539
     
    6872void slirp_null_arg_free(void *, void *);
    6973void m_fini(PNATState pData);
    70 
     74# else /* VBOX_NAT_TST_QUEUE */
     75#  define insque slirp_insque
     76#  define remque slirp_remque
     77# endif
    7178#endif
Note: See TracChangeset for help on using the changeset viewer.

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