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