[Spice-devel] [PATCH win32/vd_agent] Support for the VD_AGENT_INFORMATION message
Pavel Grunt
pgrunt at redhat.com
Thu Oct 23 09:15:22 PDT 2014
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
More information about the Spice-devel
mailing list