VirtualBox

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

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

HostServices/GuestProperties, Main: implemented saving guest properties to machine XML, added support for timestamps and did some renaming

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 7.1 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_PROP.
42 */
43 GET_PROP_HOST = 2,
44 /**
45 * Set the value attached to a configuration property key
46 * The parameter format matches that of SET_PROP.
47 */
48 SET_PROP_HOST = 3,
49 /**
50 * Set the value attached to a configuration property key
51 * The parameter format matches that of SET_PROP_VALUE.
52 */
53 SET_PROP_VALUE_HOST = 4,
54 /**
55 * Remove the value attached to a configuration property key
56 * The parameter format matches that of DEL_PROP.
57 */
58 DEL_PROP_HOST = 5,
59 /**
60 * Enumerate guest properties.
61 * The parameter format matches that of ENUM_PROPS.
62 */
63 ENUM_PROPS_HOST = 6
64};
65
66/**
67 * The service functions which are called by guest. The numbers may not change,
68 * so we hardcode them.
69 */
70enum eGuestFn
71{
72 /** Get a guest property */
73 GET_PROP = 1,
74 /** Set a guest property */
75 SET_PROP = 2,
76 /** Set just the value of a guest property */
77 SET_PROP_VALUE = 3,
78 /** Delete a guest property */
79 DEL_PROP = 4,
80 /** Enumerate guest properties */
81 ENUM_PROPS = 5
82};
83
84/** Prefix for extra data keys used by the get and set key value functions */
85#define VBOX_SHARED_INFO_KEY_PREFIX "Guest/"
86/** Helper macro for the length of the prefix VBOX_SHARED_INFO_KEY_PREFIX */
87#define VBOX_SHARED_INFO_PREFIX_LEN (sizeof(VBOX_SHARED_INFO_KEY_PREFIX) - 1)
88/** Maximum length for property names */
89enum { MAX_NAME_LEN = 64 };
90/** Maximum length for property values */
91enum { MAX_VALUE_LEN = 128 };
92/** Maximum length for extra data key values used by the get and set key value functions */
93enum { MAX_FLAGS_LEN = 128 };
94/** Maximum number of properties per guest */
95enum { MAX_KEYS = 256 };
96
97/**
98 * HGCM parameter structures. Packing is explicitly defined as this is a wire format.
99 */
100#pragma pack (1)
101/** The guest is requesting the value of a property */
102typedef struct _GetProperty
103{
104 VBoxGuestHGCMCallInfo hdr;
105
106 /**
107 * The property name (IN pointer)
108 * This must fit to a number of criteria, namely
109 * - Only Utf8 strings are allowed
110 * - Less than or equal to MAX_NAME_LEN bytes in length
111 * - Zero terminated
112 */
113 HGCMFunctionParameter name;
114
115 /**
116 * The returned string data will be placed here. (OUT pointer)
117 * This call returns two null-terminated strings which will be placed one
118 * after another: value and flags.
119 */
120 HGCMFunctionParameter buffer;
121
122 /**
123 * The property timestamp. (OUT uint64_t)
124 */
125
126 HGCMFunctionParameter timestamp;
127
128 /**
129 * If the buffer provided was large enough this will contain the size of
130 * the returned data. Otherwise it will contain the size of the buffer
131 * needed to hold the data and VERR_BUFFER_OVERFLOW will be returned.
132 * (OUT uint32_t)
133 */
134 HGCMFunctionParameter size;
135} GetProperty;
136
137/** The guest is requesting to change a property */
138typedef struct _SetProperty
139{
140 VBoxGuestHGCMCallInfo hdr;
141
142 /**
143 * The property key. (IN pointer)
144 * This must fit to a number of criteria, namely
145 * - Only Utf8 strings are allowed
146 * - Less than or equal to MAX_NAME_LEN bytes in length
147 * - Zero terminated
148 */
149 HGCMFunctionParameter name;
150
151 /**
152 * The value of the property (IN pointer)
153 * Criteria as for the key parameter, but with length less than or equal to
154 * MAX_VALUE_LEN.
155 */
156 HGCMFunctionParameter value;
157
158 /**
159 * The property flags (IN pointer)
160 * This is a comma-separated list of the format flag=value
161 * The length must be less than or equal to MAX_FLAGS_LEN and only
162 * known flag names and values will be accepted.
163 */
164 HGCMFunctionParameter flags;
165} SetProperty;
166
167/** The guest is requesting to change the value of a property */
168typedef struct _SetPropertyValue
169{
170 VBoxGuestHGCMCallInfo hdr;
171
172 /**
173 * The property key. (IN pointer)
174 * This must fit to a number of criteria, namely
175 * - Only Utf8 strings are allowed
176 * - Less than or equal to MAX_NAME_LEN bytes in length
177 * - Zero terminated
178 */
179 HGCMFunctionParameter name;
180
181 /**
182 * The value of the property (IN pointer)
183 * Criteria as for the key parameter, but with length less than or equal to
184 * MAX_VALUE_LEN.
185 */
186 HGCMFunctionParameter value;
187} SetPropertyValue;
188
189/** The guest is requesting to remove a property */
190typedef struct _DelProperty
191{
192 VBoxGuestHGCMCallInfo hdr;
193
194 /**
195 * The property name. This must fit to a number of criteria, namely
196 * - Only Utf8 strings are allowed
197 * - Less than or equal to MAX_NAME_LEN bytes in length
198 * - Zero terminated
199 */
200 HGCMFunctionParameter name;
201} DelProperty;
202
203/** The guest is requesting to enumerate properties */
204typedef struct _EnumProperties
205{
206 VBoxGuestHGCMCallInfo hdr;
207
208 /**
209 * Null-separated array of patterns to match the properties against.
210 * (IN pointer)
211 * If no patterns are given then return all. The list is terminated by an
212 * empty string.
213 */
214 HGCMFunctionParameter patterns;
215 /**
216 * On success, null-separated array of strings in which the properties are
217 * returned. (OUT pointer)
218 * The number of strings in the array is always a multiple of four,
219 * and in sequences of name, value, timestamp (hexadecimal string) and the
220 * flags as a comma-separated list in the format "name=value". The list
221 * is terminated by an empty string after a "flags" entry (or at the
222 * start).
223 */
224 HGCMFunctionParameter strings;
225 /**
226 * On success, the size of the returned data. If the buffer provided is
227 * too small, the size of buffer needed. (OUT uint32_t)
228 */
229 HGCMFunctionParameter size;
230} EnumProperties;
231#pragma pack ()
232
233} /* namespace guestProp */
234
235#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