~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools.raring-precise.backport

« back to all changes in this revision

Viewing changes to services/plugins/unity/unityPlugin.h

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********************************************************
2
 
 * Copyright (C) 2010 VMware, Inc. All rights reserved.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License as published
6
 
 * by the Free Software Foundation version 2.1 and no later version.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
11
 
 * License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this program; if not, write to the Free Software Foundation, Inc.,
15
 
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
16
 
 *
17
 
 *********************************************************/
18
 
 
19
 
/*
20
 
 * unityPlugin.h --
21
 
 *
22
 
 *    Defines the object that implements the tools core service plugin form of
23
 
 *    Unity.
24
 
 */
25
 
 
26
 
#ifndef _UNITY_PLUGIN_H_
27
 
#define _UNITY_PLUGIN_H_
28
 
 
29
 
#include <string>
30
 
#include <vector>
31
 
 
32
 
#ifdef _WIN32
33
 
#include "boost/shared_ptr.hpp"
34
 
#endif // _WIN32
35
 
 
36
 
#include "vmware/tools/plugin.h"
37
 
 
38
 
namespace vmware { namespace tools {
39
 
 
40
 
class UnityPBRPCServer;
41
 
 
42
 
typedef struct _UnityUpdateChannel UnityUpdateChannel;
43
 
 
44
 
 
45
 
/*
46
 
 *-----------------------------------------------------------------------------
47
 
 *
48
 
 * vmware::tools::RpcChannelCallbackEntry --
49
 
 *
50
 
 *      Helper struct to build an RPCChannelCallback structure from a command
51
 
 *      string and RpcIn_Callback.
52
 
 *
53
 
 *-----------------------------------------------------------------------------
54
 
 */
55
 
 
56
 
struct RpcChannelCallbackEntry
57
 
   : public RpcChannelCallback
58
 
{
59
 
   RpcChannelCallbackEntry(const char *RpcName, RpcIn_Callback func)
60
 
   {
61
 
      name = RpcName;
62
 
      callback = func;
63
 
      clientData = NULL;
64
 
      xdrIn = NULL;
65
 
      xdrOut = NULL;
66
 
      xdrInSize = 0;
67
 
   }
68
 
};
69
 
 
70
 
 
71
 
/*
72
 
 *-----------------------------------------------------------------------------
73
 
 *
74
 
 * vmware::tools::ToolsAppCapabilityOldEntry --
75
 
 *
76
 
 *      Helper struct to build an ToolsAppCapability structure from an old
77
 
 *      style capability name and flag to indicate whether the capability is
78
 
 *      enabled.
79
 
 *
80
 
 *-----------------------------------------------------------------------------
81
 
 */
82
 
 
83
 
struct ToolsAppCapabilityOldEntry
84
 
   : public ToolsAppCapability
85
 
{
86
 
   ToolsAppCapabilityOldEntry(const char *capName, gboolean enabled)
87
 
   {
88
 
      type = TOOLS_CAP_OLD;
89
 
      /* The capability name field is not-const (though it seems to be treated that way)
90
 
       * so we'll need to cast away the const here 8-(
91
 
       */
92
 
      name = const_cast<gchar*>(capName);
93
 
      value = enabled;
94
 
   }
95
 
};
96
 
 
97
 
 
98
 
/*
99
 
 *-----------------------------------------------------------------------------
100
 
 *
101
 
 * vmware::tools::ToolsAppCapabilityNewEntry --
102
 
 *
103
 
 *      Helper struct to build an ToolsAppCapability structure from a new style
104
 
 *      capability index and flag to indicate whether the capability is enabled.
105
 
 *
106
 
 *-----------------------------------------------------------------------------
107
 
 */
108
 
 
109
 
struct ToolsAppCapabilityNewEntry
110
 
   : public ToolsAppCapability
111
 
{
112
 
   ToolsAppCapabilityNewEntry(GuestCapabilities cap, gboolean enabled)
113
 
   {
114
 
      type = TOOLS_CAP_NEW;
115
 
      name = NULL;
116
 
      index = cap;
117
 
      value = enabled;
118
 
   }
119
 
};
120
 
 
121
 
 
122
 
/*
123
 
 *-----------------------------------------------------------------------------
124
 
 *
125
 
 * vmware::tools::ToolsPlugin --
126
 
 *
127
 
 *      Defines a pure virtual interface for plugins to implement. These
128
 
 *      methods are called by per-plugin static C functions in the the plugin
129
 
 *      entry module.
130
 
 *
131
 
 *-----------------------------------------------------------------------------
132
 
 */
133
 
 
134
 
class ToolsPlugin {
135
 
public:
136
 
   struct SignalCtx
137
 
      : public ToolsPluginSignalCb
138
 
   {
139
 
      SignalCtx(const char* signame_, void* callback_, void* clientData_)
140
 
      {
141
 
         signame = signame_;
142
 
         callback = callback_;
143
 
         clientData = clientData_;
144
 
      }
145
 
   };
146
 
 
147
 
   virtual ~ToolsPlugin() {};
148
 
 
149
 
   virtual gboolean Initialize() = 0;
150
 
   virtual gboolean Reset(gpointer src) = 0;
151
 
   virtual void Shutdown(gpointer src) = 0;
152
 
   virtual gboolean SetOption(gpointer src,
153
 
                              const std::string &option,
154
 
                              const std::string &value) = 0;
155
 
 
156
 
   virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set) = 0;
157
 
   virtual std::vector<RpcChannelCallback> GetRpcCallbackList() = 0;
158
 
   virtual std::vector<ToolsPluginSignalCb> GetSignalRegistrations(ToolsPluginData*) const;
159
 
 
160
 
protected:
161
 
   ToolsPlugin(const ToolsAppCtx* ctx) : mCtx(ctx) {}
162
 
 
163
 
   // C thunks.
164
 
   static gboolean OnCReset(gpointer src, ToolsAppCtx* ctx, ToolsPluginData* pdata);
165
 
   static void OnCShutdown(gpointer src, ToolsAppCtx* ctx, ToolsPluginData* pdata);
166
 
   static GArray* OnCCapabilities(gpointer src, ToolsAppCtx* ctx, gboolean set,
167
 
                                  ToolsPluginData* plugin);
168
 
   static gboolean OnCSetOption(gpointer src, ToolsAppCtx* ctx, const gchar* option,
169
 
                                const gchar* value, ToolsPluginData* plugin);
170
 
 
171
 
   const ToolsAppCtx* mCtx;
172
 
};
173
 
 
174
 
 
175
 
class UnityPlugin
176
 
   : public ToolsPlugin
177
 
{
178
 
public:
179
 
   virtual gboolean Initialize();
180
 
 
181
 
   virtual gboolean Reset(gpointer src) { return TRUE; }
182
 
   virtual void Shutdown(gpointer src) {};
183
 
   virtual gboolean SetOption(gpointer src,
184
 
                              const std::string &option,
185
 
                              const std::string &value)
186
 
   {
187
 
      return FALSE;
188
 
   }
189
 
 
190
 
   virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set);
191
 
   virtual std::vector<RpcChannelCallback> GetRpcCallbackList();
192
 
 
193
 
protected:
194
 
   UnityPlugin(const ToolsAppCtx* ctx);
195
 
   virtual ~UnityPlugin();
196
 
 
197
 
   UnityUpdateChannel *mUnityUpdateChannel;
198
 
};
199
 
 
200
 
#ifdef _WIN32
201
 
class UnityPluginWin32
202
 
   : public UnityPlugin
203
 
{
204
 
public:
205
 
   UnityPluginWin32(const ToolsAppCtx* ctx);
206
 
   virtual ~UnityPluginWin32();
207
 
 
208
 
   virtual gboolean Initialize();
209
 
 
210
 
   virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set);
211
 
   virtual std::vector<ToolsPluginSignalCb> GetSignalRegistrations(ToolsPluginData*) const;
212
 
 
213
 
   virtual DWORD OnServiceControl(gpointer src,
214
 
                                  ToolsAppCtx *ctx,
215
 
                                  SERVICE_STATUS_HANDLE handle,
216
 
                                  guint control,
217
 
                                  guint evtType,
218
 
                                  gpointer evtData);
219
 
 
220
 
   virtual void OnDesktopSwitch();
221
 
 
222
 
protected:
223
 
   boost::shared_ptr<UnityPBRPCServer> mUnityPBRPCServer;
224
 
 
225
 
private:
226
 
   static DWORD OnCServiceControl(gpointer src, ToolsAppCtx* ctx,
227
 
                                  SERVICE_STATUS_HANDLE handle, guint control,
228
 
                                  guint evtType, gpointer evtData,
229
 
                                  ToolsPluginData* data);
230
 
   static void OnCDesktopSwitch(gpointer src, ToolsAppCtx* ctx, ToolsPluginData* plugin);
231
 
};
232
 
#endif // _WIN32
233
 
 
234
 
} /* namespace tools */ } /* namespace vmware */
235
 
 
236
 
#endif // _UNITY_PLUGIN_H_