VirtualBox

source: vbox/trunk/include/VBox/HostServices/GuestPropertySvc.h@ 10929

Last change on this file since 10929 was 10929, checked in by vboxsync, 16 years ago

HostServices/GuestProperties: added a guest enumeration interface to the service

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.8 KB
Line 
1/** @file
2 * Guest property service:
3 * Common header for host service and guest clients.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___VBox_HostService_GuestPropertyService_h
23#define ___VBox_HostService_GuestPropertyService_h
24
25#include <VBox/types.h>
26#include <VBox/VBoxGuest.h>
27#include <VBox/hgcmsvc.h>
28
29/** Everything defined in this file lives in this namespace. */
30namespace guestProp {
31
32/*
33 * The service functions which are callable by host.
34 */
35enum eHostFn
36{
37 /** Pass the address of the cfgm node used by the service as a database. */
38 SET_CFGM_NODE = 1,
39 /**
40 * Get the value attached to a configuration property key
41 * The parameter format matches that of GET_CONFIG_KEY.
42 */
43 GET_CONFIG_KEY_HOST = 2,
44 /**
45 * Set the value attached to a configuration property key
46 * The parameter format matches that of SET_CONFIG_KEY.
47 */
48 SET_CONFIG_KEY_HOST = 3,
49 /**
50 * Remove the value attached to a configuration property key
51 * The parameter format matches that of DEL_CONFIG_KEY.
52 */
53 DEL_CONFIG_KEY_HOST = 4
54};
55
56/**
57 * The service functions which are called by guest. The numbers may not change,
58 * so we hardcode them.
59 */
60enum eGuestFn
61{
62 /** Get a guest property */
63 GET_PROP = 1,
64 /** Set a guest property */
65 SET_PROP = 2,
66 /** Set just the value of a guest property */
67 SET_PROP_VALUE = 3,
68 /** Delete a guest property */
69 DEL_PROP = 4,
70 /** Enumerate guest properties */
71 ENUM_PROPS = 5
72};
73
74/** Prefix for extra data keys used by the get and set key value functions */
75#define VBOX_SHARED_INFO_KEY_PREFIX "Guest/"
76/** Helper macro for the length of the prefix VBOX_SHARED_INFO_KEY_PREFIX */
77#define VBOX_SHARED_INFO_PREFIX_LEN (sizeof(VBOX_SHARED_INFO_KEY_PREFIX) - 1)
78/** Maximum length for property names */
79enum { MAX_NAME_LEN = 64 };
80/** Maximum length for property values */
81enum { MAX_VALUE_LEN = 128 };
82/** Maximum length for extra data key values used by the get and set key value functions */
83enum { MAX_FLAGS_LEN = 128 };
84/** Maximum number of properties per guest */
85enum { MAX_KEYS = 256 };
86
87/**
88 * HGCM parameter structures. Packing is explicitly defined as this is a wire format.
89 */
90#pragma pack (1)
91/** The guest is requesting the value of a property */
92typedef struct _GetProperty
93{
94 VBoxGuestHGCMCallInfo hdr;
95
96 /**
97 * The property name (IN pointer)
98 * This must fit to a number of criteria, namely
99 * - Only Utf8 strings are allowed
100 * - Less than or equal to MAX_NAME_LEN bytes in length
101 * - Zero terminated
102 */
103 HGCMFunctionParameter name;
104
105 /**
106 * The returned string data will be placed here. (OUT pointer)
107 * This call returns two null-terminated strings which will be placed one
108 * after another: value and flags.
109 */
110 HGCMFunctionParameter buffer;
111
112 /**
113 * The property timestamp. (OUT uint64_t)
114 */
115
116 HGCMFunctionParameter timestamp;
117
118 /**
119 * If the buffer provided was large enough this will contain the size of
120 * the returned data. Otherwise it will contain the size of the buffer
121 * needed to hold the data and VERR_BUFFER_OVERFLOW will be returned.
122 * (OUT uint32_t)
123 */
124 HGCMFunctionParameter size;
125} GetProperty;
126
127/** The guest is requesting to change a property */
128typedef struct _SetProperty
129{
130 VBoxGuestHGCMCallInfo hdr;
131
132 /**
133 * The property key. (IN pointer)
134 * This must fit to a number of criteria, namely
135 * - Only Utf8 strings are allowed
136 * - Less than or equal to MAX_NAME_LEN bytes in length
137 * - Zero terminated
138 */
139 HGCMFunctionParameter name;
140
141 /**
142 * The value of the property (IN pointer)
143 * Criteria as for the key parameter, but with length less than or equal to
144 * MAX_VALUE_LEN.
145 */
146 HGCMFunctionParameter value;
147
148 /**
149 * The property flags (IN pointer)
150 * This is a comma-separated list of the format flag=value
151 * The length must be less than or equal to MAX_FLAGS_LEN and only
152 * known flag names and values will be accepted.
153 */
154 HGCMFunctionParameter flags;
155} SetProperty;
156
157/** The guest is requesting to change the value of a property */
158typedef struct _SetPropertyValue
159{
160 VBoxGuestHGCMCallInfo hdr;
161
162 /**
163 * The property key. (IN pointer)
164 * This must fit to a number of criteria, namely
165 * - Only Utf8 strings are allowed
166 * - Less than or equal to MAX_NAME_LEN bytes in length
167 * - Zero terminated
168 */
169 HGCMFunctionParameter name;
170
171 /**
172 * The value of the property (IN pointer)
173 * Criteria as for the key parameter, but with length less than or equal to
174 * MAX_VALUE_LEN.
175 */
176 HGCMFunctionParameter value;
177} SetPropertyValue;
178
179/** The guest is requesting to remove a property */
180typedef struct _DelProperty
181{
182 VBoxGuestHGCMCallInfo hdr;
183
184 /**
185 * The property name. This must fit to a number of criteria, namely
186 * - Only Utf8 strings are allowed
187 * - Less than or equal to MAX_NAME_LEN bytes in length
188 * - Zero terminated
189 */
190 HGCMFunctionParameter name;
191} DelProperty;
192
193/** The guest is requesting to enumerate properties */
194typedef struct _EnumProperties
195{
196 VBoxGuestHGCMCallInfo hdr;
197
198 /**
199 * Null-separated array of patterns to match the properties against.
200 * (IN pointer)
201 * If no patterns are given then return all. The list is terminated by an
202 * empty string.
203 */
204 HGCMFunctionParameter patterns;
205 /**
206 * On success, null-separated array of strings in which the properties are
207 * returned. (OUT pointer)
208 * The number of strings in the array is always a multiple of four,
209 * and in sequences of name, value, timestamp (hexadecimal string) and the
210 * flags as a comma-separated list in the format "name=value". The list
211 * is terminated by four empty strings.
212 */
213 HGCMFunctionParameter strings;
214 /**
215 * On success, the size of the returned data. If the buffer provided is
216 * too small, the size of buffer needed. (OUT uint32_t)
217 */
218 HGCMFunctionParameter size;
219} EnumProperties;
220#pragma pack ()
221
222} /* namespace guestProp */
223
224#endif /* ___VBox_HostService_GuestPropertySvc_h defined */
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