VirtualBox

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

Last change on this file since 89551 was 89541, checked in by vboxsync, 3 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.8 KB
Line 
1/* $Id: AudioTestService.h 89541 2021-06-07 09:26:07Z 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 ATS (Audio Test Service) is running on. */
28#define ATS_TCP_DEFAULT_PORT 6052
29/** Alternative TCP/IP port the ATS (Audio Test Service) is running on. */
30#define ATS_TCP_ALT_PORT 6042
31
32/**
33 * Structure for keeping an Audio Test Service (ATS) callback table.
34 */
35typedef struct ATSCALLBACKS
36{
37 /**
38 * Begins a test set. Optional.
39 *
40 * @returns VBox status code.
41 * @param pvUser User-supplied pointer to context data. Optional.
42 * @param pszTag Tag of test set to begin.
43 */
44 DECLR3CALLBACKMEMBER(int, pfnTestSetBegin, (void const *pvUser, const char *pszTag));
45
46 /**
47 * Ends the current test set. Optional.
48 *
49 * @returns VBox status code.
50 * @param pvUser User-supplied pointer to context data. Optional.
51 * @param pszTag Tag of test set to end.
52 */
53 DECLR3CALLBACKMEMBER(int, pfnTestSetEnd, (void const *pvUser, const char *pszTag));
54
55 /**
56 * Plays a test tone.
57 *
58 * @returns VBox status code.
59 * @param pvUser User-supplied pointer to context data. Optional.
60 * @param pToneParms Tone parameters to use for playback.
61 */
62 DECLR3CALLBACKMEMBER(int, pfnTonePlay, (void const *pvUser, PAUDIOTESTTONEPARMS pToneParms));
63
64 /**
65 * Records a test tone.
66 *
67 * @returns VBox status code.
68 * @param pvUser User-supplied pointer to context data. Optional.
69 * @param pToneParms Tone parameters to use for recording.
70 */
71 DECLR3CALLBACKMEMBER(int, pfnToneRecord, (void const *pvUser, PAUDIOTESTTONEPARMS pToneParms));
72
73 /** Pointer to opaque user-provided context data. */
74 void const *pvUser;
75} ATSCALLBACKS;
76/** Pointer to a const ATS callbacks table. */
77typedef const struct ATSCALLBACKS *PCATSCALLBACKS;
78
79/**
80 * Structure for keeping Audio Test Service (ATS) transport instance-specific data.
81 *
82 * Currently only TCP/IP is supported.
83 */
84typedef struct ATSTRANSPORTINST
85{
86 /** The addresses to bind to. Empty string means any. */
87 char szTcpBindAddr[256];
88 /** The TCP port to listen to. */
89 uint32_t uTcpBindPort;
90 /** Pointer to the TCP server instance. */
91 PRTTCPSERVER pTcpServer;
92} ATSTRANSPORTINST;
93/** Pointer to an Audio Test Service (ATS) TCP/IP transport instance. */
94typedef ATSTRANSPORTINST *PATSTRANSPORTINSTTCP;
95
96/**
97 * Structure for keeping an Audio Test Service (ATS) instance.
98 */
99typedef struct ATSSERVER
100{
101 /** The selected transport layer. */
102 PCATSTRANSPORT pTransport;
103 /** The transport instance. */
104 ATSTRANSPORTINST TransportInst;
105 /** The callbacks table. */
106 ATSCALLBACKS Callbacks;
107 /** Whether server is in started state or not. */
108 bool volatile fStarted;
109 /** Whether to terminate or not. */
110 bool volatile fTerminate;
111 /** The main thread's poll set to handle new clients. */
112 RTPOLLSET hPollSet;
113 /** Pipe for communicating with the serving thread about new clients. - read end */
114 RTPIPE hPipeR;
115 /** Pipe for communicating with the serving thread about new clients. - write end */
116 RTPIPE hPipeW;
117 /** Main thread waiting for connections. */
118 RTTHREAD hThreadMain;
119 /** Thread serving connected clients. */
120 RTTHREAD hThreadServing;
121 /** Critical section protecting the list of new clients. */
122 RTCRITSECT CritSectClients;
123 /** List of new clients waiting to be picked up by the client worker thread. */
124 RTLISTANCHOR LstClientsNew;
125} ATSSERVER;
126/** Pointer to an Audio Test Service (ATS) instance. */
127typedef ATSSERVER *PATSSERVER;
128
129int AudioTestSvcInit(PATSSERVER pThis, const char *pszBindAddr, uint32_t uBindPort, PCATSCALLBACKS pCallbacks);
130int AudioTestSvcDestroy(PATSSERVER pThis);
131int AudioTestSvcStart(PATSSERVER pThis);
132int AudioTestSvcShutdown(PATSSERVER pThis);
133
134#endif /* !VBOX_INCLUDED_SRC_Audio_AudioTestService_h */
135
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