[libvirt] [PATCH 11/14] Support for JSON mode monitor
Daniel P. Berrange
berrange at redhat.com
Thu Dec 3 11:15:36 UTC 2009
On Thu, Dec 03, 2009 at 12:51:13AM +0100, Matthias Bolte wrote:
> 2009/11/26 Daniel P. Berrange <berrange at redhat.com>:
> > +int qemuMonitorJSONIOProcess(qemuMonitorPtr mon,
> > + const char *data,
> > + size_t len,
> > + qemuMonitorMessagePtr msg)
> > +{
> > + int used = 0;
> > + /*VIR_DEBUG("Data %d bytes [%s]", len, data);*/
> > +
> > + while (used < len) {
> > + char *nl = strstr(data + used, LINE_ENDING);
>
> Is it guaranteed that data ends with LINE_ENDING?
That is the current QEMU JSON protocol defintion. The JSON messages
will always be formatted on a single line, followed by their
declared LINE_ENDING (\r\n)
There's a small chance they may change that before release, in
which case we'd need to switch over to a streaming JSON parser
that detects the logical end of the JSON object stream
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list