VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceInternal.h@ 106743

Last change on this file since 106743 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.7 KB
Line 
1/* $Id: TestExecServiceInternal.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * TestExecServ - Basic Remote Execution Service, Internal Header.
4 */
5
6/*
7 * Copyright (C) 2010-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef VBOX_INCLUDED_SRC_TestExecServ_TestExecServiceInternal_h
38#define VBOX_INCLUDED_SRC_TestExecServ_TestExecServiceInternal_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#include <iprt/getopt.h>
44#include <iprt/stream.h>
45
46RT_C_DECLS_BEGIN
47
48/**
49 * Packet header.
50 */
51typedef struct TXSPKTHDR
52{
53 /** The unpadded packet length. This include this header. */
54 uint32_t cb;
55 /** The CRC-32 for the packet starting from the opcode field. 0 if the packet
56 * hasn't been CRCed. */
57 uint32_t uCrc32;
58 /** Packet opcode, an unterminated ASCII string. */
59 uint8_t achOpcode[8];
60} TXSPKTHDR;
61AssertCompileSize(TXSPKTHDR, 16);
62/** Pointer to a packet header. */
63typedef TXSPKTHDR *PTXSPKTHDR;
64/** Pointer to a packet header. */
65typedef TXSPKTHDR const *PCTXSPKTHDR;
66/** Pointer to a packet header pointer. */
67typedef PTXSPKTHDR *PPTXSPKTHDR;
68
69/** Packet alignment. */
70#define TXSPKT_ALIGNMENT 16
71/** Max packet size. */
72#define TXSPKT_MAX_SIZE _256K
73
74
75/**
76 * Transport layer descriptor.
77 */
78typedef struct TXSTRANSPORT
79{
80 /** The name. */
81 char szName[16];
82 /** The description. */
83 const char *pszDesc;
84 /** Pointer to an array of options. */
85 PCRTGETOPTDEF paOpts;
86 /** The number of options in the array. */
87 size_t cOpts;
88
89 /**
90 * Print the usage information for this transport layer.
91 *
92 * @param pStream The stream to print the usage info to.
93 *
94 * @remarks This is only required if TXSTRANSPORT::cOpts is greater than 0.
95 */
96 DECLR3CALLBACKMEMBER(void, pfnUsage,(PRTSTREAM pStream));
97
98 /**
99 * Handle an option.
100 *
101 * When encountering an options that is not part of the base options, we'll call
102 * this method for each transport layer until one handles it.
103 *
104 * @retval VINF_SUCCESS if handled.
105 * @retval VERR_TRY_AGAIN if not handled.
106 * @retval VERR_INVALID_PARAMETER if we should exit with a non-zero status.
107 *
108 * @param ch The short option value.
109 * @param pVal Pointer to the value union.
110 *
111 * @remarks This is only required if TXSTRANSPORT::cOpts is greater than 0.
112 */
113 DECLR3CALLBACKMEMBER(int, pfnOption,(int ch, PCRTGETOPTUNION pVal));
114
115 /**
116 * Initializes the transport layer.
117 *
118 * @returns IPRT status code. On errors, the transport layer shall call
119 * RTMsgError to display the error details to the user.
120 */
121 DECLR3CALLBACKMEMBER(int, pfnInit,(void));
122
123 /**
124 * Terminate the transport layer, closing and freeing resources.
125 *
126 * On errors, the transport layer shall call RTMsgError to display the error
127 * details to the user.
128 */
129 DECLR3CALLBACKMEMBER(void, pfnTerm,(void));
130
131 /**
132 * Polls for incoming packets.
133 *
134 * @returns true if there are pending packets, false if there isn't.
135 */
136 DECLR3CALLBACKMEMBER(bool, pfnPollIn,(void));
137
138 /**
139 * Adds any pollable handles to the poll set.
140 *
141 * This is optional and layers that doesn't have anything that can be polled
142 * shall set this method pointer to NULL to indicate that pfnPollIn must be used
143 * instead.
144 *
145 * @returns IPRT status code.
146 * @param hPollSet The poll set to add them to.
147 * @param idStart The handle ID to start at.
148 */
149 DECLR3CALLBACKMEMBER(int, pfnPollSetAdd,(RTPOLLSET hPollSet, uint32_t idStart));
150
151 /**
152 * Receives an incoming packet.
153 *
154 * This will block until the data becomes available or we're interrupted by a
155 * signal or something.
156 *
157 * @returns IPRT status code. On error conditions other than VERR_INTERRUPTED,
158 * the current operation will be aborted when applicable. When
159 * interrupted, the transport layer will store the data until the next
160 * receive call.
161 *
162 * @param ppPktHdr Where to return the pointer to the packet we've
163 * read. This is allocated from the heap using
164 * RTMemAlloc (w/ TXSPKT_ALIGNMENT) and must be
165 * free by calling RTMemFree.
166 */
167 DECLR3CALLBACKMEMBER(int, pfnRecvPkt,(PPTXSPKTHDR ppPktHdr));
168
169 /**
170 * Sends an outgoing packet.
171 *
172 * This will block until the data has been written.
173 *
174 * @returns IPRT status code.
175 * @retval VERR_INTERRUPTED if interrupted before anything was sent.
176 *
177 * @param pPktHdr The packet to send. The size is given by
178 * aligning the size in the header by
179 * TXSPKT_ALIGNMENT.
180 */
181 DECLR3CALLBACKMEMBER(int, pfnSendPkt,(PCTXSPKTHDR pPktHdr));
182
183 /**
184 * Sends a babble packet and disconnects the client (if applicable).
185 *
186 * @param pPktHdr The packet to send. The size is given by
187 * aligning the size in the header by
188 * TXSPKT_ALIGNMENT.
189 * @param cMsSendTimeout The send timeout measured in milliseconds.
190 */
191 DECLR3CALLBACKMEMBER(void, pfnBabble,(PCTXSPKTHDR pPktHdr, RTMSINTERVAL cMsSendTimeout));
192
193 /**
194 * Notification about a client HOWDY.
195 */
196 DECLR3CALLBACKMEMBER(void, pfnNotifyHowdy,(void));
197
198 /**
199 * Notification about a client BYE.
200 *
201 * For connection oriented transport layers, it would be good to disconnect the
202 * client at this point.
203 */
204 DECLR3CALLBACKMEMBER(void, pfnNotifyBye,(void));
205
206 /**
207 * Notification about a REBOOT or SHUTDOWN.
208 *
209 * For connection oriented transport layers, stop listening for and
210 * accepting at this point.
211 */
212 DECLR3CALLBACKMEMBER(void, pfnNotifyReboot,(void));
213
214 /** Non-zero end marker. */
215 uint32_t u32EndMarker;
216} TXSTRANSPORT;
217/** Pointer to a const transport layer descriptor. */
218typedef const struct TXSTRANSPORT *PCTXSTRANSPORT;
219
220
221extern TXSTRANSPORT const g_TcpTransport;
222extern TXSTRANSPORT const g_SerialTransport;
223extern TXSTRANSPORT const g_FileSysTransport;
224extern TXSTRANSPORT const g_GuestPropTransport;
225extern TXSTRANSPORT const g_TestDevTransport;
226
227extern uint32_t g_cVerbose;
228
229RT_C_DECLS_END
230
231#endif /* !VBOX_INCLUDED_SRC_TestExecServ_TestExecServiceInternal_h */
232
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