VirtualBox

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

Last change on this file since 81165 was 76579, checked in by vboxsync, 6 years ago

ValKit: scm header guard alignment.

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