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