1 | /* $Id: AudioTestService.h 89458 2021-06-02 09:04:06Z 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_DEFAULT_PORT 6052
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Structure for keeping an Audio Test Service (ATS) callback table.
|
---|
32 | */
|
---|
33 | typedef struct ATSCALLBACKS
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Begins a test set. Optional.
|
---|
37 | *
|
---|
38 | * @returns VBox status code.
|
---|
39 | * @param pvUser User-supplied pointer to context data. Optional.
|
---|
40 | * @param pszTag Tag of test set to begin.
|
---|
41 | */
|
---|
42 | DECLR3CALLBACKMEMBER(int, pfnTestSetBegin, (void const *pvUser, const char *pszTag));
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Ends the current test set. Optional.
|
---|
46 | *
|
---|
47 | * @returns VBox status code.
|
---|
48 | * @param pvUser User-supplied pointer to context data. Optional.
|
---|
49 | * @param pszTag Tag of test set to end.
|
---|
50 | */
|
---|
51 | DECLR3CALLBACKMEMBER(int, pfnTestSetEnd, (void const *pvUser, const char *pszTag));
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Plays a test tone.
|
---|
55 | *
|
---|
56 | * @returns VBox status code.
|
---|
57 | * @param pvUser User-supplied pointer to context data. Optional.
|
---|
58 | * @param pToneParms Tone parameters to use for playback.
|
---|
59 | */
|
---|
60 | DECLR3CALLBACKMEMBER(int, pfnTonePlay, (void const *pvUser, PAUDIOTESTTONEPARMS pToneParms));
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Records a test tone.
|
---|
64 | *
|
---|
65 | * @returns VBox status code.
|
---|
66 | * @param pvUser User-supplied pointer to context data. Optional.
|
---|
67 | * @param pToneParms Tone parameters to use for recording.
|
---|
68 | */
|
---|
69 | DECLR3CALLBACKMEMBER(int, pfnToneRecord, (void const *pvUser, PAUDIOTESTTONEPARMS pToneParms));
|
---|
70 |
|
---|
71 | /** Pointer to opaque user-provided context data. */
|
---|
72 | void const *pvUser;
|
---|
73 | } ATSCALLBACKS;
|
---|
74 | /** Pointer to a const ATS callbacks table. */
|
---|
75 | typedef const struct ATSCALLBACKS *PCATSCALLBACKS;
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Structure for keeping an Audio Test Service (ATS) instance.
|
---|
79 | */
|
---|
80 | typedef struct ATSSERVER
|
---|
81 | {
|
---|
82 | /** The selected transport layer. */
|
---|
83 | PCATSTRANSPORT pTransport;
|
---|
84 | /** The callbacks table. */
|
---|
85 | ATSCALLBACKS Callbacks;
|
---|
86 | /** Whether server is in started state or not. */
|
---|
87 | bool volatile fStarted;
|
---|
88 | /** Whether to terminate or not. */
|
---|
89 | bool volatile fTerminate;
|
---|
90 | /** The main thread's poll set to handle new clients. */
|
---|
91 | RTPOLLSET hPollSet;
|
---|
92 | /** Pipe for communicating with the serving thread about new clients. - read end */
|
---|
93 | RTPIPE hPipeR;
|
---|
94 | /** Pipe for communicating with the serving thread about new clients. - write end */
|
---|
95 | RTPIPE hPipeW;
|
---|
96 | /** Main thread waiting for connections. */
|
---|
97 | RTTHREAD hThreadMain;
|
---|
98 | /** Thread serving connected clients. */
|
---|
99 | RTTHREAD hThreadServing;
|
---|
100 | /** Critical section protecting the list of new clients. */
|
---|
101 | RTCRITSECT CritSectClients;
|
---|
102 | /** List of new clients waiting to be picked up by the client worker thread. */
|
---|
103 | RTLISTANCHOR LstClientsNew;
|
---|
104 | } ATSSERVER;
|
---|
105 | /** Pointer to an Audio Test Service (ATS) instance. */
|
---|
106 | typedef ATSSERVER *PATSSERVER;
|
---|
107 |
|
---|
108 | int AudioTestSvcInit(PATSSERVER pThis, PCATSCALLBACKS pCallbacks);
|
---|
109 | int AudioTestSvcDestroy(PATSSERVER pThis);
|
---|
110 | int AudioTestSvcStart(PATSSERVER pThis);
|
---|
111 | int AudioTestSvcShutdown(PATSSERVER pThis);
|
---|
112 |
|
---|
113 | #endif /* !VBOX_INCLUDED_SRC_Audio_AudioTestService_h */
|
---|
114 |
|
---|