VirtualBox

Changeset 15203 in vbox


Ignore:
Timestamp:
Dec 9, 2008 9:14:43 PM (16 years ago)
Author:
vboxsync
Message:

slirp: comments, cosmetics

File:
1 edited

Legend:

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

    r15201 r15203  
    1414
    1515# ifdef VBOX_WITH_SLIRP_ICMP
    16 #  define DO_ENGAGE_EVENT0(so, fdset, label) DO_ENGAGE_EVENT1((so), (fdset), label)
    17 # else /* VBOX_WITH_SLIRP_ICMP */
    18 #  define DO_ENGAGE_EVENT0(so, fdset, label) /* ignore */
     16#  define ICMP_ENGAGE_EVENT(so, fdset1, fdset2)      \
     17    DO_ENGAGE_EVENT2((so), (fdset1), (fdset2), ICMP)
     18# else /* !VBOX_WITH_SLIRP_ICMP */
     19#  define ICMP_ENGAGE_EVENT(so, fdset1, fdset2)      \
     20    /* no ICMP socket */
    1921#endif /* !VBOX_WITH_SLIRP_ICMP */
    2022
    21 # define DO_ENGAGE_EVENT1(so, fdset, label)         \
    22     do {                                            \
    23         FD_SET((so)->s, (fdset));                   \
    24         UPD_NFDS((so)->s);                          \
    25     } while(0)
    26 
    27 
    28 # define DO_ENGAGE_EVENT2(so, fdset0, fdset1, label) \
     23# define DO_ENGAGE_EVENT1(so, fdset, label)          \
    2924    do {                                             \
    30         FD_SET((so)->s, (fdset0));                   \
    31         FD_SET((so)->s, (fdset1));                   \
     25        FD_SET((so)->s, (fdset));                    \
    3226        UPD_NFDS((so)->s);                           \
    3327    } while(0)
     28
     29
     30# define DO_ENGAGE_EVENT2(so, fdset1, fdset2, label) \
     31    do {                                             \
     32        FD_SET((so)->s, (fdset1));                   \
     33        FD_SET((so)->s, (fdset2));                   \
     34        UPD_NFDS((so)->s);                           \
     35    } while(0)
     36
    3437#else /* defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) */
    35 # define DO_ENGAGE_EVENT0(so, fdset, label) /* ignore */
    36 
    37 # define DO_ENGAGE_EVENT1(so, fdset0, label)                                                    \
     38
     39/*
     40 * On Windows, we will be notified by IcmpSendEcho2() when the response arrives.
     41 * So no call to WSAEventSelect necessary.
     42 */
     43# define ICMP_ENGAGE_EVENT(so, fdset1, fdset2) \
     44    /* ignore */
     45
     46# define DO_ENGAGE_EVENT1(so, fdset1, label)                                                    \
    3847    do {                                                                                        \
    3948        rc = WSAEventSelect((so)->s, VBOX_SOCKET_EVENT, FD_ALL_EVENTS);                         \
     
    4756    } while(0)
    4857
    49 # define DO_ENGAGE_EVENT2(so, fdset0, fdset1, label) DO_ENGAGE_EVENT1((so), (fdset0), label)
     58# define DO_ENGAGE_EVENT2(so, fdset1, fdset2, label) \
     59    O_ENGAGE_EVENT1((so), (fdset1), label)
     60
    5061#endif /* defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) */
    5162
    52 # define TCP_ENGAGE_EVENT1(so, fdset0)                  \
    53     DO_ENGAGE_EVENT1((so), (fdset0), TCP)
    54 
    55 # define TCP_ENGAGE_EVENT2(so, fdset0, fdset1)          \
    56     DO_ENGAGE_EVENT2((so), (fdset0), (fdset1), TCP)
    57 
    58 #define UDP_ENGAGE_EVENT(so, fdset)                     \
     63#define TCP_ENGAGE_EVENT1(so, fdset) \
     64    DO_ENGAGE_EVENT1((so), (fdset), TCP)
     65
     66#define TCP_ENGAGE_EVENT2(so, fdset1, fdset2) \
     67    DO_ENGAGE_EVENT2((so), (fdset1), (fdset2), TCP)
     68
     69#define UDP_ENGAGE_EVENT(so, fdset) \
    5970    DO_ENGAGE_EVENT1((so), (fdset), UDP)
    60 
    61 #define ICMP_ENGAGE_EVENT(so, fdset)                    \
    62     DO_ENGAGE_EVENT0((so), (fdset), UDP)
    6371
    6472static const uint8_t special_ethaddr[6] = {
     
    595603            }
    596604        }
    597         ICMP_ENGAGE_EVENT(&pData->icmp_socket, readfds);
    598         ICMP_ENGAGE_EVENT(&pData->icmp_socket, writefds);
     605        ICMP_ENGAGE_EVENT(&pData->icmp_socket, readfds, writefds);
    599606    }
    600607
     
    718725                    tcp_connect(pData, so);
    719726#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    720                     if (!NetworkEvents.lNetworkEvents & FD_CLOSE)
     727                    if (!(NetworkEvents.lNetworkEvents & FD_CLOSE))
    721728#endif
    722729                        continue;
     
    881888            }
    882889        }
     890
    883891#if defined(VBOX_WITH_SLIRP_ICMP)
    884892# if defined(RT_OS_WINDOWS)
Note: See TracChangeset for help on using the changeset viewer.

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