Subject: [Anima-signaling] JSONizing v2

From: Brian E Carpenter <[email-masked]>
Date: Mon, 08 Jun 2015 16:14:37 +1200

Hi,

This version at least has validated JSON examples. I'm reasonably satisfied
that we *could* refactor GDNP completely into JSON and CBOR, with no loss of
functionality (but a high probability of being unable to use UDP except
for discovery messages). Whether we *should* do so is another question,
of course. I'd really like feedback from everybody in the design team on
that.

    Brian

---

From: "Joe Hildebrand (jhildebr)" <[email-masked]>
Date: Mon, 8 Jun 2015 16:40:14 +0000

>of course. I'd really like feedback from everybody in the design team on

A couple of notes:

- your session id's are still integers.  as you note down lower, that's likely going to need to change to strings at some point.

- Once you get more than 2 items in a list that uses list position as a semantic indicator, you should consider using an object instead.  lists are really better as indefinite-length collections of similar things.

- consider the code you'll need to write to process your messages.  For example, with your current approach:

    {"resp": []}

you'll need to say:

if (msg['resp']) then 
else if (msg['neg']) then
...

instead, if you did this:
{"type": "resp", "id": "121212", ...}

the code can be a simpler switch statement on msg['type'] in some languages.  This syntax is a little more discoverable on the part of the programmer, because you don't have to keep referring back to the docs to figure out what the second parameter is.  It will also allow adding new top-level things in the future, which always seems to be an issue in the ordered approach.

- for v4a at least, byte ordering probably matters at least sometimes.  Providing an example will make this more testable.

- for v6a, does inet_ntop support the format you've chosen (no colons)? writing a new parser isn't much fun even if it's just hex decoding with (hopefully) all of the edge cases dealt with.

-- 
Joe Hildebrand

---

From: Brian E Carpenter <[email-masked]>
Date: Tue, 09 Jun 2015 08:28:59 +1200

Thanks Joe. Of course, if we go this way we will take your advice on the
best way to design the JSON. I don't want to spend too much effort on that
until we decide.

(The IPv6 address representation bugs me, however. I really can't see an
efficient way to handle it.)

Regards
   Brian