summaryrefslogtreecommitdiff
path: root/open-vm-tools/lib/include/vmware/guestrpc/capabilities.h
blob: fc88812444f129be35fee7a9e71feabbed40e75a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*********************************************************
 * Copyright (C) 2008-2015 VMware, Inc. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation version 2.1 and no later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
 *
 *********************************************************/

/*
 * capabilities.h --
 *
 *  Common definitions for the guestCaps system that allows a guest to
 *  register an arbitrary number of boolean capabilites with the vmx.
 */

#ifndef _GUEST_CAPS_H_
#define _GUEST_CAPS_H_

/*
 * Guest capabilities.
 * The guest uses this enum to communicate whether a certain
 * feature is supported by the tools.
 * The guest sends an RPC where it specifies which features
 * are turned off and on, for example
 * "tools.capability.features 0=1 2=1 3=0".
 * In the above example, the guest is capable of showing the
 * start menu and setting the work area, but does not support
 * multiple monitors.
 *
 * NOTE: the order for these has to stay constant for backward compatibility
 * with older Tools versions. New capabilities must be added at the end.
 */

typedef enum {
   UNITY_CAP_START_MENU                 = 0,  // can show the start menu
   UNITY_CAP_VIRTUAL_DESK               = 1,  // supports virtual desktops
   UNITY_CAP_WORK_AREA                  = 2,  // can set the work area
   UNITY_CAP_MULTI_MON                  = 3,  // supports multiple monitors
   GHI_CAP_SHELL_ACTION_BROWSE          = 4,  // supports the "browse" action verb
   GHI_CAP_SHELL_LOCATION_HGFS          = 5,  // supports HGFS location URIs
   GHI_CAP_SHELL_ACTION_RUN             = 6,  // supports the "run" action verb
   GHI_CAP_CMD_SHELL_ACTION             = 7,  // allows "ghi.guest.shell.action" command
   HGFSU_CAP_MIRROR_DESKTOP             = 8,  // supports remapping GOS Desktop to HGFS
   HGFSU_CAP_MIRROR_DOCUMENTS           = 9,  // supports remapping GOS Documents to HGFS
   HGFSU_CAP_MIRROR_MUSIC               = 10, // supports remapping GOS Music to HGFS
   HGFSU_CAP_MIRROR_PICTURES            = 11, // supports remapping GOS Pictures to HGFS
   HGFSU_CAP_DESKTOP_SHORTCUT           = 12, // supports creating HGFS link on GOS Desktop
   HGFSU_CAP_MAP_DRIVE                  = 13, // supports mapping a GOS drive letter to HGFS
   GHI_CAP_SET_HANDLER                  = 14, // supports setting the handler for types/protocols
   UNITY_CAP_STATUS_UNITY_ACTIVE        = 15, // supports GuestRpc bits for Unity Status
   GHI_CAP_SET_OUTLOOK_TEMP_FOLDER      = 16, // supports setting the Outlook temp folder
   OBSOLETE_17                          = 17, // 17 is obsolete, do not use
   CAP_SET_TOPO_MODES                   = 18, // supports setting topology modes in video driver
   GHI_CAP_TRAY_ICONS                   = 19, // supports ghi.guest.trayIcon commands
   GHI_CAP_SET_FOCUSED_WINDOW           = 20, // supports ghi.guest.setFocusedWindow
   GHI_CAP_GET_EXEC_INFO_HASH           = 21, // supports ghi.guest.getExecInfoHash
   UNITY_CAP_STICKY_WINDOWS             = 22, // supports unity.window.{un,}stick
   CAP_CHANGE_HOST_3D_AVAILABILITY_HINT = 23, // supports sending 3D support hint to guest
   CAP_AUTOUPGRADE_AT_SHUTDOWN          = 24, // supports auto-upgrading tools at OS shutdown
   GHI_CAP_AUTOLOGON                    = 25, // supports autologon
   CAP_DESKTOP_AUTOLOCK                 = 26, // supports desktop autolock
   CAP_UPDATE_AGENT                     = 27, // supports guest update agent
   HGFSU_CAP_MIRROR_DOWNLOADS           = 28, // supports remapping GOS Downloads to HGFS
   HGFSU_CAP_MIRROR_MOVIES              = 29, // supports remapping GOS Movies to HGFS
   GHI_CAP_TOGGLE_START_UI              = 30, // supports showing/hiding the Start UI
   GHI_CAP_SET_DISPLAY_SCALING          = 31, // supports setting the display scaling (DPI)
   UNITY_CAP_DISABLE_MOUSE_BUTTON_SWAPPING     = 32, // supports disabling mouse button swapping
} GuestCapabilities;

typedef struct {
   GuestCapabilities cap;
   const char *vmdbPath;
   const char *vmdbKey;
} GuestCapElem;

/* guest_rpc command to send over the wire. */
#define GUEST_CAP_FEATURES                   "tools.capability.features"

#if defined(VM_NEED_VMDB_GUEST_CAP_MAPPING)

/* VMDB paths prefixes to store various capabilities sent from the guest. */
#define UNITY_CAP_VMDB_PATH                  "guest/caps/unityFeatures"
#define GHI_CAP_VMDB_PATH                    "guest/caps/ghiFeatures"
#define HGFSU_CAP_VMDB_PATH                  "guest/caps/hgfsUsabilityFeatures"
#define CAP_VMDB_PATH                        "guest/caps"

/*
 * If you change these strings, make sure you also change the
 *  vmdb schema, since these strings are used as vmdb keys.
 */

/*
 * This table must be sorted such that it can be indexed using the
 * GuestCapabilities enum above. RPC calls pass the value, and the
 * handler code uses it as an index. In other words, the value of the
 * caps field at index i must be equal to i as well. This is because
 * the code that looks up entries in this table assume as much. It
 * also means we don't need the cap field, or, to justify its existence,
 * the lookup code should be converted to loop through the table and
 * return the entry where cap == the value passed in the RPC call.
 * Moral of the story, new entries always at the bottom of the table
 * and the cap field must be set to the offset in the array (and make
 * sure the enum in GuestCapabilities is also set to that offset).
 */

static GuestCapElem guestCapTable[] = {
   { UNITY_CAP_START_MENU,                 UNITY_CAP_VMDB_PATH, "startmenu" },
   { UNITY_CAP_VIRTUAL_DESK,               UNITY_CAP_VMDB_PATH, "virtualdesk" },
   { UNITY_CAP_WORK_AREA,                  UNITY_CAP_VMDB_PATH, "workarea" },
   { UNITY_CAP_MULTI_MON,                  UNITY_CAP_VMDB_PATH, "multimon" },

   { GHI_CAP_SHELL_ACTION_BROWSE,          GHI_CAP_VMDB_PATH,   "shellActionBrowse" },
   { GHI_CAP_SHELL_LOCATION_HGFS,          GHI_CAP_VMDB_PATH,   "shellLocationHGFS" },
   { GHI_CAP_SHELL_ACTION_RUN,             GHI_CAP_VMDB_PATH,   "shellActionRun" },
   { GHI_CAP_CMD_SHELL_ACTION,             GHI_CAP_VMDB_PATH,   "cmdShellAction" },

   { HGFSU_CAP_MIRROR_DESKTOP,             HGFSU_CAP_VMDB_PATH, "mirrorDesktop" },
   { HGFSU_CAP_MIRROR_DOCUMENTS,           HGFSU_CAP_VMDB_PATH, "mirrorDocuments" },
   { HGFSU_CAP_MIRROR_MUSIC,               HGFSU_CAP_VMDB_PATH, "mirrorMusic" },
   { HGFSU_CAP_MIRROR_PICTURES,            HGFSU_CAP_VMDB_PATH, "mirrorPictures" },
   { HGFSU_CAP_DESKTOP_SHORTCUT,           HGFSU_CAP_VMDB_PATH, "createShortcut" },
   { HGFSU_CAP_MAP_DRIVE,                  HGFSU_CAP_VMDB_PATH, "mapDrive" },
   { GHI_CAP_SET_HANDLER,                  GHI_CAP_VMDB_PATH,   "setHandler" },
   { UNITY_CAP_STATUS_UNITY_ACTIVE,        UNITY_CAP_VMDB_PATH, "unityActive" },
   { GHI_CAP_SET_OUTLOOK_TEMP_FOLDER,      GHI_CAP_VMDB_PATH,   "setOutlookTempFolder" },
   { OBSOLETE_17,                          NULL,                NULL },
   { CAP_SET_TOPO_MODES,                   CAP_VMDB_PATH,       "displayTopologyModesSet" },
   { GHI_CAP_TRAY_ICONS,                   GHI_CAP_VMDB_PATH,   "trayIcons" },
   { GHI_CAP_SET_FOCUSED_WINDOW,           GHI_CAP_VMDB_PATH,   "setFocusedWindow"},
   { GHI_CAP_GET_EXEC_INFO_HASH,           GHI_CAP_VMDB_PATH,   "getExecInfoHash"},
   { UNITY_CAP_STICKY_WINDOWS,             UNITY_CAP_VMDB_PATH, "sticky"},
   { CAP_CHANGE_HOST_3D_AVAILABILITY_HINT, CAP_VMDB_PATH,       "changeHost3DAvailabilityHint" },
   { CAP_AUTOUPGRADE_AT_SHUTDOWN,          CAP_VMDB_PATH,       "autoUpgradeAtShutdown"},
   { GHI_CAP_AUTOLOGON,                    GHI_CAP_VMDB_PATH,   "autologon" },
   { CAP_DESKTOP_AUTOLOCK,                 CAP_VMDB_PATH,       "desktopAutolock" },
   { CAP_UPDATE_AGENT,                     CAP_VMDB_PATH,       "updateAgent"},
   { HGFSU_CAP_MIRROR_DOWNLOADS,           HGFSU_CAP_VMDB_PATH, "mirrorDownloads" },
   { HGFSU_CAP_MIRROR_MOVIES,              HGFSU_CAP_VMDB_PATH, "mirrorMovies" },
   { GHI_CAP_TOGGLE_START_UI,              GHI_CAP_VMDB_PATH,   "toggleStartUI"},
   { GHI_CAP_SET_DISPLAY_SCALING,          GHI_CAP_VMDB_PATH,   "setDisplayScaling"},
   { UNITY_CAP_DISABLE_MOUSE_BUTTON_SWAPPING, UNITY_CAP_VMDB_PATH, "mouseButtonSwapping" },
};

#endif // VM_NEED_VMDB_GUEST_CAP_MAPPING

#endif // _GUEST_CAPS_H_