-
Notifications
You must be signed in to change notification settings - Fork 52
AlternatePath and Device Prefix need charset restriction #578
Description
LWM2M specification define Alternate Path (see LWM2M-v1.2.1@transport§6.4.1. Alternate Path)
And also Device Prefix when LWM2M Gateway is used (see Lightweight Machine to Machine Gateway Technical Specification)
Both can be find in a LWM2M path.
E.g. :
- alternate path :
/lwm2m/3/0/1 - device prefix :
/d01/3/0/1 - or both :
/lwm2m/d01/3/0/1
AFIAK, there is only 1 restriction about how Alternate Path should looks like :
This link MUST NOT contain numerical URI segment.
And nothing about Device Prefix (but I maybe missed something)
I think it would be wiser to clearly define how path/prefix MUST look like else we risk to face some issue between different content format.
Currently this value can be see with different constraint in :
- Link Format (as URI reference https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
- and SenML (see https://datatracker.ietf.org/doc/html/rfc8428#section-4.5.1)
In Link format, absolute path should follow :
path-absolute = "/" [ segment-nz *( "/" segment ) ]
segment = *pchar
segment-nz = 1*pchar
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
pct-encoded = "%" HEXDIG HEXDIG
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
And in SenML :
name = firstchat *nextchar
firstchar = ALPHA / DIGIT
nextchat = ALPHA / DIGIT / "-" / ":" / "." / "/" / "_"
I propose some very restrictive constraint to avoid that kind of issues :
alternatePath = "/" segment *( "/" segment)
prefix = "/" segment
segment = ALPHA * (ALPHA / DIGIT) // force segment to start by ALPHA making LWM2M path parsing easier
// no need to parse whole segment to know
// IF we are in the prefix/alternatePath OR in the Id of a LWM2M node
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
Any opinion ?