- Timestamp:
- Aug 25, 2021 4:20:14 PM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTestServiceClient.cpp
r90830 r90887 513 513 static int audioTestSvcClientCloseInternal(PATSCLIENT pClient) 514 514 { 515 if (!pClient->pTransportClient) /* Not connected (yet)? Bail out early. */ 516 return VINF_SUCCESS; 517 515 518 int rc = audioTestSvcClientDoBye(pClient); 516 519 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Devices/Audio/AudioTestServiceTcp.cpp
r90868 r90887 786 786 if (RT_FAILURE(rc)) 787 787 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "TCP bind address is too long (%Rrc)", rc); 788 if (!pThis->szBindAddr[0]) 789 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "No TCP bind address specified: %s", pThis->szBindAddr); 788 790 return VINF_SUCCESS; 789 791 790 792 case ATSTCPOPT_BIND_PORT: 791 pThis->uBindPort = pVal->u16 == 0 ? ATS_TCP_DEF_BIND_PORT_GUEST : pVal->u16;793 pThis->uBindPort = pVal->u16; 792 794 return VINF_SUCCESS; 793 795 … … 797 799 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "TCP connect address is too long (%Rrc)", rc); 798 800 if (!pThis->szConnectAddr[0]) 799 strcpy(pThis->szConnectAddr, ATS_TCP_DEF_CONNECT_GUEST_STR);801 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "No TCP connect address specified"); 800 802 return VINF_SUCCESS; 801 803 802 804 case ATSTCPOPT_CONNECT_PORT: 803 pThis->uConnectPort = pVal->u16 == 0 ? ATS_TCP_DEF_BIND_PORT_GUEST : pVal->u16;805 pThis->uConnectPort = pVal->u16; 804 806 return VINF_SUCCESS; 805 807 -
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r90851 r90887 130 130 VKAT_TEST_OPT_TAG, 131 131 VKAT_TEST_OPT_TEMPDIR, 132 VKAT_TEST_OPT_VOL 132 VKAT_TEST_OPT_VOL, 133 VKAT_TEST_OPT_TCP_BIND_ADDRESS, 134 VKAT_TEST_OPT_TCP_BIND_PORT, 135 VKAT_TEST_OPT_TCP_CONNECT_ADDRESS, 136 VKAT_TEST_OPT_TCP_CONNECT_PORT 133 137 }; 134 138 … … 159 163 static const RTGETOPTDEF g_aCmdTestOptions[] = 160 164 { 161 { "--backend", 'b', RTGETOPT_REQ_STRING }, 162 { "--drvaudio", 'd', RTGETOPT_REQ_NOTHING }, 163 { "--exclude", 'e', RTGETOPT_REQ_UINT32 }, 164 { "--exclude-all", 'a', RTGETOPT_REQ_NOTHING }, 165 { "--guest-ats-addr", VKAT_TEST_OPT_GUEST_ATS_ADDR, RTGETOPT_REQ_STRING }, 166 { "--guest-ats-port", VKAT_TEST_OPT_GUEST_ATS_PORT, RTGETOPT_REQ_UINT32 }, 167 { "--host-ats-address", VKAT_TEST_OPT_HOST_ATS_ADDR, RTGETOPT_REQ_STRING }, 168 { "--host-ats-port", VKAT_TEST_OPT_HOST_ATS_PORT, RTGETOPT_REQ_UINT32 }, 169 { "--include", 'i', RTGETOPT_REQ_UINT32 }, 170 { "--outdir", VKAT_TEST_OPT_OUTDIR, RTGETOPT_REQ_STRING }, 171 { "--count", VKAT_TEST_OPT_COUNT, RTGETOPT_REQ_UINT32 }, 172 { "--device", VKAT_TEST_OPT_DEV, RTGETOPT_REQ_STRING }, 173 { "--pause", VKAT_TEST_OPT_PAUSE, RTGETOPT_REQ_UINT32 }, 174 { "--pcm-bit", VKAT_TEST_OPT_PCM_BIT, RTGETOPT_REQ_UINT8 }, 175 { "--pcm-chan", VKAT_TEST_OPT_PCM_CHAN, RTGETOPT_REQ_UINT8 }, 176 { "--pcm-hz", VKAT_TEST_OPT_PCM_HZ, RTGETOPT_REQ_UINT16 }, 177 { "--pcm-signed", VKAT_TEST_OPT_PCM_SIGNED, RTGETOPT_REQ_BOOL }, 178 { "--probe-backends", VKAT_TEST_OPT_PROBE_BACKENDS, RTGETOPT_REQ_NOTHING }, 179 { "--mode", VKAT_TEST_OPT_MODE, RTGETOPT_REQ_STRING }, 180 { "--no-verify", VKAT_TEST_OPT_NO_VERIFY, RTGETOPT_REQ_NOTHING }, 181 { "--tag", VKAT_TEST_OPT_TAG, RTGETOPT_REQ_STRING }, 182 { "--tempdir", VKAT_TEST_OPT_TEMPDIR, RTGETOPT_REQ_STRING }, 183 { "--volume", VKAT_TEST_OPT_VOL, RTGETOPT_REQ_UINT8 } 165 { "--backend", 'b', RTGETOPT_REQ_STRING }, 166 { "--drvaudio", 'd', RTGETOPT_REQ_NOTHING }, 167 { "--exclude", 'e', RTGETOPT_REQ_UINT32 }, 168 { "--exclude-all", 'a', RTGETOPT_REQ_NOTHING }, 169 { "--guest-ats-addr", VKAT_TEST_OPT_GUEST_ATS_ADDR, RTGETOPT_REQ_STRING }, 170 { "--guest-ats-port", VKAT_TEST_OPT_GUEST_ATS_PORT, RTGETOPT_REQ_UINT32 }, 171 { "--host-ats-address", VKAT_TEST_OPT_HOST_ATS_ADDR, RTGETOPT_REQ_STRING }, 172 { "--host-ats-port", VKAT_TEST_OPT_HOST_ATS_PORT, RTGETOPT_REQ_UINT32 }, 173 { "--include", 'i', RTGETOPT_REQ_UINT32 }, 174 { "--outdir", VKAT_TEST_OPT_OUTDIR, RTGETOPT_REQ_STRING }, 175 { "--count", VKAT_TEST_OPT_COUNT, RTGETOPT_REQ_UINT32 }, 176 { "--device", VKAT_TEST_OPT_DEV, RTGETOPT_REQ_STRING }, 177 { "--pause", VKAT_TEST_OPT_PAUSE, RTGETOPT_REQ_UINT32 }, 178 { "--pcm-bit", VKAT_TEST_OPT_PCM_BIT, RTGETOPT_REQ_UINT8 }, 179 { "--pcm-chan", VKAT_TEST_OPT_PCM_CHAN, RTGETOPT_REQ_UINT8 }, 180 { "--pcm-hz", VKAT_TEST_OPT_PCM_HZ, RTGETOPT_REQ_UINT16 }, 181 { "--pcm-signed", VKAT_TEST_OPT_PCM_SIGNED, RTGETOPT_REQ_BOOL }, 182 { "--probe-backends", VKAT_TEST_OPT_PROBE_BACKENDS, RTGETOPT_REQ_NOTHING }, 183 { "--mode", VKAT_TEST_OPT_MODE, RTGETOPT_REQ_STRING }, 184 { "--no-verify", VKAT_TEST_OPT_NO_VERIFY, RTGETOPT_REQ_NOTHING }, 185 { "--tag", VKAT_TEST_OPT_TAG, RTGETOPT_REQ_STRING }, 186 { "--tempdir", VKAT_TEST_OPT_TEMPDIR, RTGETOPT_REQ_STRING }, 187 { "--volume", VKAT_TEST_OPT_VOL, RTGETOPT_REQ_UINT8 }, 188 { "--tcp-bind-addr", VKAT_TEST_OPT_TCP_BIND_ADDRESS, RTGETOPT_REQ_STRING }, 189 { "--tcp-bind-port", VKAT_TEST_OPT_TCP_BIND_PORT, RTGETOPT_REQ_UINT16 }, 190 { "--tcp-connect-addr", VKAT_TEST_OPT_TCP_CONNECT_ADDRESS, RTGETOPT_REQ_STRING }, 191 { "--tcp-connect-port", VKAT_TEST_OPT_TCP_CONNECT_PORT, RTGETOPT_REQ_UINT16 } 184 192 }; 185 193 … … 537 545 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Shutting down guest ATS ...\n"); 538 546 539 int rc2 = AudioTestSvcShutdown(&pTstEnv-> u.Guest.Srv);547 int rc2 = AudioTestSvcShutdown(&pTstEnv->Srv); 540 548 if (RT_SUCCESS(rc)) 541 549 rc = rc2; … … 668 676 switch (pOpt->iShort) 669 677 { 670 case 'a': return "Exclude all tests from the list (useful to enable single tests later with --include)"; 671 case 'b': return "The audio backend to use"; 672 case 'd': return "Go via DrvAudio instead of directly interfacing with the backend"; 673 case 'e': return "Exclude the given test id from the list"; 674 case 'i': return "Include the given test id in the list"; 675 case VKAT_TEST_OPT_COUNT: return "Number of test iterations to perform for selected tests\n" 676 " Default: random number"; 677 case VKAT_TEST_OPT_DEV: return "Name of the input/output device to use\n" 678 " Default: default device"; 679 case VKAT_TEST_OPT_GUEST_ATS_ADDR: return "Address of guest ATS to connect to\n" 680 " Default: " ATS_TCP_DEF_CONNECT_GUEST_STR; 681 case VKAT_TEST_OPT_GUEST_ATS_PORT: return "Port of guest ATS to connect to (needs NAT port forwarding)\n" 682 " Default: 6042"; /* ATS_TCP_DEF_CONNECT_PORT_GUEST */ 683 case VKAT_TEST_OPT_HOST_ATS_ADDR: return "Address of host ATS to connect to\n" 684 " Default: " ATS_TCP_DEF_CONNECT_HOST_ADDR_STR; 685 case VKAT_TEST_OPT_HOST_ATS_PORT: return "Port of host ATS to connect to\n" 686 " Default: 6052"; /* ATS_TCP_DEF_BIND_PORT_VALKIT */ 687 case VKAT_TEST_OPT_MODE: return "Specifies the test mode to use when running the tests"; 688 case VKAT_TEST_OPT_NO_VERIFY: return "Skips the verification step"; 689 case VKAT_TEST_OPT_OUTDIR: return "Specifies the output directory to use"; 690 case VKAT_TEST_OPT_PAUSE: return "Not yet implemented"; 691 case VKAT_TEST_OPT_PCM_HZ: return "Specifies the PCM Hetz (Hz) rate to use\n" 692 " Default: 44100"; 693 case VKAT_TEST_OPT_PCM_BIT: return "Specifies the PCM sample bits (i.e. 16) to use\n" 694 " Default: 16"; 695 case VKAT_TEST_OPT_PCM_CHAN: return "Specifies the number of PCM channels to use\n" 696 " Default: 2"; 697 case VKAT_TEST_OPT_PCM_SIGNED: return "Specifies whether to use signed (true) or unsigned (false) samples\n" 698 " Default: true"; 699 case VKAT_TEST_OPT_PROBE_BACKENDS: return "Specifies whether to probe all (available) backends until a working one is found\n" 700 " Default: false"; 701 case VKAT_TEST_OPT_TAG: return "Specifies the test set tag to use"; 702 case VKAT_TEST_OPT_TEMPDIR: return "Specifies the temporary directory to use"; 703 case VKAT_TEST_OPT_VOL: return "Specifies the audio volume (in percent, 0-100) to use"; 678 case 'a': return "Exclude all tests from the list (useful to enable single tests later with --include)"; 679 case 'b': return "The audio backend to use"; 680 case 'd': return "Go via DrvAudio instead of directly interfacing with the backend"; 681 case 'e': return "Exclude the given test id from the list"; 682 case 'i': return "Include the given test id in the list"; 683 case VKAT_TEST_OPT_COUNT: return "Number of test iterations to perform for selected tests\n" 684 " Default: random number"; 685 case VKAT_TEST_OPT_DEV: return "Name of the input/output device to use\n" 686 " Default: default device"; 687 case VKAT_TEST_OPT_GUEST_ATS_ADDR: return "Address of guest ATS to connect to\n" 688 " Default: " ATS_TCP_DEF_CONNECT_GUEST_STR; 689 case VKAT_TEST_OPT_GUEST_ATS_PORT: return "Port of guest ATS to connect to (needs NAT port forwarding)\n" 690 " Default: 6042"; /* ATS_TCP_DEF_CONNECT_PORT_GUEST */ 691 case VKAT_TEST_OPT_HOST_ATS_ADDR: return "Address of host ATS to connect to\n" 692 " Default: " ATS_TCP_DEF_CONNECT_HOST_ADDR_STR; 693 case VKAT_TEST_OPT_HOST_ATS_PORT: return "Port of host ATS to connect to\n" 694 " Default: 6052"; /* ATS_TCP_DEF_BIND_PORT_VALKIT */ 695 case VKAT_TEST_OPT_MODE: return "Specifies the test mode to use when running the tests"; 696 case VKAT_TEST_OPT_NO_VERIFY: return "Skips the verification step"; 697 case VKAT_TEST_OPT_OUTDIR: return "Specifies the output directory to use"; 698 case VKAT_TEST_OPT_PAUSE: return "Not yet implemented"; 699 case VKAT_TEST_OPT_PCM_HZ: return "Specifies the PCM Hetz (Hz) rate to use\n" 700 " Default: 44100"; 701 case VKAT_TEST_OPT_PCM_BIT: return "Specifies the PCM sample bits (i.e. 16) to use\n" 702 " Default: 16"; 703 case VKAT_TEST_OPT_PCM_CHAN: return "Specifies the number of PCM channels to use\n" 704 " Default: 2"; 705 case VKAT_TEST_OPT_PCM_SIGNED: return "Specifies whether to use signed (true) or unsigned (false) samples\n" 706 " Default: true"; 707 case VKAT_TEST_OPT_PROBE_BACKENDS: return "Specifies whether to probe all (available) backends until a working one is found\n" 708 " Default: false"; 709 case VKAT_TEST_OPT_TAG: return "Specifies the test set tag to use"; 710 case VKAT_TEST_OPT_TEMPDIR: return "Specifies the temporary directory to use"; 711 case VKAT_TEST_OPT_VOL: return "Specifies the audio volume (in percent, 0-100) to use"; 712 case VKAT_TEST_OPT_TCP_BIND_ADDRESS: return "Specifies the TCP address listening to (server mode)"; 713 case VKAT_TEST_OPT_TCP_BIND_PORT: return "Specifies the TCP port listening to (server mode)"; 714 case VKAT_TEST_OPT_TCP_CONNECT_ADDRESS: return "Specifies the TCP address to connect to (client mode)"; 715 case VKAT_TEST_OPT_TCP_CONNECT_PORT: return "Specifies the TCP port to connect to (client mode)"; 704 716 default: 705 717 break; … … 719 731 RT_ZERO(TstEnv); 720 732 721 int rc = AudioTestSvcCreate(&TstEnv.u.Guest.Srv); 733 int rc = AudioTestSvcCreate(&TstEnv.Srv); 734 if (RT_FAILURE(rc)) 735 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Creating ATS service instance failed with %Rrc\n", rc); 722 736 723 737 const char *pszTag = NULL; /* Custom tag to use. Can be NULL if not being used. */ … … 846 860 break; 847 861 862 case VKAT_TEST_OPT_TCP_BIND_ADDRESS: 863 rc = RTStrCopy(TstEnv.TcpOpts.szBindAddr, sizeof(TstEnv.TcpOpts.szBindAddr), ValueUnion.psz); 864 if (RT_FAILURE(rc)) 865 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Bind address invalid, rc=%Rrc", rc); 866 break; 867 868 case VKAT_TEST_OPT_TCP_BIND_PORT: 869 TstEnv.TcpOpts.uBindPort = ValueUnion.u16; 870 break; 871 872 case VKAT_TEST_OPT_TCP_CONNECT_ADDRESS: 873 rc = RTStrCopy(TstEnv.TcpOpts.szConnectAddr, sizeof(TstEnv.TcpOpts.szConnectAddr), ValueUnion.psz); 874 if (RT_FAILURE(rc)) 875 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Connect address invalid, rc=%Rrc", rc); 876 break; 877 878 case VKAT_TEST_OPT_TCP_CONNECT_PORT: 879 TstEnv.TcpOpts.uConnectPort = ValueUnion.u16; 880 break; 881 848 882 AUDIO_TEST_COMMON_OPTION_CASES(ValueUnion); 849 883 850 884 default: 851 rc = AudioTestSvcHandleOption(&TstEnv.u.Guest.Srv, ch, &ValueUnion); 852 if (RT_FAILURE(rc)) 853 return RTGetOptPrintError(ch, &ValueUnion); 885 return RTGetOptPrintError(ch, &ValueUnion); 854 886 } 855 887 } … … 867 899 if (TstEnv.enmMode == AUDIOTESTMODE_UNKNOWN) 868 900 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "No test mode (--mode) specified!\n"); 901 902 /* Validate TCP options. */ 903 if ( TstEnv.TcpOpts.szBindAddr[0] 904 && TstEnv.TcpOpts.szConnectAddr[0]) 905 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Only one TCP connection mode (connect as client *or* bind as server) can be specified) at a time!\n"); 869 906 870 907 AUDIOTESTDRVSTACK DrvStack; -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r90830 r90887 79 79 /* Tweak the address the guest ATS is trying to connect to the host if anything else is specified. 80 80 * Note: The host also runs on the same host (this self-test is completely self-contained and does not need a VM). */ 81 if (!pTstEnv-> u.Guest.TcpOpts.szTcpConnectAddr[0])82 RTStrCopy(pTstEnv-> u.Guest.TcpOpts.szTcpConnectAddr, sizeof(pTstEnv->u.Guest.TcpOpts.szTcpConnectAddr), "127.0.0.1");83 84 int rc = AudioTestSvcCreate(&pTstEnv-> u.Guest.Srv);81 if (!pTstEnv->TcpOpts.szConnectAddr[0]) 82 RTStrCopy(pTstEnv->TcpOpts.szConnectAddr, sizeof(pTstEnv->TcpOpts.szConnectAddr), "127.0.0.1"); 83 84 int rc = AudioTestSvcCreate(&pTstEnv->Srv); 85 85 AssertRCReturn(rc, rc); 86 86 -
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r90868 r90887 695 695 * @param pClient Client to connect. 696 696 * @param pszWhat Hint of what to connect to where. 697 * @param pszTcpBindAddr TCP/IP bind address. Optionl and can be NULL. 698 * Server mode will be disabled then. 699 * @param uTcpBindPort TCP/IP bind port. Optionl and can be 0. 700 * Server mode will be disabled then. * 701 * @param pszTcpConnectAddr TCP/IP connect address. Optionl and can be NULL. 702 * Client mode will be disabled then. 703 * @param uTcpConnectPort TCP/IP connect port. Optionl and can be 0. 704 * Client mode will be disabled then. 705 */ 706 int audioTestEnvConnectViaTcp(PAUDIOTESTENV pTstEnv, PATSCLIENT pClient, const char *pszWhat, 707 const char *pszTcpBindAddr, uint16_t uTcpBindPort, 708 const char *pszTcpConnectAddr, uint16_t uTcpConnectPort) 697 * @param pTcpOpts Pointer to TCP options to use. 698 */ 699 int audioTestEnvConnectViaTcp(PAUDIOTESTENV pTstEnv, PATSCLIENT pClient, const char *pszWhat, PAUDIOTESTENVTCPOPTS pTcpOpts) 709 700 { 710 701 RT_NOREF(pTstEnv); … … 715 706 int rc; 716 707 717 if ( !pszTcpBindAddr 718 || !uTcpBindPort) 708 if (!pTcpOpts->szBindAddr[0]) 719 709 { 720 710 Val.psz = "client"; 721 711 } 722 else if ( !pszTcpConnectAddr 723 || !uTcpConnectPort) 712 else if (!pTcpOpts->szConnectAddr[0]) 724 713 { 725 714 Val.psz = "server"; … … 735 724 if ( !RTStrCmp(Val.psz, "client") 736 725 || !RTStrCmp(Val.psz, "both")) 737 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Connecting to %s:%RU32\n", pszTcpConnectAddr, uTcpConnectPort); 726 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Connecting to %s:%RU32\n", 727 pTcpOpts->szConnectAddr, pTcpOpts->uConnectPort); 738 728 739 729 if ( !RTStrCmp(Val.psz, "server") 740 730 || !RTStrCmp(Val.psz, "both")) 741 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Listening at %s:%RU32\n", pszTcpBindAddr ? pszTcpBindAddr : "<None>", uTcpBindPort); 742 743 if (pszTcpBindAddr) 744 { 745 Val.psz = pszTcpBindAddr; 731 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Listening at %s:%RU32\n", 732 pTcpOpts->szBindAddr ? pTcpOpts->szBindAddr : "<None>", pTcpOpts->uBindPort); 733 734 if (pTcpOpts->szBindAddr[0]) 735 { 736 Val.psz = pTcpOpts->szBindAddr; 746 737 rc = AudioTestSvcClientHandleOption(pClient, ATSTCPOPT_BIND_ADDRESS, &Val); 747 738 AssertRCReturn(rc, rc); 748 739 } 749 740 750 if ( uTcpBindPort)751 { 752 Val.u16 = uTcpBindPort;741 if (pTcpOpts->uBindPort) 742 { 743 Val.u16 = pTcpOpts->uBindPort; 753 744 rc = AudioTestSvcClientHandleOption(pClient, ATSTCPOPT_BIND_PORT, &Val); 754 745 AssertRCReturn(rc, rc); 755 746 } 756 747 757 if (p szTcpConnectAddr)758 { 759 Val.psz = p szTcpConnectAddr;748 if (pTcpOpts->szConnectAddr[0]) 749 { 750 Val.psz = pTcpOpts->szConnectAddr; 760 751 rc = AudioTestSvcClientHandleOption(pClient, ATSTCPOPT_CONNECT_ADDRESS, &Val); 761 752 AssertRCReturn(rc, rc); 762 753 } 763 754 764 if ( uTcpConnectPort)765 { 766 Val.u16 = uTcpConnectPort;755 if (pTcpOpts->uConnectPort) 756 { 757 Val.u16 = pTcpOpts->uConnectPort; 767 758 rc = AudioTestSvcClientHandleOption(pClient, ATSTCPOPT_CONNECT_PORT, &Val); 768 759 AssertRCReturn(rc, rc); … … 787 778 * @param pCallbacks ATS callback table to use. 788 779 * @param pszDesc Hint of server type which is being started. 789 * @param pszTcpBindAddr TCP/IP bind address. Optionl and can be NULL. 790 * Server mode will be disabled then. 791 * @param uTcpBindPort TCP/IP bind port. Optionl and can be 0. 792 * Server mode will be disabled then. * 793 * @param pszTcpConnectAddr TCP/IP connect address. Optionl and can be NULL. 794 * Client mode will be disabled then. 795 * @param uTcpConnectPort TCP/IP connect port. Optionl and can be 0. 796 * Client mode will be disabled then. 780 * @param pTcpOpts TCP options to use. 797 781 */ 798 782 int audioTestEnvConfigureAndStartTcpServer(PATSSERVER pSrv, PCATSCALLBACKS pCallbacks, const char *pszDesc, 799 const char *pszTcpBindAddr, uint16_t uTcpBindPort, 800 const char *pszTcpConnectAddr, uint16_t uTcpConnectPort) 783 PAUDIOTESTENVTCPOPTS pTcpOpts) 801 784 { 802 785 RTGETOPTUNION Val; 803 786 RT_ZERO(Val); 804 787 805 if (p szTcpBindAddr)806 { 807 Val.psz = p szTcpBindAddr;788 if (pTcpOpts->szBindAddr[0]) 789 { 790 Val.psz = pTcpOpts->szBindAddr; 808 791 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_BIND_ADDRESS, &Val); 809 792 } 810 793 811 if ( uTcpBindPort)812 { 813 Val.u16 = uTcpBindPort;794 if (pTcpOpts->uBindPort) 795 { 796 Val.u16 = pTcpOpts->uBindPort; 814 797 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_BIND_PORT, &Val); 815 798 } 816 799 817 if (p szTcpConnectAddr)818 { 819 Val.psz = p szTcpConnectAddr;800 if (pTcpOpts->szConnectAddr[0]) 801 { 802 Val.psz = pTcpOpts->szConnectAddr; 820 803 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONNECT_ADDRESS, &Val); 821 804 } 822 805 823 if ( uTcpConnectPort)824 { 825 Val.u16 = uTcpConnectPort;806 if (pTcpOpts->uConnectPort) 807 { 808 Val.u16 = pTcpOpts->uConnectPort; 826 809 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONNECT_PORT, &Val); 827 810 } 828 811 829 812 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Starting server for %s at %s:%RU32 ...\n", 830 pszDesc, p szTcpBindAddr[0] ? pszTcpBindAddr : "0.0.0.0", uTcpBindPort);831 if (p szTcpConnectAddr[0])813 pszDesc, pTcpOpts->szBindAddr[0] ? pTcpOpts->szBindAddr : "0.0.0.0", pTcpOpts->uBindPort); 814 if (pTcpOpts->szConnectAddr[0]) 832 815 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Trying %s to connect as client to %s:%RU32 ...\n", 833 pszDesc, p szTcpConnectAddr[0] ? pszTcpConnectAddr : "0.0.0.0", uTcpConnectPort);816 pszDesc, pTcpOpts->szConnectAddr[0] ? pTcpOpts->szConnectAddr : "0.0.0.0", pTcpOpts->uConnectPort); 834 817 835 818 int rc = AudioTestSvcInit(pSrv, pCallbacks); … … 918 901 if (RT_FAILURE(rc)) 919 902 return rc; 903 904 /** 905 * For NAT'ed VMs we use (default): 906 * - client mode (uConnectAddr / uConnectPort) on the guest. 907 * - server mode (uBindAddr / uBindPort) on the host. 908 */ 909 if ( !pTstEnv->TcpOpts.szConnectAddr[0] 910 && !pTstEnv->TcpOpts.szBindAddr[0]) 911 RTStrCopy(pTstEnv->TcpOpts.szBindAddr, sizeof(pTstEnv->TcpOpts.szBindAddr), "0.0.0.0"); 920 912 921 913 if (pTstEnv->enmMode == AUDIOTESTMODE_GUEST) … … 937 929 Callbacks.pvUser = &Ctx; 938 930 939 if (!pTstEnv->u.Guest.TcpOpts.uTcpBindPort) 940 pTstEnv->u.Guest.TcpOpts.uTcpBindPort = ATS_TCP_DEF_BIND_PORT_GUEST; 941 942 if (!pTstEnv->u.Guest.TcpOpts.szTcpBindAddr[0]) 943 RTStrCopy(pTstEnv->u.Guest.TcpOpts.szTcpBindAddr, sizeof(pTstEnv->u.Guest.TcpOpts.szTcpBindAddr), "0.0.0.0"); 944 945 if (!pTstEnv->u.Guest.TcpOpts.uTcpConnectPort) 946 pTstEnv->u.Guest.TcpOpts.uTcpConnectPort = ATS_TCP_DEF_CONNECT_PORT_GUEST; 947 948 if (!pTstEnv->u.Guest.TcpOpts.szTcpConnectAddr[0]) 949 RTStrCopy(pTstEnv->u.Guest.TcpOpts.szTcpConnectAddr, sizeof(pTstEnv->u.Guest.TcpOpts.szTcpConnectAddr), "10.0.2.2"); 931 if (!pTstEnv->TcpOpts.uBindPort) 932 pTstEnv->TcpOpts.uBindPort = ATS_TCP_DEF_BIND_PORT_GUEST; 933 934 if (!pTstEnv->TcpOpts.uConnectPort) 935 pTstEnv->TcpOpts.uConnectPort = ATS_TCP_DEF_CONNECT_PORT_GUEST; 936 937 /** 938 * Note: Don't set pTstEnv->TcpOpts.szTcpConnectAddr by default here, as this specifies what connection mode 939 * (client / server / both) we use on the guest. 940 */ 950 941 951 942 /* … … 956 947 * Note that we have to bind to "0.0.0.0" by default so that the host can connect to it. 957 948 */ 958 rc = audioTestEnvConfigureAndStartTcpServer(&pTstEnv->u.Guest.Srv, &Callbacks, "Guest ATS", 959 pTstEnv->u.Guest.TcpOpts.szTcpBindAddr, pTstEnv->u.Guest.TcpOpts.uTcpBindPort, 960 pTstEnv->u.Guest.TcpOpts.szTcpConnectAddr, pTstEnv->u.Guest.TcpOpts.uTcpConnectPort); 961 949 rc = audioTestEnvConfigureAndStartTcpServer(&pTstEnv->Srv, &Callbacks, "Guest ATS", &pTstEnv->TcpOpts); 962 950 } 963 951 else /* Host mode */ … … 969 957 ATSCALLBACKS Callbacks; 970 958 RT_ZERO(Callbacks); 971 Callbacks.pvUser = &Ctx; 972 973 if (!pTstEnv->u.Host.TcpOpts.uTcpBindPort) 974 pTstEnv->u.Host.TcpOpts.uTcpBindPort = ATS_TCP_DEF_BIND_PORT_HOST; 975 976 if (!pTstEnv->u.Host.TcpOpts.szTcpBindAddr[0]) 977 RTStrCopy(pTstEnv->u.Host.TcpOpts.szTcpBindAddr, sizeof(pTstEnv->u.Host.TcpOpts.szTcpBindAddr), "0.0.0.0"); 978 979 if (!pTstEnv->u.Host.TcpOpts.uTcpConnectPort) 980 pTstEnv->u.Host.TcpOpts.uTcpConnectPort = ATS_TCP_DEF_CONNECT_PORT_HOST_PORT_FWD; 981 982 if (!pTstEnv->u.Host.TcpOpts.szTcpConnectAddr[0]) 983 RTStrCopy(pTstEnv->u.Host.TcpOpts.szTcpConnectAddr, sizeof(pTstEnv->u.Host.TcpOpts.szTcpConnectAddr), 984 ATS_TCP_DEF_CONNECT_HOST_ADDR_STR); /** @todo Get VM IP? Needs port forwarding. */ 959 Callbacks.pvUser = &Ctx; 960 961 if (!pTstEnv->TcpOpts.uBindPort) 962 pTstEnv->TcpOpts.uBindPort = ATS_TCP_DEF_BIND_PORT_HOST; 963 964 if (!pTstEnv->TcpOpts.uConnectPort) 965 pTstEnv->TcpOpts.uConnectPort = ATS_TCP_DEF_CONNECT_PORT_HOST_PORT_FWD; 966 967 /** 968 * Note: Don't set pTstEnv->TcpOpts.szTcpConnectAddr by default here, as this specifies what connection mode 969 * (client / server / both) we use on the host. 970 */ 985 971 986 972 /* We need to start a server on the host so that VMs configured with NAT networking … … 989 975 if (RT_SUCCESS(rc)) 990 976 rc = audioTestEnvConnectViaTcp(pTstEnv, &pTstEnv->u.Host.AtsClGuest, 991 "Host -> Guest ATS", 992 pTstEnv->u.Host.TcpOpts.szTcpBindAddr, pTstEnv->u.Host.TcpOpts.uTcpBindPort, 993 pTstEnv->u.Host.TcpOpts.szTcpConnectAddr, pTstEnv->u.Host.TcpOpts.uTcpConnectPort); 977 "Host -> Guest ATS", &pTstEnv->TcpOpts); 994 978 if (RT_SUCCESS(rc)) 995 979 { 996 if (!pTstEnv->ValKitTcpOpts.uTcpConnectPort)997 pTstEnv->ValKitTcpOpts.uTcpConnectPort = ATS_TCP_DEF_CONNECT_PORT_VALKIT;998 999 if (!pTstEnv->ValKitTcpOpts.szTcpConnectAddr[0])1000 RTStrCopy(pTstEnv->ValKitTcpOpts.szTcpConnectAddr, sizeof(pTstEnv->ValKitTcpOpts.szTcpConnectAddr),1001 ATS_TCP_DEF_CONNECT_HOST_ADDR_STR);980 AUDIOTESTENVTCPOPTS ValKitTcpOpts; 981 RT_ZERO(ValKitTcpOpts); 982 983 /* For now we ASSUME that the Validation Kit audio driver ATS runs on the same host as VKAT (this binary) runs on. */ 984 ValKitTcpOpts.uConnectPort = ATS_TCP_DEF_CONNECT_PORT_VALKIT; /** @todo Make this dynamic. */ 985 RTStrCopy(ValKitTcpOpts.szConnectAddr, sizeof(ValKitTcpOpts.szConnectAddr), ATS_TCP_DEF_CONNECT_HOST_ADDR_STR); /** @todo Ditto. */ 1002 986 1003 987 rc = AudioTestSvcClientCreate(&pTstEnv->u.Host.AtsClValKit); 1004 988 if (RT_SUCCESS(rc)) 1005 989 rc = audioTestEnvConnectViaTcp(pTstEnv, &pTstEnv->u.Host.AtsClValKit, 1006 "Host -> Validation Kit Host Audio Driver ATS", 1007 pTstEnv->ValKitTcpOpts.szTcpBindAddr, pTstEnv->ValKitTcpOpts.uTcpBindPort, 1008 pTstEnv->ValKitTcpOpts.szTcpConnectAddr, pTstEnv->ValKitTcpOpts.uTcpConnectPort); 990 "Host -> Validation Kit Host Audio Driver ATS", &ValKitTcpOpts); 1009 991 } 1010 992 } -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r90766 r90887 183 183 { 184 184 /** Bind address (server mode). When empty, "0.0.0.0" (any host) will be used. */ 185 char sz TcpBindAddr[128];185 char szBindAddr[128]; 186 186 /** Bind port (server mode). */ 187 uint16_t u TcpBindPort;187 uint16_t uBindPort; 188 188 /** Connection address (client mode). */ 189 char sz TcpConnectAddr[128];189 char szConnectAddr[128]; 190 190 /** Connection port (client mode). */ 191 uint16_t u TcpConnectPort;191 uint16_t uConnectPort; 192 192 } AUDIOTESTENVTCPOPTS; 193 /** Pointer to audio test TCP options. */ 193 194 typedef AUDIOTESTENVTCPOPTS *PAUDIOTESTENVTCPOPTS; 194 195 … … 231 232 /** The audio test set to use. */ 232 233 AUDIOTESTSET Set; 234 /** TCP options to use for ATS. */ 235 AUDIOTESTENVTCPOPTS TcpOpts; 236 /** ATS server instance to use. */ 237 ATSSERVER Srv; 233 238 union 234 239 { 235 240 struct 236 241 { 237 AUDIOTESTENVTCPOPTS TcpOpts;238 /** ATS instance to use. */239 ATSSERVER Srv;240 } Guest;241 struct242 {243 AUDIOTESTENVTCPOPTS TcpOpts;244 /** ATS instance to use. */245 ATSSERVER Srv;246 242 /** Client connected to the ATS on the guest side. */ 247 243 ATSCLIENT AtsClGuest; … … 254 250 } Host; 255 251 } u; 256 AUDIOTESTENVTCPOPTS ValKitTcpOpts;257 252 } AUDIOTESTENV; 258 253
Note:
See TracChangeset
for help on using the changeset viewer.