[PATCH win32/vd_agent] Support for the VD_AGENT_INFORMATION message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The agent will send an information about its version to the client.
---
depends on http://lists.freedesktop.org/archives/spice-devel/2014-October/017654.html
---
 vdagent/vdagent.cpp | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index aa44383..0ff3d04 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -14,7 +14,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include "vdcommon.h"
 #include "desktop_layout.h"
 #include "display_setting.h"
@@ -93,6 +95,7 @@ private:
     void handle_clipboard_release();
     bool handle_display_config(VDAgentDisplayConfig* display_config, uint32_t port);
     bool handle_max_clipboard(VDAgentMaxClipboard *msg, uint32_t size);
+    void handle_information(VDAgentInformation* information_msg);
     void handle_chunk(VDIChunk* chunk);
     void on_clipboard_grab();
     void on_clipboard_request(UINT format);
@@ -841,6 +844,25 @@ bool VDAgent::handle_announce_capabilities(VDAgentAnnounceCapabilities* announce
     return true;
 }
 
+void VDAgent::handle_information(VDAgentInformation* information_msg)
+{
+    VDAgentInformation* info;
+    uint32_t internal_msg_size;
+
+    if (information_msg->type == VD_AGENT_INFORMATION_VERSION) {
+        internal_msg_size = sizeof(VDAgentInformation) + strlen(VERSION) + 1;
+        info = (VDAgentInformation*) new_chunk(internal_msg_size);
+        if (!info) {
+            return;
+        }
+        info->type = VD_AGENT_INFORMATION_VERSION;
+        memcpy(info->data, VERSION, strlen(VERSION));
+        vd_printf("Sending agent version");
+        write_message(VD_AGENT_INFORMATION, internal_msg_size, info);
+        delete[] (uint8_t *)info;
+    }
+}
+
 bool VDAgent::handle_display_config(VDAgentDisplayConfig* display_config, uint32_t port)
 {
     DisplaySettingOptions disp_setting_opts;
@@ -1278,6 +1300,9 @@ void VDAgent::dispatch_message(VDAgentMessage* msg, uint32_t port)
     case VD_AGENT_ANNOUNCE_CAPABILITIES:
         res = handle_announce_capabilities((VDAgentAnnounceCapabilities*)msg->data, msg->size);
         break;
+    case VD_AGENT_INFORMATION:
+        handle_information((VDAgentInformation*)msg->data);
+        break;
     case VD_AGENT_FILE_XFER_START:
     case VD_AGENT_FILE_XFER_STATUS:
     case VD_AGENT_FILE_XFER_DATA: {
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]