VirtualBox

Changeset 90912 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Aug 26, 2021 1:38:34 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146548
Message:

Audio/Validation Kit: More connection mode handling. bugref:10008

Location:
trunk/src/VBox/Devices/Audio
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioTestService.h

    r90830 r90912  
    178178int AudioTestSvcShutdown(PATSSERVER pThis);
    179179
     180/**
     181 * Enumeration for the server connection mode.
     182 * Only applies to certain transport implementation like TCP/IP.
     183 */
     184typedef enum ATSCONNMODE
     185{
     186    /** Both: Uses parallel client and server connection methods (via threads). */
     187    ATSCONNMODE_BOTH = 0,
     188    /** Client only: Connects to a server. */
     189    ATSCONNMODE_CLIENT,
     190    /** Server only: Listens for new incoming client connections. */
     191    ATSCONNMODE_SERVER,
     192    /** 32bit hack. */
     193    ATSCONNMODE_32BIT_HACK = 0x7fffffff
     194} ATSCONNMODE;
     195
    180196/** TCP/IP options for the ATS server.
    181197 *  @todo Make this more abstract later. */
    182198enum ATSTCPOPT
    183199{
    184     ATSTCPOPT_MODE = 5000,
     200    ATSTCPOPT_CONN_MODE = 5000,
    185201    ATSTCPOPT_BIND_ADDRESS,
    186202    ATSTCPOPT_BIND_PORT,
  • trunk/src/VBox/Devices/Audio/AudioTestServiceTcp.cpp

    r90887 r90912  
    6868
    6969/**
    70  * Enumeration for the TCP/IP connection mode.
    71  */
    72 typedef enum ATSTCPMODE
    73 {
    74     /** Both: Uses parallel client and server connection methods (via threads). */
    75     ATSTCPMODE_BOTH = 0,
    76     /** Client only: Connects to a server. */
    77     ATSTCPMODE_CLIENT,
    78     /** Server only: Listens for new incoming client connections. */
    79     ATSTCPMODE_SERVER
    80 } ATSTCPMODE;
    81 
    82 /**
    8370 * Structure for keeping Audio Test Service (ATS) transport instance-specific data.
    8471 */
     
    8875    RTCRITSECT                         CritSect;
    8976    /** Connection mode to use. */
    90     ATSTCPMODE                         enmMode;
     77    ATSCONNMODE                        enmConnMode;
    9178    /** The addresses to bind to.  Empty string means any. */
    9279    char                               szBindAddr[256];
     
    314301    int rc;
    315302
    316     LogFunc(("enmMode=%#x\n", pThis->enmMode));
    317 
    318     if (pThis->enmMode == ATSTCPMODE_SERVER)
     303    LogFunc(("enmConnMode=%#x\n", pThis->enmConnMode));
     304
     305    if (pThis->enmConnMode == ATSCONNMODE_SERVER)
    319306    {
    320307        pClient->fFromServer = true;
     
    322309        LogFunc(("RTTcpServerListen2 -> %Rrc\n", rc));
    323310    }
    324     else if (pThis->enmMode == ATSTCPMODE_CLIENT)
     311    else if (pThis->enmConnMode == ATSCONNMODE_CLIENT)
    325312    {
    326313        pClient->fFromServer = false;
     
    339326    else
    340327    {
    341         Assert(pThis->enmMode == ATSTCPMODE_BOTH);
     328        Assert(pThis->enmConnMode == ATSCONNMODE_BOTH);
    342329
    343330        /*
     
    731718    int rc = VINF_SUCCESS;
    732719
    733     if (pThis->enmMode != ATSTCPMODE_CLIENT)
     720    if (pThis->enmConnMode != ATSCONNMODE_CLIENT)
    734721    {
    735722        rc = RTTcpServerCreateEx(pThis->szBindAddr[0] ? pThis->szBindAddr : NULL, pThis->uBindPort, &pThis->pTcpServer);
     
    771758    switch (ch)
    772759    {
    773         case ATSTCPOPT_MODE:
    774             if (!strcmp(pVal->psz, "both"))
    775                 pThis->enmMode = ATSTCPMODE_BOTH;
    776             else if (!strcmp(pVal->psz, "client"))
    777                 pThis->enmMode = ATSTCPMODE_CLIENT;
    778             else if (!strcmp(pVal->psz, "server"))
    779                 pThis->enmMode = ATSTCPMODE_SERVER;
    780             else
    781                 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "Invalid TCP mode: '%s'\n", pVal->psz);
     760        case ATSTCPOPT_CONN_MODE:
     761            pThis->enmConnMode = (ATSCONNMODE)pVal->u32;
    782762            return VINF_SUCCESS;
    783763
     
    818798{
    819799    RTStrmPrintf(pStream,
    820                  "  --tcp-mode <both|client|server>\n"
    821                  "       Selects the mode of operation.\n"
    822                  "       Default: both\n"
    823                  "  --tcp-bind-address <address>\n"
     800                 "  --tcp-conn-mode <0=both|1=client|2=server>\n"
     801                 "       Selects the connection mode.\n"
     802                 "       Default: 0 (both)\n"
     803                 "  --tcp-bind-addr[ess] <address>\n"
    824804                 "       The address(es) to listen to TCP connection on.  Empty string\n"
    825805                 "       means any address, this is the default.\n"
     
    827807                 "       The port to listen to TCP connections on.\n"
    828808                 "       Default: %u\n"
    829                  "  --tcp-connect-address <address>\n"
     809                 "  --tcp-connect-addr[ess] <address>\n"
    830810                 "       The address of the server to try connect to in client mode.\n"
    831811                 "       Default: " ATS_TCP_DEF_CONNECT_GUEST_STR "\n"
     
    839819static const RTGETOPTDEF  g_TcpOpts[] =
    840820{
    841     { "--tcp-mode",             ATSTCPOPT_MODE,             RTGETOPT_REQ_STRING },
     821    { "--tcp-conn-mode",        ATSTCPOPT_CONN_MODE,        RTGETOPT_REQ_STRING },
     822    { "--tcp-bind-addr",        ATSTCPOPT_BIND_ADDRESS,     RTGETOPT_REQ_STRING },
    842823    { "--tcp-bind-address",     ATSTCPOPT_BIND_ADDRESS,     RTGETOPT_REQ_STRING },
    843824    { "--tcp-bind-port",        ATSTCPOPT_BIND_PORT,        RTGETOPT_REQ_UINT16 },
     825    { "--tcp-connect-addr",     ATSTCPOPT_CONNECT_ADDRESS,  RTGETOPT_REQ_STRING },
    844826    { "--tcp-connect-address",  ATSTCPOPT_CONNECT_ADDRESS,  RTGETOPT_REQ_STRING },
    845827    { "--tcp-connect-port",     ATSTCPOPT_CONNECT_PORT,     RTGETOPT_REQ_UINT16 }
  • trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp

    r90765 r90912  
    11141114        RT_ZERO(Val);
    11151115
    1116         Val.psz = "server"; /** @ŧodo No client connection mode needed here (yet). Make this configurable via CFGM. */
    1117         rc2 = AudioTestSvcHandleOption(&pThis->Srv, ATSTCPOPT_MODE, &Val);
     1116        Val.u32 = ATSCONNMODE_SERVER; /** @todo No client connection mode needed here (yet). Make this configurable via CFGM. */
     1117        rc2 = AudioTestSvcHandleOption(&pThis->Srv, ATSTCPOPT_CONN_MODE, &Val);
    11181118        AssertRC(rc2);
    11191119
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioTestService.cpp

    r90555 r90912  
    8484
    8585        Val.psz = "server";
    86         rc = AudioTestSvcHandleOption(&Srv, ATSTCPOPT_MODE, &Val);
     86        rc = AudioTestSvcHandleOption(&Srv, ATSTCPOPT_CONN_MODE, &Val);
    8787        RTTEST_CHECK_RC_OK(hTest, rc);
    8888
     
    118118
    119119                Val.psz = "client";
    120                 rc = AudioTestSvcClientHandleOption(&Client, ATSTCPOPT_MODE, &Val);
     120                rc = AudioTestSvcClientHandleOption(&Client, ATSTCPOPT_CONN_MODE, &Val);
    121121                RTTEST_CHECK_RC_OK(hTest, rc);
    122122
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