1 | /** @file
|
---|
2 | * Guest property service - Common header for host service and guest clients.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef VBOX_INCLUDED_HostServices_GuestPropertySvc_h
|
---|
27 | #define VBOX_INCLUDED_HostServices_GuestPropertySvc_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/VMMDevCoreTypes.h>
|
---|
33 | #include <VBox/VBoxGuestCoreTypes.h>
|
---|
34 | #include <VBox/log.h>
|
---|
35 | #include <iprt/err.h>
|
---|
36 | #include <iprt/assertcompile.h>
|
---|
37 | #include <iprt/string.h>
|
---|
38 |
|
---|
39 |
|
---|
40 | /** Maximum length for property names. */
|
---|
41 | #define GUEST_PROP_MAX_NAME_LEN 64
|
---|
42 | /** Maximum length for property values. */
|
---|
43 | #define GUEST_PROP_MAX_VALUE_LEN 128
|
---|
44 | /** Maximum number of properties per guest. */
|
---|
45 | #define GUEST_PROP_MAX_PROPS 256
|
---|
46 | /** Maximum size for enumeration patterns. */
|
---|
47 | #define GUEST_PROP_MAX_PATTERN_LEN 1024
|
---|
48 | /** Maximum number of changes we remember for guest notifications. */
|
---|
49 | #define GUEST_PROP_MAX_GUEST_NOTIFICATIONS 256
|
---|
50 | /** Maximum number of current pending waits per client. */
|
---|
51 | #define GUEST_PROP_MAX_GUEST_CONCURRENT_WAITS 16
|
---|
52 |
|
---|
53 |
|
---|
54 | /** @name GUEST_PROP_F_XXX - The guest property flag values which are currently accepted.
|
---|
55 | * @{
|
---|
56 | */
|
---|
57 | #define GUEST_PROP_F_NILFLAG UINT32_C(0)
|
---|
58 | /** Transient until VM gets shut down. */
|
---|
59 | #define GUEST_PROP_F_TRANSIENT RT_BIT_32(1)
|
---|
60 | #define GUEST_PROP_F_RDONLYGUEST RT_BIT_32(2)
|
---|
61 | #define GUEST_PROP_F_RDONLYHOST RT_BIT_32(3)
|
---|
62 | /** Transient until VM gets a reset / restarts.
|
---|
63 | * Implies TRANSIENT. */
|
---|
64 | #define GUEST_PROP_F_TRANSRESET RT_BIT_32(4)
|
---|
65 | #define GUEST_PROP_F_READONLY (GUEST_PROP_F_RDONLYGUEST | GUEST_PROP_F_RDONLYHOST)
|
---|
66 | #define GUEST_PROP_F_ALLFLAGS (GUEST_PROP_F_TRANSIENT | GUEST_PROP_F_READONLY | GUEST_PROP_F_TRANSRESET)
|
---|
67 | /** @} */
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Get the name of a flag as a string.
|
---|
71 | * @returns the name, or NULL if fFlag is invalid.
|
---|
72 | * @param fFlag The flag, GUEST_PROP_F_XXX.
|
---|
73 | * @param pcchName Where to return the name length.
|
---|
74 | */
|
---|
75 | DECLINLINE(const char *) GuestPropFlagNameAndLen(uint32_t fFlag, size_t *pcchName)
|
---|
76 | {
|
---|
77 | switch (fFlag)
|
---|
78 | {
|
---|
79 | case GUEST_PROP_F_TRANSIENT:
|
---|
80 | *pcchName = sizeof("TRANSIENT") - 1;
|
---|
81 | return "TRANSIENT";
|
---|
82 | case GUEST_PROP_F_RDONLYGUEST:
|
---|
83 | *pcchName = sizeof("RDONLYGUEST") - 1;
|
---|
84 | return "RDONLYGUEST";
|
---|
85 | case GUEST_PROP_F_RDONLYHOST:
|
---|
86 | *pcchName = sizeof("RDONLYHOST") - 1;
|
---|
87 | return "RDONLYHOST";
|
---|
88 | case GUEST_PROP_F_READONLY:
|
---|
89 | *pcchName = sizeof("READONLY") - 1;
|
---|
90 | return "READONLY";
|
---|
91 | case GUEST_PROP_F_TRANSRESET:
|
---|
92 | *pcchName = sizeof("TRANSRESET") - 1;
|
---|
93 | return "TRANSRESET";
|
---|
94 | default:
|
---|
95 | *pcchName = 0;
|
---|
96 | return NULL;
|
---|
97 | }
|
---|
98 | }
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Maximum length for the property flags field. We only ever return one of
|
---|
102 | * RDONLYGUEST, RDONLYHOST and RDONLY
|
---|
103 | */
|
---|
104 | #define GUEST_PROP_MAX_FLAGS_LEN sizeof("TRANSIENT, RDONLYGUEST, TRANSRESET")
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Parse a guest properties flags string for flag names and make sure that
|
---|
108 | * there is no junk text in the string.
|
---|
109 | *
|
---|
110 | * @returns IPRT status code
|
---|
111 | * @retval VERR_INVALID_PARAMETER if the flag string is not valid
|
---|
112 | * @param pcszFlags the flag string to parse
|
---|
113 | * @param pfFlags where to store the parse result. May not be NULL.
|
---|
114 | * @note This function is also inline because it must be accessible from
|
---|
115 | * several modules and it does not seem reasonable to put it into
|
---|
116 | * its own library.
|
---|
117 | */
|
---|
118 | DECLINLINE(int) GuestPropValidateFlags(const char *pcszFlags, uint32_t *pfFlags)
|
---|
119 | {
|
---|
120 | static const uint32_t s_aFlagList[] =
|
---|
121 | {
|
---|
122 | GUEST_PROP_F_TRANSIENT, GUEST_PROP_F_READONLY, GUEST_PROP_F_RDONLYGUEST, GUEST_PROP_F_RDONLYHOST, GUEST_PROP_F_TRANSRESET
|
---|
123 | };
|
---|
124 | const char *pcszNext = pcszFlags;
|
---|
125 | int rc = VINF_SUCCESS;
|
---|
126 | uint32_t fFlags = 0;
|
---|
127 | AssertLogRelReturn(VALID_PTR(pfFlags), VERR_INVALID_POINTER);
|
---|
128 |
|
---|
129 | if (pcszFlags)
|
---|
130 | {
|
---|
131 | while (*pcszNext == ' ')
|
---|
132 | ++pcszNext;
|
---|
133 | while ((*pcszNext != '\0') && RT_SUCCESS(rc))
|
---|
134 | {
|
---|
135 | unsigned i;
|
---|
136 | rc = VERR_PARSE_ERROR;
|
---|
137 | for (i = 0; i < RT_ELEMENTS(s_aFlagList); ++i)
|
---|
138 | {
|
---|
139 | size_t cchFlagName;
|
---|
140 | const char *pszFlagName = GuestPropFlagNameAndLen(s_aFlagList[i], &cchFlagName);
|
---|
141 | if (RTStrNICmpAscii(pcszNext, pszFlagName, cchFlagName) == 0)
|
---|
142 | {
|
---|
143 | char ch;
|
---|
144 | fFlags |= s_aFlagList[i];
|
---|
145 | pcszNext += cchFlagName;
|
---|
146 | while ((ch = *pcszNext) == ' ')
|
---|
147 | ++pcszNext;
|
---|
148 | rc = VINF_SUCCESS;
|
---|
149 | if (ch == ',')
|
---|
150 | {
|
---|
151 | ++pcszNext;
|
---|
152 | while (*pcszNext == ' ')
|
---|
153 | ++pcszNext;
|
---|
154 | }
|
---|
155 | else if (ch != '\0')
|
---|
156 | rc = VERR_PARSE_ERROR;
|
---|
157 | break;
|
---|
158 | }
|
---|
159 | }
|
---|
160 | }
|
---|
161 | }
|
---|
162 | if (RT_SUCCESS(rc))
|
---|
163 | *pfFlags = fFlags;
|
---|
164 | return rc;
|
---|
165 | }
|
---|
166 |
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * Write out flags to a string.
|
---|
170 | * @returns IPRT status code
|
---|
171 | * @param fFlags the flags to write out
|
---|
172 | * @param pszFlags where to write the flags string. This must point to
|
---|
173 | * a buffer of size (at least) GUEST_PROP_MAX_FLAGS_LEN.
|
---|
174 | */
|
---|
175 | DECLINLINE(int) GuestPropWriteFlags(uint32_t fFlags, char *pszFlags)
|
---|
176 | {
|
---|
177 | /* Putting READONLY before the other RDONLY flags keeps the result short. */
|
---|
178 | static const uint32_t s_aFlagList[] =
|
---|
179 | {
|
---|
180 | GUEST_PROP_F_TRANSIENT, GUEST_PROP_F_READONLY, GUEST_PROP_F_RDONLYGUEST, GUEST_PROP_F_RDONLYHOST, GUEST_PROP_F_TRANSRESET
|
---|
181 | };
|
---|
182 | int rc = VINF_SUCCESS;
|
---|
183 |
|
---|
184 | AssertLogRelReturn(VALID_PTR(pszFlags), VERR_INVALID_POINTER);
|
---|
185 | if ((fFlags & ~GUEST_PROP_F_ALLFLAGS) == GUEST_PROP_F_NILFLAG)
|
---|
186 | {
|
---|
187 | char *pszNext;
|
---|
188 | unsigned i;
|
---|
189 |
|
---|
190 | /* TRANSRESET implies TRANSIENT. For compatability with old clients we
|
---|
191 | always set TRANSIENT when TRANSRESET appears. */
|
---|
192 | if (fFlags & GUEST_PROP_F_TRANSRESET)
|
---|
193 | fFlags |= GUEST_PROP_F_TRANSIENT;
|
---|
194 |
|
---|
195 | pszNext = pszFlags;
|
---|
196 | for (i = 0; i < RT_ELEMENTS(s_aFlagList); ++i)
|
---|
197 | {
|
---|
198 | if (s_aFlagList[i] == (fFlags & s_aFlagList[i]))
|
---|
199 | {
|
---|
200 | size_t cchFlagName;
|
---|
201 | const char *pszFlagName = GuestPropFlagNameAndLen(s_aFlagList[i], &cchFlagName);
|
---|
202 | memcpy(pszNext, pszFlagName, cchFlagName);
|
---|
203 | pszNext += cchFlagName;
|
---|
204 | fFlags &= ~s_aFlagList[i];
|
---|
205 | if (fFlags != GUEST_PROP_F_NILFLAG)
|
---|
206 | {
|
---|
207 | *pszNext++ = ',';
|
---|
208 | *pszNext++ = ' ';
|
---|
209 | }
|
---|
210 | }
|
---|
211 | }
|
---|
212 | *pszNext = '\0';
|
---|
213 |
|
---|
214 | Assert((uintptr_t)(pszNext - pszFlags) < GUEST_PROP_MAX_FLAGS_LEN);
|
---|
215 | Assert(fFlags == GUEST_PROP_F_NILFLAG); /* bad s_aFlagList */
|
---|
216 | }
|
---|
217 | else
|
---|
218 | rc = VERR_INVALID_PARAMETER;
|
---|
219 | return rc;
|
---|
220 | }
|
---|
221 |
|
---|
222 |
|
---|
223 | /** @name The service functions which are callable by host.
|
---|
224 | * @{
|
---|
225 | */
|
---|
226 | /** Set properties in a block.
|
---|
227 | * The parameters are pointers to NULL-terminated arrays containing the
|
---|
228 | * parameters. These are, in order, name, value, timestamp, flags. Strings are
|
---|
229 | * stored as pointers to mutable utf8 data. All parameters must be supplied. */
|
---|
230 | #define GUEST_PROP_FN_HOST_SET_PROPS 1
|
---|
231 | /** Get the value attached to a guest property.
|
---|
232 | * The parameter format matches that of GET_PROP. */
|
---|
233 | #define GUEST_PROP_FN_HOST_GET_PROP 2
|
---|
234 | /** Set the value attached to a guest property.
|
---|
235 | * The parameter format matches that of SET_PROP. */
|
---|
236 | #define GUEST_PROP_FN_HOST_SET_PROP 3
|
---|
237 | /** Set the value attached to a guest property.
|
---|
238 | * The parameter format matches that of SET_PROP_VALUE. */
|
---|
239 | #define GUEST_PROP_FN_HOST_SET_PROP_VALUE 4
|
---|
240 | /** Remove a guest property.
|
---|
241 | * The parameter format matches that of DEL_PROP. */
|
---|
242 | #define GUEST_PROP_FN_HOST_DEL_PROP 5
|
---|
243 | /** Enumerate guest properties.
|
---|
244 | * The parameter format matches that of ENUM_PROPS. */
|
---|
245 | #define GUEST_PROP_FN_HOST_ENUM_PROPS 6
|
---|
246 | /** Set global flags for the service.
|
---|
247 | * Currently RDONLYGUEST is supported. Takes one 32-bit unsigned integer
|
---|
248 | * parameter for the flags. */
|
---|
249 | #define GUEST_PROP_FN_HOST_SET_GLOBAL_FLAGS 7
|
---|
250 | /** @} */
|
---|
251 |
|
---|
252 |
|
---|
253 | /** @name The service functions which are called by guest.
|
---|
254 | *
|
---|
255 | * @note The numbers may not change!
|
---|
256 | * @{
|
---|
257 | */
|
---|
258 | /** Get a guest property */
|
---|
259 | #define GUEST_PROP_FN_GET_PROP 1
|
---|
260 | /** Set a guest property */
|
---|
261 | #define GUEST_PROP_FN_SET_PROP 2
|
---|
262 | /** Set just the value of a guest property */
|
---|
263 | #define GUEST_PROP_FN_SET_PROP_VALUE 3
|
---|
264 | /** Delete a guest property */
|
---|
265 | #define GUEST_PROP_FN_DEL_PROP 4
|
---|
266 | /** Enumerate guest properties */
|
---|
267 | #define GUEST_PROP_FN_ENUM_PROPS 5
|
---|
268 | /** Poll for guest notifications */
|
---|
269 | #define GUEST_PROP_FN_GET_NOTIFICATION 6
|
---|
270 | /** @} */
|
---|
271 |
|
---|
272 |
|
---|
273 | /**
|
---|
274 | * Data structure to pass to the service extension callback.
|
---|
275 | * We use this to notify the host of changes to properties.
|
---|
276 | */
|
---|
277 | typedef struct GUESTPROPHOSTCALLBACKDATA
|
---|
278 | {
|
---|
279 | /** Magic number to identify the structure (GUESTPROPHOSTCALLBACKDATA_MAGIC). */
|
---|
280 | uint32_t u32Magic;
|
---|
281 | /** The name of the property that was changed */
|
---|
282 | const char *pcszName;
|
---|
283 | /** The new property value, or NULL if the property was deleted */
|
---|
284 | const char *pcszValue;
|
---|
285 | /** The timestamp of the modification */
|
---|
286 | uint64_t u64Timestamp;
|
---|
287 | /** The flags field of the modified property */
|
---|
288 | const char *pcszFlags;
|
---|
289 | } GUESTPROPHOSTCALLBACKDATA;
|
---|
290 | /** Poitner to a data structure to pass to the service extension callback. */
|
---|
291 | typedef GUESTPROPHOSTCALLBACKDATA *PGUESTPROPHOSTCALLBACKDATA;
|
---|
292 |
|
---|
293 | /** Magic number for sanity checking the HOSTCALLBACKDATA structure */
|
---|
294 | #define GUESTPROPHOSTCALLBACKDATA_MAGIC UINT32_C(0x69c87a78)
|
---|
295 |
|
---|
296 | /**
|
---|
297 | * HGCM parameter structures. Packing is explicitly defined as this is a wire format.
|
---|
298 | */
|
---|
299 | /** The guest is requesting the value of a property */
|
---|
300 | typedef struct GuestPropMsgGetProperty
|
---|
301 | {
|
---|
302 | VBGLIOCHGCMCALL hdr;
|
---|
303 |
|
---|
304 | /**
|
---|
305 | * The property name (IN pointer)
|
---|
306 | * This must fit to a number of criteria, namely
|
---|
307 | * - Only Utf8 strings are allowed
|
---|
308 | * - Less than or equal to MAX_NAME_LEN bytes in length
|
---|
309 | * - Zero terminated
|
---|
310 | */
|
---|
311 | HGCMFunctionParameter name;
|
---|
312 |
|
---|
313 | /**
|
---|
314 | * The returned string data will be placed here. (OUT pointer)
|
---|
315 | * This call returns two null-terminated strings which will be placed one
|
---|
316 | * after another: value and flags.
|
---|
317 | */
|
---|
318 | HGCMFunctionParameter buffer;
|
---|
319 |
|
---|
320 | /**
|
---|
321 | * The property timestamp. (OUT uint64_t)
|
---|
322 | */
|
---|
323 | HGCMFunctionParameter timestamp;
|
---|
324 |
|
---|
325 | /**
|
---|
326 | * If the buffer provided was large enough this will contain the size of
|
---|
327 | * the returned data. Otherwise it will contain the size of the buffer
|
---|
328 | * needed to hold the data and VERR_BUFFER_OVERFLOW will be returned.
|
---|
329 | * (OUT uint32_t)
|
---|
330 | */
|
---|
331 | HGCMFunctionParameter size;
|
---|
332 | } GuestPropMsgGetProperty;
|
---|
333 | AssertCompileSize(GuestPropMsgGetProperty, 40 + 4 * (ARCH_BITS == 64 ? 16 : 12));
|
---|
334 |
|
---|
335 | /** The guest is requesting to change a property */
|
---|
336 | typedef struct GuestPropMsgSetProperty
|
---|
337 | {
|
---|
338 | VBGLIOCHGCMCALL hdr;
|
---|
339 |
|
---|
340 | /**
|
---|
341 | * The property name. (IN pointer)
|
---|
342 | * This must fit to a number of criteria, namely
|
---|
343 | * - Only Utf8 strings are allowed
|
---|
344 | * - Less than or equal to MAX_NAME_LEN bytes in length
|
---|
345 | * - Zero terminated
|
---|
346 | */
|
---|
347 | HGCMFunctionParameter name;
|
---|
348 |
|
---|
349 | /**
|
---|
350 | * The value of the property (IN pointer)
|
---|
351 | * Criteria as for the name parameter, but with length less than or equal to
|
---|
352 | * MAX_VALUE_LEN.
|
---|
353 | */
|
---|
354 | HGCMFunctionParameter value;
|
---|
355 |
|
---|
356 | /**
|
---|
357 | * The property flags (IN pointer)
|
---|
358 | * This is a comma-separated list of the format flag=value
|
---|
359 | * The length must be less than or equal to GUEST_PROP_MAX_FLAGS_LEN and only
|
---|
360 | * known flag names and values will be accepted.
|
---|
361 | */
|
---|
362 | HGCMFunctionParameter flags;
|
---|
363 | } GuestPropMsgSetProperty;
|
---|
364 | AssertCompileSize(GuestPropMsgSetProperty, 40 + 3 * (ARCH_BITS == 64 ? 16 : 12));
|
---|
365 |
|
---|
366 | /** The guest is requesting to change the value of a property */
|
---|
367 | typedef struct GuestPropMsgSetPropertyValue
|
---|
368 | {
|
---|
369 | VBGLIOCHGCMCALL hdr;
|
---|
370 |
|
---|
371 | /**
|
---|
372 | * The property name. (IN pointer)
|
---|
373 | * This must fit to a number of criteria, namely
|
---|
374 | * - Only Utf8 strings are allowed
|
---|
375 | * - Less than or equal to MAX_NAME_LEN bytes in length
|
---|
376 | * - Zero terminated
|
---|
377 | */
|
---|
378 | HGCMFunctionParameter name;
|
---|
379 |
|
---|
380 | /**
|
---|
381 | * The value of the property (IN pointer)
|
---|
382 | * Criteria as for the name parameter, but with length less than or equal to
|
---|
383 | * MAX_VALUE_LEN.
|
---|
384 | */
|
---|
385 | HGCMFunctionParameter value;
|
---|
386 | } GuestPropMsgSetPropertyValue;
|
---|
387 | AssertCompileSize(GuestPropMsgSetPropertyValue, 40 + 2 * (ARCH_BITS == 64 ? 16 : 12));
|
---|
388 |
|
---|
389 | /** The guest is requesting to remove a property */
|
---|
390 | typedef struct GuestPropMsgDelProperty
|
---|
391 | {
|
---|
392 | VBGLIOCHGCMCALL hdr;
|
---|
393 |
|
---|
394 | /**
|
---|
395 | * The property name. This must fit to a number of criteria, namely
|
---|
396 | * - Only Utf8 strings are allowed
|
---|
397 | * - Less than or equal to MAX_NAME_LEN bytes in length
|
---|
398 | * - Zero terminated
|
---|
399 | */
|
---|
400 | HGCMFunctionParameter name;
|
---|
401 | } GuestPropMsgDelProperty;
|
---|
402 | AssertCompileSize(GuestPropMsgDelProperty, 40 + 1 * (ARCH_BITS == 64 ? 16 : 12));
|
---|
403 |
|
---|
404 | /** The guest is requesting to enumerate properties */
|
---|
405 | typedef struct GuestPropMsgEnumProperties
|
---|
406 | {
|
---|
407 | VBGLIOCHGCMCALL hdr;
|
---|
408 |
|
---|
409 | /**
|
---|
410 | * Array of patterns to match the properties against, separated by '|'
|
---|
411 | * characters. For backwards compatibility, '\\0' is also accepted
|
---|
412 | * as a separater.
|
---|
413 | * (IN pointer)
|
---|
414 | * If only a single, empty pattern is given then match all.
|
---|
415 | */
|
---|
416 | HGCMFunctionParameter patterns;
|
---|
417 | /**
|
---|
418 | * On success, null-separated array of strings in which the properties are
|
---|
419 | * returned. (OUT pointer)
|
---|
420 | * The number of strings in the array is always a multiple of four,
|
---|
421 | * and in sequences of name, value, timestamp (hexadecimal string) and the
|
---|
422 | * flags as a comma-separated list in the format "name=value". The list
|
---|
423 | * is terminated by an empty string after a "flags" entry (or at the
|
---|
424 | * start).
|
---|
425 | */
|
---|
426 | HGCMFunctionParameter strings;
|
---|
427 | /**
|
---|
428 | * On success, the size of the returned data. If the buffer provided is
|
---|
429 | * too small, the size of buffer needed. (OUT uint32_t)
|
---|
430 | */
|
---|
431 | HGCMFunctionParameter size;
|
---|
432 | } GuestPropMsgEnumProperties;
|
---|
433 | AssertCompileSize(GuestPropMsgEnumProperties, 40 + 3 * (ARCH_BITS == 64 ? 16 : 12));
|
---|
434 |
|
---|
435 | /**
|
---|
436 | * The guest is polling for notifications on changes to properties, specifying
|
---|
437 | * a set of patterns to match the names of changed properties against and
|
---|
438 | * optionally the timestamp of the last notification seen.
|
---|
439 | * On success, VINF_SUCCESS will be returned and the buffer will contain
|
---|
440 | * details of a property notification. If no new notification is available
|
---|
441 | * which matches one of the specified patterns, the call will block until one
|
---|
442 | * is.
|
---|
443 | * If the last notification could not be found by timestamp, VWRN_NOT_FOUND
|
---|
444 | * will be returned and the oldest available notification will be returned.
|
---|
445 | * If a zero timestamp is specified, the call will always wait for a new
|
---|
446 | * notification to arrive.
|
---|
447 | * If the buffer supplied was not large enough to hold the notification,
|
---|
448 | * VERR_BUFFER_OVERFLOW will be returned and the size parameter will contain
|
---|
449 | * the size of the buffer needed.
|
---|
450 | *
|
---|
451 | * The protocol for a guest to obtain notifications is to call
|
---|
452 | * GET_NOTIFICATION in a loop. On the first call, the ingoing timestamp
|
---|
453 | * parameter should be set to zero. On subsequent calls, it should be set to
|
---|
454 | * the outgoing timestamp from the previous call.
|
---|
455 | */
|
---|
456 | typedef struct GuestPropMsgGetNotification
|
---|
457 | {
|
---|
458 | VBGLIOCHGCMCALL hdr;
|
---|
459 |
|
---|
460 | /**
|
---|
461 | * A list of patterns to match the guest event name against, separated by
|
---|
462 | * vertical bars (|) (IN pointer)
|
---|
463 | * An empty string means match all.
|
---|
464 | */
|
---|
465 | HGCMFunctionParameter patterns;
|
---|
466 | /**
|
---|
467 | * The timestamp of the last change seen (IN uint64_t)
|
---|
468 | * This may be zero, in which case the oldest available change will be
|
---|
469 | * sent. If the service does not remember an event matching the
|
---|
470 | * timestamp, then VWRN_NOT_FOUND will be returned, and the guest should
|
---|
471 | * assume that it has missed a certain number of notifications.
|
---|
472 | *
|
---|
473 | * The timestamp of the change being notified of (OUT uint64_t)
|
---|
474 | * Undefined on failure.
|
---|
475 | */
|
---|
476 | HGCMFunctionParameter timestamp;
|
---|
477 |
|
---|
478 | /**
|
---|
479 | * The returned data, if any, will be placed here. (OUT pointer)
|
---|
480 | * This call returns three null-terminated strings which will be placed
|
---|
481 | * one after another: name, value and flags. For a delete notification,
|
---|
482 | * value and flags will be empty strings. Undefined on failure.
|
---|
483 | */
|
---|
484 | HGCMFunctionParameter buffer;
|
---|
485 |
|
---|
486 | /**
|
---|
487 | * On success, the size of the returned data. (OUT uint32_t)
|
---|
488 | * On buffer overflow, the size of the buffer needed to hold the data.
|
---|
489 | * Undefined on failure.
|
---|
490 | */
|
---|
491 | HGCMFunctionParameter size;
|
---|
492 | } GuestPropMsgGetNotification;
|
---|
493 | AssertCompileSize(GuestPropMsgGetNotification, 40 + 4 * (ARCH_BITS == 64 ? 16 : 12));
|
---|
494 |
|
---|
495 |
|
---|
496 | #endif /* !VBOX_INCLUDED_HostServices_GuestPropertySvc_h */
|
---|
497 |
|
---|