1 | /** @file
|
---|
2 | * Shared information services:
|
---|
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_VBoxSharedInfoSvc_h
|
---|
23 | #define ___VBox_HostService_VBoxSharedInfoSvc_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. */
|
---|
30 | namespace svcInfo {
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * The service functions which are callable by host.
|
---|
34 | */
|
---|
35 | enum eHostFn
|
---|
36 | {
|
---|
37 | /** Pass the address of the console object from Main to the service */
|
---|
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 | */
|
---|
60 | enum eGuestFn
|
---|
61 | {
|
---|
62 | /** Get the value attached to a configuration property key */
|
---|
63 | GET_CONFIG_KEY = 1,
|
---|
64 | /** Set the value attached to a configuration property key */
|
---|
65 | SET_CONFIG_KEY = 2,
|
---|
66 | /** Remove the value attached to a configuration property key */
|
---|
67 | DEL_CONFIG_KEY = 3
|
---|
68 | };
|
---|
69 |
|
---|
70 | /** Prefix for extra data keys used by the get and set key value functions */
|
---|
71 | #define VBOX_SHARED_INFO_KEY_PREFIX "Guest/"
|
---|
72 | /** Helper macro for the length of the prefix VBOX_SHARED_INFO_KEY_PREFIX */
|
---|
73 | #define VBOX_SHARED_INFO_PREFIX_LEN (sizeof(VBOX_SHARED_INFO_KEY_PREFIX) - 1)
|
---|
74 | /** Maximum length for extra data keys used by the get and set key value functions */
|
---|
75 | enum { KEY_MAX_LEN = 64 };
|
---|
76 | /** Maximum length for extra data key values used by the get and set key value functions */
|
---|
77 | enum { KEY_MAX_VALUE_LEN = 128 };
|
---|
78 | /** Maximum number of extra data keys per guest */
|
---|
79 | enum { KEY_MAX_KEYS = 256 };
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * HGCM parameter structures. Packing is explicitly defined as this is a wire format.
|
---|
83 | */
|
---|
84 | #pragma pack (1)
|
---|
85 | /** The guest is requesting the value of a configuration key */
|
---|
86 | typedef struct _GetConfigKey
|
---|
87 | {
|
---|
88 | VBoxGuestHGCMCallInfo hdr;
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * The key to look up (IN pointer)
|
---|
92 | * This must fit to a number of criteria, namely
|
---|
93 | * - Only ASCII characters with no spaces
|
---|
94 | * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length
|
---|
95 | * - Zero terminated
|
---|
96 | */
|
---|
97 | HGCMFunctionParameter key;
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * The value of the key (OUT pointer)
|
---|
101 | */
|
---|
102 | HGCMFunctionParameter value;
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * The size of the value. If this is greater than the size of the array
|
---|
106 | * supplied in the second parameter then no data was transferred and the
|
---|
107 | * call must be repeated. If it is zero then no value was found.
|
---|
108 | * (OUT uint32_t)
|
---|
109 | */
|
---|
110 | HGCMFunctionParameter size;
|
---|
111 | } GetConfigKey;
|
---|
112 |
|
---|
113 | /** The guest is requesting to change the value of a configuration key */
|
---|
114 | typedef struct _SetConfigKey
|
---|
115 | {
|
---|
116 | VBoxGuestHGCMCallInfo hdr;
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * The key to change up. This must fit to a number of criteria, namely
|
---|
120 | * - Only ASCII characters with no spaces
|
---|
121 | * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length
|
---|
122 | * - Zero terminated
|
---|
123 | */
|
---|
124 | HGCMFunctionParameter key;
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * The value of the key (IN pointer)
|
---|
128 | * Criteria as for the key parameter, but with length less that or equal to
|
---|
129 | * VBOX_SHARED_INFO_KEY_MAX_VALUE_LEN. A null pointer causes the value to
|
---|
130 | * be removed from the database.
|
---|
131 | */
|
---|
132 | HGCMFunctionParameter value;
|
---|
133 | } SetConfigKey;
|
---|
134 |
|
---|
135 | /** The guest is requesting to remove a configuration key */
|
---|
136 | typedef struct _DelConfigKey
|
---|
137 | {
|
---|
138 | VBoxGuestHGCMCallInfo hdr;
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * The key to change up. This must fit to a number of criteria, namely
|
---|
142 | * - Only ASCII characters with no spaces
|
---|
143 | * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length
|
---|
144 | * - Zero terminated
|
---|
145 | */
|
---|
146 | HGCMFunctionParameter key;
|
---|
147 | } DelConfigKey;
|
---|
148 | #pragma pack ()
|
---|
149 |
|
---|
150 | } /* namespace svcInfo */
|
---|
151 |
|
---|
152 | #endif /* ___VBox_HostService_VBoxSharedInfoSvc_h defined */
|
---|