Subject: [Anima] clarify +locator-option

From: Michael Richardson <[email-masked]>
Date: Sun, 08 Jan 2017 20:02:54 -0500

When I read:
     divert-option = [O_DIVERT, +locator-option]

I think that it means that +locator-option means that one can multiple
options, and that they would be inside an array?

So, for example:

[O_DIVERT, [ [O_IPv6_LOCATOR, ipv6-address, transport-proto, port-number],
             [O_IPv4_LOCATOR, ipv6-address, transport-proto, port-number],
             [O_FQDN_LOCATOR, ipv6-address, transport-proto, port-number]]]

--
Michael Richardson <[email-masked]>, Sandelman Software Works
 -= IPv6 IoT consulting =-

---

From: Brian E Carpenter <[email-masked]>
Date: Mon, 9 Jan 2017 15:58:47 +1300

>              [O_FQDN_LOCATOR, ipv6-address, transport-proto, port-number]]]

I'm not sure there's an additional array. CBOR can handle arrays of undefined
length, so I think that syntax generates

[O_DIVERT,  [O_IPv6_LOCATOR, ipv6-address, transport-proto, port-number],
            [O_IPv4_LOCATOR, ipv6-address, transport-proto, port-number],
            [O_FQDN_LOCATOR, ipv6-address, transport-proto, port-number]]

but I'd rather hear that from Carsten to be sure.

    Brian

---

From: Michael Richardson <[email-masked]>
Date: Mon, 09 Jan 2017 09:43:00 -0500

Brian E Carpenter <[email-masked]> wrote:
    >> When I read: divert-option = [O_DIVERT, +locator-option]
    >>
    >> [O_DIVERT, [ [O_IPv6_LOCATOR, ipv6-address, transport-proto,
    >> port-number], [O_IPv4_LOCATOR, ipv6-address, transport-proto,
    >> port-number], [O_FQDN_LOCATOR, ipv6-address, transport-proto,
    >> port-number]]]

    > I'm not sure there's an additional array. CBOR can handle arrays of
    > undefined length, so I think that syntax generates

    > [O_DIVERT, [O_IPv6_LOCATOR, ipv6-address, transport-proto,
    > port-number], [O_IPv4_LOCATOR, ipv6-address, transport-proto,
    > port-number], [O_FQDN_LOCATOR, ipv6-address, transport-proto,
    > port-number]]

    > but I'd rather hear that from Carsten to be sure.

But, have specification like:

response-message = [M_RESPONSE, session-id, initiator, ttl,
                   (+locator-option // divert-option), ?objective)]

so unless the () implies a level of sub-array, then there would be
some unknown number of location-options, and then the last item would be
objective, *if* it exists.

---

From: Brian E Carpenter <[email-masked]>
Date: Tue, 10 Jan 2017 12:33:23 +1300

Regards
   Brian Carpenter

> objective, *if* it exists.

In CDDL (...) is just a way of grouping items syntactically, it
doesn't represent anything in the data. [...] signals an array
and {...} signals a map, which we haven't used in GRASP.

So yes, there is a possible parsing problem in that syntax, because
the + signals "one or more" and the ? signals "0 or 1". So if there
are at least 2 elements, the last one might be a locator or an objective.

<pause to stare at my code for a while>

The reason I hadn't thought about this is in the comments at the
beginning of my code:
#  - the spec allows an optional Objective option in
#      Response messages: not implemented
To be honest I don't know what value this feature adds.

It can be parsed from the CBOR, however. All options *except* objectives
start with an integer. Objectives start with a text string. If you don't
like that, we'd have to change the syntax slightly.

   Brian