On 04/21/2011 03:30 AM, Jes Sorensen wrote:
On 04/18/11 17:02, Michael Roth wrote:
diff --git a/qmp-core.c b/qmp-core.c
index 9f3d182..dab50a1 100644
--- a/qmp-core.c
+++ b/qmp-core.c
@@ -937,7 +937,15 @@ void qmp_async_complete_command(QmpCommandState *cmd,
QObject *retval, Error *er
qemu_free(cmd);
}
+extern QmpProxy *qmp_proxy_default;
Please put this in a header file.
+static void qmp_proxy_process_control_event(QmpProxy *p, const QDict *evt)
+{
+ const char *cmd;
+ int host_sid, guest_sid;
+
+ cmd = qdict_get_try_str(evt, "_control_event");
+ if (!cmd) {
+ fprintf(stderr, "received NULL control event\n");
+ } else if (strcmp(cmd, "guest_ack") == 0) {
+ host_sid = qdict_get_try_int(evt, "_control_arg_host_sid", 0);
+ if (!host_sid) {
+ fprintf(stderr, "invalid guest_ack: wrong host sid\n");
+ return;
+ }
+ /* guest responded to host_init, return a host_ack */
+ /* reset outstanding requests, then send an ack with the
+ * session id they passed us
+ */
+ guest_sid = qdict_get_try_int(evt, "_control_arg_guest_sid", 0);
I am wondering if it would make sense to put these arguments in a header
file as #define's to make sure you don't have to chase down a typo on
one side at some point? Just an idea, dunno if it is worth it.
That's probably a good idea.
Cheers,
Jes