[Top][All Lists]

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

Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file

From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file
Date: Tue, 23 Jun 2009 14:00:41 -0500
User-agent: Thunderbird (X11/20090320)

Avi Kivity wrote:
It looks brittle to me. What if you want to add an array? Some structure that contains a nested structure?

Can you give me concrete examples?

The typical way this would be handled in an RPC library in C is to introduce complex types. For instance, you could have a MonitorList and a corresponding MON_LIST type. FWIW, is there a jsonrpc library for C that's actually maintained?

I can't find one that even has a functioning website.

If we implement this correctly, then an RPC interface could just be another option to see the computer monitor mode implemented as a "module".

This is deep into overkill territory IMO. We should pick some format that is good enough and has implementations for a variety of languages. Luiz' RFC was well done, but the subject is complex enough to be difficult to get right. And as far as I could tell, all the issues are addressed by jsonrpc. The only downside I can see is that jsonrpc is some kind of ajax-kiddie web-2.0 script dom thingie while we are a serious UNIX style daemon that complies with RFC 123456.

There are many reasons why JSON is a bad representation. For starters, there is no way to encode NULL values in a JSON string. This means you cannot send binary data unless you base64 encode it first. The bounds of integers are also not well defined but most implementations restrict integers to int32. You basically cannot send 64-bit integers without encoding them first. It gets really hairy.

For jsonrpc, there's no standard way to enumerate methods like there is in xml-rpc and jsonrpc isn't self-describing. Having an RPC be self-describing is really useful when dealing with a dynamic language because you can then avoid IDL compilation.

So as far as RPCs go, jsonrpc is actually a pretty bad one. The odd thing about it is you still have to parse json in JavaScript to avoid security problems. Parsing json in js seems to eliminate 99% of the useness of it.


Anthony Liguori

reply via email to

[Prev in Thread] Current Thread [Next in Thread]