Regards Brian Carpenter
On 10/01/2017 03:43, Michael Richardson wrote: > > Brian E Carpenter <brian.e.carpen...@gmail.com> wrote: > >> 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]]] > > > > 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. 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 _______________________________________________ Anima mailing list Anima@ietf.org https://www.ietf.org/mailman/listinfo/anima