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 an extra data key in the machine XML file.
|
---|
41 | * The parameter format matches that of GET_CONFIG_KEY.
|
---|
42 | */
|
---|
43 | GET_CONFIG_KEY_HOST = 2,
|
---|
44 | /**
|
---|
45 | * Set the value attached to an extra data key in the machine XML file.
|
---|
46 | * The parameter format matches that of SET_CONFIG_KEY.
|
---|
47 | */
|
---|
48 | SET_CONFIG_KEY_HOST = 3
|
---|
49 | };
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * The service functions which are called by guest. The numbers may not change,
|
---|
53 | * so we hardcode them.
|
---|
54 | */
|
---|
55 | enum eGuestFn
|
---|
56 | {
|
---|
57 | /** Get the value attached to an extra data key in the machine XML file */
|
---|
58 | GET_CONFIG_KEY = 1,
|
---|
59 | /** Set the value attached to an extra data key in the machine XML file */
|
---|
60 | SET_CONFIG_KEY = 2
|
---|
61 | };
|
---|
62 |
|
---|
63 | /** Prefix for extra data keys used by the get and set key value functions */
|
---|
64 | #define VBOX_SHARED_INFO_KEY_PREFIX "Guest/"
|
---|
65 | /** Helper macro for the length of the prefix VBOX_SHARED_INFO_KEY_PREFIX */
|
---|
66 | #define VBOX_SHARED_INFO_PREFIX_LEN (sizeof(VBOX_SHARED_INFO_KEY_PREFIX) - 1)
|
---|
67 | /** Maximum length for extra data keys used by the get and set key value functions */
|
---|
68 | enum { KEY_MAX_LEN = 64 };
|
---|
69 | /** Maximum length for extra data key values used by the get and set key value functions */
|
---|
70 | enum { KEY_MAX_VALUE_LEN = 128 };
|
---|
71 | /** Maximum number of extra data keys per guest */
|
---|
72 | enum { KEY_MAX_KEYS = 256 };
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * HGCM parameter structures. Packing is explicitly defined as this is a wire format.
|
---|
76 | */
|
---|
77 | #pragma pack (1)
|
---|
78 | /** The guest is requesting the value of a configuration key */
|
---|
79 | typedef struct _GetConfigKey
|
---|
80 | {
|
---|
81 | VBoxGuestHGCMCallInfo hdr;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * The key to look up (IN pointer)
|
---|
85 | * This must fit to a number of criteria, namely
|
---|
86 | * - Only ASCII characters with no spaces
|
---|
87 | * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length
|
---|
88 | * - Zero terminated
|
---|
89 | */
|
---|
90 | HGCMFunctionParameter key;
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * The value of the key (OUT pointer)
|
---|
94 | */
|
---|
95 | HGCMFunctionParameter value;
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * The size of the value. If this is greater than the size of the array
|
---|
99 | * supplied in the second parameter then no data was transferred and the
|
---|
100 | * call must be repeated. If it is zero then no value was found.
|
---|
101 | * (OUT uint32_t)
|
---|
102 | */
|
---|
103 | HGCMFunctionParameter size;
|
---|
104 | } GetConfigKey;
|
---|
105 |
|
---|
106 | /** The guest is requesting to change the value of a configuration key */
|
---|
107 | typedef struct _SetConfigKey
|
---|
108 | {
|
---|
109 | VBoxGuestHGCMCallInfo hdr;
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * The key to change up. This must fit to a number of criteria, namely
|
---|
113 | * - Only ASCII characters with no spaces
|
---|
114 | * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length
|
---|
115 | * - Zero terminated
|
---|
116 | */
|
---|
117 | HGCMFunctionParameter key;
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * The value of the key (IN pointer)
|
---|
121 | * Criteria as for the key parameter, but with length less that or equal to
|
---|
122 | * VBOX_SHARED_INFO_KEY_MAX_VALUE_LEN. A null pointer causes the value to
|
---|
123 | * be removed from the database.
|
---|
124 | */
|
---|
125 | HGCMFunctionParameter value;
|
---|
126 | } SetConfigKey;
|
---|
127 | #pragma pack ()
|
---|
128 |
|
---|
129 | } /* namespace svcInfo */
|
---|
130 |
|
---|
131 | #endif /* ___VBox_HostService_VBoxSharedInfoSvc_h defined */
|
---|