[ogpx] type-system : binary elements in JSON serializations

Meadhbh Hamrick <ohmeadhbh@gmail.com> Sun, 28 March 2010 17:33 UTC

Return-Path: <ohmeadhbh@gmail.com>
X-Original-To: ogpx@core3.amsl.com
Delivered-To: ogpx@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id C36543A67AC for <ogpx@core3.amsl.com>; Sun, 28 Mar 2010 10:33:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.131
X-Spam-Level: *
X-Spam-Status: No, score=1.131 tagged_above=-999 required=5 tests=[BAYES_50=0.001, DNS_FROM_OPENWHOIS=1.13]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id muC0LoG27wP5 for <ogpx@core3.amsl.com>; Sun, 28 Mar 2010 10:33:42 -0700 (PDT)
Received: from mail-qy0-f196.google.com (mail-qy0-f196.google.com [209.85.221.196]) by core3.amsl.com (Postfix) with ESMTP id 3BB453A65A6 for <ogpx@ietf.org>; Sun, 28 Mar 2010 10:33:42 -0700 (PDT)
Received: by qyk34 with SMTP id 34so4749580qyk.22 for <ogpx@ietf.org>; Sun, 28 Mar 2010 10:34:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:received :message-id:subject:to:content-type; bh=EkBcTEONnJnMKlqmB4gprgJ4qU5807yj2ptLn4qyfvU=; b=BEogOLkby8XXVclJNsrp6hx5vBTpXuGpXHdSzcJimV9BTT0NL7LnuYkwn3b37QVIO8 fDvK9Xzi0pWOitiKkCPOFZt+rlvFbiF5h8xLvaTUiwV4DNXy9V9D1Nm/QQYGzGAfB+Sh tf6o8qWOMVDhKJkd56mmOsmGZxVQLlWbht9L8=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=yIEChMLjOZwlFOQJ3VoggvJlXYUSPf6TGshQR1wL2YCfKyZua5sRhuCbvWmGcA0TBx GekgMFzsuVLQHsfSdmjs+X/nq86CH2/qZLYm7VdEmZpx/h+1YiXb+YT+JoHmLKv/+/lm R2mhIg+6234UlUmGxTHSEfYw1kLMeZbhxRvl4=
MIME-Version: 1.0
Received: by 10.229.20.209 with HTTP; Sun, 28 Mar 2010 10:33:46 -0700 (PDT)
From: Meadhbh Hamrick <ohmeadhbh@gmail.com>
Date: Sun, 28 Mar 2010 10:33:46 -0700
Received: by 10.229.217.14 with SMTP id hk14mr2740248qcb.89.1269797646106; Sun, 28 Mar 2010 10:34:06 -0700 (PDT)
Message-ID: <b325928b1003281033p28c92367x2be877cc348268da@mail.gmail.com>
To: ogpx <ogpx@ietf.org>
Content-Type: text/plain; charset="ISO-8859-1"
Subject: [ogpx] type-system : binary elements in JSON serializations
X-BeenThere: ogpx@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Virtual World Region Agent Protocol - IETF working group <ogpx.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/ogpx>, <mailto:ogpx-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/ogpx>
List-Post: <mailto:ogpx@ietf.org>
List-Help: <mailto:ogpx-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ogpx>, <mailto:ogpx-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Mar 2010 17:33:43 -0000

i'm not sure if this was the recommendation made at the f2f meeting
last tuesday, so let me try to define it.

the issue is that JSON does not provide a mechanism to differentiate
between a string that contains textual data and a string that contains
the base64 encoding of binary data. the current technique for avoiding
this ambiguity was to encode binary data as an array of unsigned 8 bit
numbers. many people do not like this technique.

the suggestion at the f2f was, if i remember it correctly, to simply
BASE64 encode the binary data and carry the encoding in a string.

this got me thinking...  section 2.1.9 does not include a generic
conversion from a string to a binary. maybe we should put this
conversion in the LLSD section instead of the JSON encoding section.
if someone is expecting an element to be a binary, it is likely to
attempt to access it as a binary anyway. by moving this conversion
into the LLSD section, it allows us to punt on tryign to id binaries
in the encoding and allows users of other serialization schemes to be
lazy about the conversion.

so i'm suggesting we make a change like this to section 2.1.9:

"2.1.9. Binary

   Data of type Binary contains a sequence of zero or more octets.  The
   default Binary is a sequence of zero octets.

   Conversions:

   String  The contents of the string are interpreted as a BASE64 encoding
      and converted following the rules in RFC XXXX with <insert alphabet here>
      and <insert statement about ignoring line breaks here>."

comments?

also, if we have a conversion from string to binary, must we have a
conversion the other way? it would be simple to define, just curious
if peeps think we MUST do it.

-cheers
-meadhbh
--
meadhbh hamrick * it's pronounced "maeve"
@OhMeadhbh * http://meadhbh.org/ * OhMeadhbh@gmail.com