[Spice-commits] 2 commits - configure.ac SpiceXPI/src

Marc-André Lureau elmarco at kemper.freedesktop.org
Sun Feb 19 05:46:59 PST 2012


 SpiceXPI/src/plugin/Makefile.am          |    2 
 SpiceXPI/src/plugin/controller.h         |    2 
 SpiceXPI/src/plugin/controller_prot.h    |  138 -------------------------------
 SpiceXPI/src/plugin/nsScriptablePeer.cpp |    7 +
 SpiceXPI/src/plugin/nsScriptablePeer.h   |    1 
 SpiceXPI/src/plugin/plugin.cpp           |   13 ++
 SpiceXPI/src/plugin/plugin.h             |    5 +
 configure.ac                             |    3 
 8 files changed, 31 insertions(+), 140 deletions(-)

New commits:
commit a4dc304f2c3f3eeb6c1d715458cad7211bbc8c07
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Feb 17 19:07:52 2012 +0100

    Add smartcard option

diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.cpp b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
index b9319a7..8ec50e8 100644
--- a/SpiceXPI/src/plugin/nsScriptablePeer.cpp
+++ b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
@@ -68,6 +68,7 @@ NPIdentifier ScriptablePluginObject::m_id_ssl_channels;
 NPIdentifier ScriptablePluginObject::m_id_trust_store;
 NPIdentifier ScriptablePluginObject::m_id_host_subject;
 NPIdentifier ScriptablePluginObject::m_id_fullscreen;
+NPIdentifier ScriptablePluginObject::m_id_smartcard;
 NPIdentifier ScriptablePluginObject::m_id_admin_console;
 NPIdentifier ScriptablePluginObject::m_id_title;
 NPIdentifier ScriptablePluginObject::m_id_dynamic_menu;
@@ -117,6 +118,7 @@ void ScriptablePluginObject::Init()
     m_id_trust_store = NPN_GetStringIdentifier("TrustStore");
     m_id_host_subject = NPN_GetStringIdentifier("HostSubject");
     m_id_fullscreen = NPN_GetStringIdentifier("fullScreen");
+    m_id_smartcard = NPN_GetStringIdentifier("Smartcard");
     m_id_admin_console = NPN_GetStringIdentifier("AdminConsole");
     m_id_title = NPN_GetStringIdentifier("Title");
     m_id_dynamic_menu = NPN_GetStringIdentifier("dynamicMenu");
@@ -158,6 +160,7 @@ bool ScriptablePluginObject::HasProperty(NPIdentifier name)
            name == m_id_trust_store ||
            name == m_id_host_subject ||
            name == m_id_fullscreen ||
+           name == m_id_smartcard ||
            name == m_id_admin_console ||
            name == m_id_title ||
            name == m_id_dynamic_menu ||
@@ -195,6 +198,8 @@ bool ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
         STRINGZ_TO_NPVARIANT(m_plugin->GetHostSubject(), *result);
     else if (name == m_id_fullscreen)
         BOOLEAN_TO_NPVARIANT(m_plugin->GetFullScreen(), *result);
+    else if (name == m_id_smartcard)
+        BOOLEAN_TO_NPVARIANT(m_plugin->GetSmartcard(), *result);
     else if (name == m_id_admin_console)
         BOOLEAN_TO_NPVARIANT(m_plugin->GetAdminConsole(), *result);
     else if (name == m_id_title)
@@ -269,6 +274,8 @@ bool ScriptablePluginObject::SetProperty(NPIdentifier name, const NPVariant *val
         m_plugin->SetHostSubject(str.c_str());
     else if (name == m_id_fullscreen)
         m_plugin->SetFullScreen(boolean);
+    else if (name == m_id_smartcard)
+        m_plugin->SetSmartcard(boolean);
     else if (name == m_id_admin_console)
         m_plugin->SetAdminConsole(boolean);
     else if (name == m_id_title)
diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.h b/SpiceXPI/src/plugin/nsScriptablePeer.h
index dd97d14..469a05e 100644
--- a/SpiceXPI/src/plugin/nsScriptablePeer.h
+++ b/SpiceXPI/src/plugin/nsScriptablePeer.h
@@ -85,6 +85,7 @@ private:
     static NPIdentifier m_id_trust_store;
     static NPIdentifier m_id_host_subject;
     static NPIdentifier m_id_fullscreen;
+    static NPIdentifier m_id_smartcard;
     static NPIdentifier m_id_admin_console;
     static NPIdentifier m_id_title;
     static NPIdentifier m_id_dynamic_menu;
diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index e982b17..b82d074 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -248,6 +248,7 @@ NPBool nsPluginInstance::init(NPWindow *aWindow)
     m_guest_host_name.clear();
 
     m_fullscreen = PR_FALSE;
+    m_smartcard = PR_FALSE;
     m_admin_console = PR_FALSE;
     m_no_taskmgr_execution = PR_FALSE;
     m_send_ctrlaltdel = PR_FALSE;
@@ -371,6 +372,17 @@ void nsPluginInstance::SetFullScreen(PRBool aFullScreen)
     m_fullscreen = aFullScreen;
 }
 
+/* attribute boolean Smartcard; */
+PRBool nsPluginInstance::GetSmartcard() const
+{
+    return m_smartcard;
+}
+
+void nsPluginInstance::SetSmartcard(PRBool aSmartcard)
+{
+    m_smartcard = aSmartcard;
+}
+
 /* attribute string Title; */
 char *nsPluginInstance::GetTitle() const
 {
@@ -619,6 +631,7 @@ void nsPluginInstance::Connect()
         SendValue(CONTROLLER_FULL_SCREEN,
                    (m_fullscreen == PR_TRUE ? CONTROLLER_SET_FULL_SCREEN : 0) |
                    (m_admin_console == PR_FALSE ? CONTROLLER_AUTO_DISPLAY_RES : 0));
+        SendValue(CONTROLLER_ENABLE_SMARTCARD, m_smartcard == PR_TRUE ? 1 : 0);
         SendStr(CONTROLLER_PASSWORD, m_password.c_str());
         SendStr(CONTROLLER_TLS_CIPHERS, m_cipher_suite.c_str());
         SendStr(CONTROLLER_SET_TITLE, m_title.c_str());
diff --git a/SpiceXPI/src/plugin/plugin.h b/SpiceXPI/src/plugin/plugin.h
index e656ac7..7bd1e44 100644
--- a/SpiceXPI/src/plugin/plugin.h
+++ b/SpiceXPI/src/plugin/plugin.h
@@ -115,6 +115,10 @@ public:
     /* attribute ing FullScreen; */
     PRBool GetFullScreen() const;
     void SetFullScreen(PRBool aFullScreen);
+
+    /* attribute ing smartcard; */
+    PRBool GetSmartcard() const;
+    void SetSmartcard(PRBool aSmartcard);
     
     /* attribute ing Port; */
     char *GetTitle() const;
@@ -187,6 +191,7 @@ private:
     std::string m_trust_store;
     std::string m_host_subject;
     PRBool m_fullscreen;
+    PRBool m_smartcard;
     PRBool m_admin_console;
     std::string m_title;
     std::string m_dynamic_menu;
commit 9250199da870a5594725112e1b2bf9cf597b4ff2
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Feb 17 18:54:46 2012 +0100

    build: use spice-protocol headers

diff --git a/SpiceXPI/src/plugin/Makefile.am b/SpiceXPI/src/plugin/Makefile.am
index a17ac4d..0bb28fe 100644
--- a/SpiceXPI/src/plugin/Makefile.am
+++ b/SpiceXPI/src/plugin/Makefile.am
@@ -6,6 +6,7 @@ SDK_INCLUDE_DIR = `pkg-config --variable=idldir libxul`
 
 INCLUDES =                           \
 	$(XUL_CFLAGS)                    \
+	$(SPICE_PROTOCOL_CFLAGS)         \
 	-I$(top_srcdir)/common           \
 	-I..                             \
 	-I$(top_srcdir)/red	             \
@@ -55,7 +56,6 @@ libnsISpicec_la_SOURCES =            \
 	controller.cpp                   \
 	debug.h                          \
 	controller.h                     \
-	controller_prot.h                \
 	../../../common/rederrorcodes.h  \
 	../../../common/common.h         \
 	nsISpicec.idl                    \
diff --git a/SpiceXPI/src/plugin/controller.h b/SpiceXPI/src/plugin/controller.h
index d724047..07c04c7 100644
--- a/SpiceXPI/src/plugin/controller.h
+++ b/SpiceXPI/src/plugin/controller.h
@@ -62,7 +62,7 @@ extern "C" {
 #  include <limits.h>
 }
 
-#include "controller_prot.h"
+#include <spice/controller_prot.h>
 
 class SpiceController
 {
diff --git a/SpiceXPI/src/plugin/controller_prot.h b/SpiceXPI/src/plugin/controller_prot.h
deleted file mode 100644
index 3d8c7d5..0000000
--- a/SpiceXPI/src/plugin/controller_prot.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- *   Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- *   The contents of this file are subject to the Mozilla Public License Version
- *   1.1 (the "License"); you may not use this file except in compliance with
- *   the License. You may obtain a copy of the License at
- *   http://www.mozilla.org/MPL/
- *
- *   Software distributed under the License is distributed on an "AS IS" basis,
- *   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- *   for the specific language governing rights and limitations under the
- *   License.
- *
- *   Copyright 2009-2011, Red Hat Inc.
- *   Based on mozilla.org's scriptable plugin example
- *
- *   The Original Code is mozilla.org code.
- *
- *   The Initial Developer of the Original Code is
- *   Netscape Communications Corporation.
- *   Portions created by the Initial Developer are Copyright (C) 1998
- *   the Initial Developer. All Rights Reserved.
- *
- *   Contributor(s):
- *   Uri Lublin
- *
- *   Alternatively, the contents of this file may be used under the terms of
- *   either the GNU General Public License Version 2 or later (the "GPL"), or
- *   the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- *   in which case the provisions of the GPL or the LGPL are applicable instead
- *   of those above. If you wish to allow use of your version of this file only
- *   under the terms of either the GPL or the LGPL, and not to allow others to
- *   use your version of this file under the terms of the MPL, indicate your
- *   decision by deleting the provisions above and replace them with the notice
- *   and other provisions required by the GPL or the LGPL. If you do not delete
- *   the provisions above, a recipient may use your version of this file under
- *   the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef CONTROLLER_PROT_H
-#define CONTROLLER_PROT_H
-
-#define CONTROLLER_MAGIC      (*(uint32_t*)"CTRL")
-#define CONTROLLER_VERSION    1
-
-#ifdef __GNUC__
-#  define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#  define ATTR_PACKED __declspec(align(1))
-#endif
-
-typedef struct ATTR_PACKED ControllerInitHeader {
-    uint32_t magic;
-    uint32_t version;
-    uint32_t size;
-} ControllerInitHeader;
-
-typedef struct ATTR_PACKED ControllerInit {
-    ControllerInitHeader base;
-    uint64_t credentials;
-    uint32_t flags;
-} ControllerInit;
-
-enum {
-    CONTROLLER_FLAG_EXCLUSIVE = 1 << 0,
-};
-
-typedef struct ATTR_PACKED ControllerMsg {
-    uint32_t id;
-    uint32_t size;
-} ControllerMsg;
-
-enum {
-    //extrenal app -> spice client
-    CONTROLLER_HOST = 1,
-    CONTROLLER_PORT,
-    CONTROLLER_SPORT,
-    CONTROLLER_PASSWORD,
-
-    CONTROLLER_SECURE_CHANNELS,
-    CONTROLLER_DISABLE_CHANNELS,
-
-    CONTROLLER_TLS_CIPHERS,
-    CONTROLLER_CA_FILE,
-    CONTROLLER_HOST_SUBJECT,
-
-    CONTROLLER_FULL_SCREEN,
-    CONTROLLER_SET_TITLE,
-
-    CONTROLLER_CREATE_MENU,
-    CONTROLLER_DELETE_MENU,
-
-    CONTROLLER_HOTKEYS,
-    CONTROLLER_SEND_CAD,
-
-    CONTROLLER_CONNECT,
-    CONTROLLER_SHOW,
-    CONTROLLER_HIDE,
-
-    //spice client -> extrenal app
-    CONTROLLER_MENU_ITEM_CLICK = 1001,
-};
-
-#define CONTROLLER_TRUE (1 << 0)
-
-enum {
-    CONTROLLER_SET_FULL_SCREEN  = CONTROLLER_TRUE,
-    CONTROLLER_AUTO_DISPLAY_RES = 1 << 1,
-};
-
-typedef struct ATTR_PACKED ControllerValue {
-    ControllerMsg base;
-    uint32_t value;
-} ControllerValue;
-
-typedef struct ATTR_PACKED ControllerData {
-    ControllerMsg base;
-    uint8_t data[0];
-} ControllerData;
-
-#define CONTROLLER_MENU_ITEM_DELIMITER L"\n"
-#define CONTROLLER_MENU_PARAM_DELIMITER L"\r"
-
-enum {
-    CONTROLLER_MENU_FLAGS_SEPARATOR    = 1 << 0,
-    CONTROLLER_MENU_FLAGS_DISABLED     = 1 << 1,
-    CONTROLLER_MENU_FLAGS_POPUP        = 1 << 2,
-    CONTROLLER_MENU_FLAGS_CHECKED      = 1 << 3,
-    CONTROLLER_MENU_FLAGS_GRAYED       = 1 << 4,
-};
-
-#define SPICE_MENU_INTERNAL_ID_BASE   0x1300
-#define SPICE_MENU_INTERNAL_ID_SHIFT  8
-
-#undef ATTR_PACKED
-
-#endif // CONTROLLER_PROT_H
diff --git a/configure.ac b/configure.ac
index ebaf25f..eefb354 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,9 @@ PKG_CHECK_MODULES(LOG4CPP, log4cpp)
 AC_SUBST(LOG4CPP_CFLAGS)
 AC_SUBST(LOG4CPP_LIBS)
 
+PKG_CHECK_MODULES(SPICE_PROTOCOL, spice-protocol >= 0.10.2)
+AC_SUBST(SPICE_PROTOCOL_CFLAGS)
+
 # The explicit nspr dep is needed because libxul-embedding
 # in RHEL5 is missing the Requires
 PKG_CHECK_MODULES(XUL, libxul-embedding >= 1.9 nspr >= 4.7.1)


More information about the Spice-commits mailing list