VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/AudioTestService.h@ 89583

Last change on this file since 89583 was 89575, checked in by vboxsync, 4 years ago

Audio/ValKit: More code for completely self-contained (self) testing. bugref:10008

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: AudioTestService.h 89575 2021-06-09 09:16:59Z vboxsync $ */
2/** @file
3 * AudioTestService - Audio test execution server, Public Header.
4 */
5
6/*
7 * Copyright (C) 2021 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_Audio_AudioTestService_h
19#define VBOX_INCLUDED_SRC_Audio_AudioTestService_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "AudioTestServiceInternal.h"
25
26
27/** Default TCP/IP port the host ATS (Audio Test Service) is running on. */
28#define ATS_TCP_HOST_DEFAULT_PORT 6052
29/** Default TCP/IP address the host ATS (Audio Test Service) is running on. */
30#define ATS_TCP_HOST_DEFAULT_ADDR_STR "127.0.0.1"
31/** Default TCP/IP port the guest ATS (Audio Test Service) is running on. */
32#define ATS_TCP_GUEST_DEFAULT_PORT 6042
33
34/**
35 * Structure for keeping an Audio Test Service (ATS) callback table.
36 */
37typedef struct ATSCALLBACKS
38{
39 /**
40 * Begins a test set. Optional.
41 *
42 * @returns VBox status code.
43 * @param pvUser User-supplied pointer to context data. Optional.
44 * @param pszTag Tag of test set to begin.
45 */
46 DECLR3CALLBACKMEMBER(int, pfnTestSetBegin, (void const *pvUser, const char *pszTag));
47
48 /**
49 * Ends the current test set. Optional.
50 *
51 * @returns VBox status code.
52 * @param pvUser User-supplied pointer to context data. Optional.
53 * @param pszTag Tag of test set to end.
54 */
55 DECLR3CALLBACKMEMBER(int, pfnTestSetEnd, (void const *pvUser, const char *pszTag));
56
57 /**
58 * Plays a test tone.
59 *
60 * @returns VBox status code.
61 * @param pvUser User-supplied pointer to context data. Optional.
62 * @param pToneParms Tone parameters to use for playback.
63 */
64 DECLR3CALLBACKMEMBER(int, pfnTonePlay, (void const *pvUser, PAUDIOTESTTONEPARMS pToneParms));
65
66 /**
67 * Records a test tone.
68 *
69 * @returns VBox status code.
70 * @param pvUser User-supplied pointer to context data. Optional.
71 * @param pToneParms Tone parameters to use for recording.
72 */
73 DECLR3CALLBACKMEMBER(int, pfnToneRecord, (void const *pvUser, PAUDIOTESTTONEPARMS pToneParms));
74
75 /** Pointer to opaque user-provided context data. */
76 void const *pvUser;
77} ATSCALLBACKS;
78/** Pointer to a const ATS callbacks table. */
79typedef const struct ATSCALLBACKS *PCATSCALLBACKS;
80
81/**
82 * Structure for keeping Audio Test Service (ATS) transport instance-specific data.
83 *
84 * Currently only TCP/IP is supported.
85 */
86typedef struct ATSTRANSPORTINST
87{
88 /** The addresses to bind to. Empty string means any. */
89 char szTcpBindAddr[256];
90 /** The TCP port to listen to. */
91 uint32_t uTcpBindPort;
92 /** Pointer to the TCP server instance. */
93 PRTTCPSERVER pTcpServer;
94} ATSTRANSPORTINST;
95/** Pointer to an Audio Test Service (ATS) TCP/IP transport instance. */
96typedef ATSTRANSPORTINST *PATSTRANSPORTINSTTCP;
97
98/**
99 * Structure for keeping an Audio Test Service (ATS) instance.
100 */
101typedef struct ATSSERVER
102{
103 /** The selected transport layer. */
104 PCATSTRANSPORT pTransport;
105 /** The transport instance. */
106 ATSTRANSPORTINST TransportInst;
107 /** The callbacks table. */
108 ATSCALLBACKS Callbacks;
109 /** Whether server is in started state or not. */
110 bool volatile fStarted;
111 /** Whether to terminate or not. */
112 bool volatile fTerminate;
113 /** The main thread's poll set to handle new clients. */
114 RTPOLLSET hPollSet;
115 /** Pipe for communicating with the serving thread about new clients. - read end */
116 RTPIPE hPipeR;
117 /** Pipe for communicating with the serving thread about new clients. - write end */
118 RTPIPE hPipeW;
119 /** Main thread waiting for connections. */
120 RTTHREAD hThreadMain;
121 /** Thread serving connected clients. */
122 RTTHREAD hThreadServing;
123 /** Critical section protecting the list of new clients. */
124 RTCRITSECT CritSectClients;
125 /** List of new clients waiting to be picked up by the client worker thread. */
126 RTLISTANCHOR LstClientsNew;
127} ATSSERVER;
128/** Pointer to an Audio Test Service (ATS) instance. */
129typedef ATSSERVER *PATSSERVER;
130
131int AudioTestSvcInit(PATSSERVER pThis, const char *pszBindAddr, uint32_t uBindPort, PCATSCALLBACKS pCallbacks);
132int AudioTestSvcDestroy(PATSSERVER pThis);
133int AudioTestSvcStart(PATSSERVER pThis);
134int AudioTestSvcShutdown(PATSSERVER pThis);
135
136#endif /* !VBOX_INCLUDED_SRC_Audio_AudioTestService_h */
137
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