[erlang-questions] binary typed schema-less protocol

Vincent de Phily vincent.dephily@REDACTED
Tue Jul 30 19:18:02 CEST 2013


On Tuesday 30 July 2013 10:31:04 Chris King wrote:
> (Gah, missed the Reply All.  Sorry Richard.)
> 
> On Tue, Jul 30, 2013 at 1:58 AM, Richard A. O'Keefe <ok@REDACTED> 
wrote:
> > The original poster explicitly asked for a >> schema-less << protocol.
> > 
> > ASN.1 is very much schema-based.
> 
> Color me confused, but doesn't only PER require a schema?  BER/DER/CER
> are all self-describing.

Only up to a point. When decoding, you'll know that you're dealing with, say, 
an integer, but you won't know which field of the enclosing sequence it 
corresponds to, if the fields are optional (that's just one example of 
confusion, but there are more). So you can decode a squeleton of your data, 
but it'll lack meaning.

Contrast this to json or msgpack, which very much encourage you to include the 
meaning inside the data: {"latitude":42.84}. You could play the same game by 
including json-like data description inside your BER payload, but what's the 
point ? You've lost some efficiency and all the automatic data validation.

Schema-less decoding of BER can be interesting for debugging and for partial 
decoding (for example if you're a proxy and only look at metadata before 
forwarding the rest). But most protocols I've seen that need partial decoding 
just put an OCTET STRING in the grammar instead.

-- 
Vincent de Phily



More information about the erlang-questions mailing list