VirtualBox

source: vbox/trunk/src/VBox/Devices/Audio/AudioTestServiceInternal.h@ 89467

Last change on this file since 89467 was 89182, checked in by vboxsync, 4 years ago

Audio/ValKit: Started working on the audio test execution service (ATS) [SCM fixes]. bugref:10008

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 KB
Line 
1/* $Id: AudioTestServiceInternal.h 89182 2021-05-19 15:59:03Z vboxsync $ */
2/** @file
3 * AudioTestService - Audio test execution server, Internal 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_AudioTestServiceInternal_h
19#define VBOX_INCLUDED_SRC_Audio_AudioTestServiceInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/getopt.h>
25#include <iprt/stream.h>
26
27#include "AudioTestServiceProtocol.h"
28
29RT_C_DECLS_BEGIN
30
31/** Opaque ATS transport layer specific client data. */
32typedef struct ATSTRANSPORTCLIENT *PATSTRANSPORTCLIENT;
33typedef PATSTRANSPORTCLIENT *PPATSTRANSPORTCLIENT;
34
35/**
36 * Transport layer descriptor.
37 */
38typedef struct ATSTRANSPORT
39{
40 /** The name. */
41 char szName[16];
42 /** The description. */
43 const char *pszDesc;
44 /** Pointer to an array of options. */
45 PCRTGETOPTDEF paOpts;
46 /** The number of options in the array. */
47 size_t cOpts;
48
49 /**
50 * Print the usage information for this transport layer.
51 *
52 * @param pStream The stream to print the usage info to.
53 *
54 * @remarks This is only required if TXSTRANSPORT::cOpts is greater than 0.
55 */
56 DECLR3CALLBACKMEMBER(void, pfnUsage, (PRTSTREAM pStream));
57
58 /**
59 * Handle an option.
60 *
61 * When encountering an options that is not part of the base options, we'll call
62 * this method for each transport layer until one handles it.
63 *
64 * @retval VINF_SUCCESS if handled.
65 * @retval VERR_TRY_AGAIN if not handled.
66 * @retval VERR_INVALID_PARAMETER if we should exit with a non-zero status.
67 *
68 * @param ch The short option value.
69 * @param pVal Pointer to the value union.
70 *
71 * @remarks This is only required if TXSTRANSPORT::cOpts is greater than 0.
72 */
73 DECLR3CALLBACKMEMBER(int, pfnOption, (int ch, PCRTGETOPTUNION pVal));
74
75 /**
76 * Initializes the transport layer.
77 *
78 * @returns IPRT status code. On errors, the transport layer shall call
79 * RTMsgError to display the error details to the user.
80 */
81 DECLR3CALLBACKMEMBER(int, pfnInit, (void));
82
83 /**
84 * Terminate the transport layer, closing and freeing resources.
85 *
86 * On errors, the transport layer shall call RTMsgError to display the error
87 * details to the user.
88 */
89 DECLR3CALLBACKMEMBER(void, pfnTerm, (void));
90
91 /**
92 * Waits for a new client to connect and returns the client specific data on
93 * success.
94 */
95 DECLR3CALLBACKMEMBER(int, pfnWaitForConnect, (PPATSTRANSPORTCLIENT ppClientNew));
96
97 /**
98 * Polls for incoming packets.
99 *
100 * @returns true if there are pending packets, false if there isn't.
101 * @param pClient The client to poll for data.
102 */
103 DECLR3CALLBACKMEMBER(bool, pfnPollIn, (PATSTRANSPORTCLIENT pClient));
104
105 /**
106 * Adds any pollable handles to the poll set.
107 *
108 * @returns IPRT status code.
109 * @param hPollSet The poll set to add them to.
110 * @param pClient The transport client structure.
111 * @param idStart The handle ID to start at.
112 */
113 DECLR3CALLBACKMEMBER(int, pfnPollSetAdd, (RTPOLLSET hPollSet, PATSTRANSPORTCLIENT pClient, uint32_t idStart));
114
115 /**
116 * Removes the given client frmo the given pollset.
117 *
118 * @returns IPRT status code.
119 * @param hPollSet The poll set to remove from.
120 * @param pClient The transport client structure.
121 * @param idStart The handle ID to remove.
122 */
123 DECLR3CALLBACKMEMBER(int, pfnPollSetRemove, (RTPOLLSET hPollSet, PATSTRANSPORTCLIENT pClient, uint32_t idStart));
124
125 /**
126 * Receives an incoming packet.
127 *
128 * This will block until the data becomes available or we're interrupted by a
129 * signal or something.
130 *
131 * @returns IPRT status code. On error conditions other than VERR_INTERRUPTED,
132 * the current operation will be aborted when applicable. When
133 * interrupted, the transport layer will store the data until the next
134 * receive call.
135 *
136 * @param pClient The transport client structure.
137 * @param ppPktHdr Where to return the pointer to the packet we've
138 * read. This is allocated from the heap using
139 * RTMemAlloc (w/ ATSPKT_ALIGNMENT) and must be
140 * free by calling RTMemFree.
141 */
142 DECLR3CALLBACKMEMBER(int, pfnRecvPkt, (PATSTRANSPORTCLIENT pClient, PPATSPKTHDR ppPktHdr));
143
144 /**
145 * Sends an outgoing packet.
146 *
147 * This will block until the data has been written.
148 *
149 * @returns IPRT status code.
150 * @retval VERR_INTERRUPTED if interrupted before anything was sent.
151 *
152 * @param pClient The transport client structure.
153 * @param pPktHdr The packet to send. The size is given by
154 * aligning the size in the header by
155 * ATSPKT_ALIGNMENT.
156 */
157 DECLR3CALLBACKMEMBER(int, pfnSendPkt, (PATSTRANSPORTCLIENT pClient, PCATSPKTHDR pPktHdr));
158
159 /**
160 * Sends a babble packet and disconnects the client (if applicable).
161 *
162 * @param pClient The transport client structure.
163 * @param pPktHdr The packet to send. The size is given by
164 * aligning the size in the header by
165 * ATSPKT_ALIGNMENT.
166 * @param cMsSendTimeout The send timeout measured in milliseconds.
167 */
168 DECLR3CALLBACKMEMBER(void, pfnBabble, (PATSTRANSPORTCLIENT pClient, PCATSPKTHDR pPktHdr, RTMSINTERVAL cMsSendTimeout));
169
170 /**
171 * Notification about a client HOWDY.
172 *
173 * @param pClient The transport client structure.
174 */
175 DECLR3CALLBACKMEMBER(void, pfnNotifyHowdy, (PATSTRANSPORTCLIENT pClient));
176
177 /**
178 * Notification about a client BYE.
179 *
180 * For connection oriented transport layers, it would be good to disconnect the
181 * client at this point.
182 *
183 * @param pClient The transport client structure.
184 */
185 DECLR3CALLBACKMEMBER(void, pfnNotifyBye, (PATSTRANSPORTCLIENT pClient));
186
187 /**
188 * Notification about a REBOOT or SHUTDOWN.
189 *
190 * For connection oriented transport layers, stop listening for and
191 * accepting at this point.
192 */
193 DECLR3CALLBACKMEMBER(void, pfnNotifyReboot, (void));
194
195 /** Non-zero end marker. */
196 uint32_t u32EndMarker;
197} ATSTRANSPORT;
198/** Pointer to a const transport layer descriptor. */
199typedef const struct ATSTRANSPORT *PCATSTRANSPORT;
200
201
202extern ATSTRANSPORT const g_TcpTransport;
203
204RT_C_DECLS_END
205
206#endif /* !VBOX_INCLUDED_SRC_Audio_AudioTestServiceInternal_h */
207
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