~sircmpwn/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH draft-devault-bare] Add note about stream protocol

Details
Message ID
<20230613094009.2663398-1-jiri.hubacek@gmail.com>
DKIM signature
missing
Download raw message
Patch: +17 -0
---
Hello,

I was thinking if it would be beneficial to add a note about sending
BARE messages over a stream protocol to the "Application Considerations"
section of the BARE draft.

Thank you for your opinion.

 draft-devault-bare-08.xml | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/draft-devault-bare-08.xml b/draft-devault-bare-08.xml
index 0551d5e..87cb3ce 100644
--- a/draft-devault-bare-08.xml
+++ b/draft-devault-bare-08.xml
@@ -635,6 +635,23 @@ type Message union {MessageV1 | MessageV2 | MessageV3}
      <artwork><![CDATA[
type Message union {MessageV2 = 1 | MessageV3}
]]></artwork>
      <t>
        Message authors who wish to deliver the message using a stream protocol
        should add a length as the first field of the message to explicitly
        indicate the boundaries of the message.
      </t>
      <t>The following schema provides an example:</t>
      <artwork><![CDATA[
type MessageWithLength struct {
  len: u32
  msg: Message
}
]]></artwork>
      <t>
        Thus, the reception of the message over a stream protocol consists of
        two phases. First, the reception and decoding of the length. Second,
        the reception and decoding of the message.
      </t>
    </section>

    <section>
-- 
2.34.1
Details
Message ID
<6bba8dfb-58d7-0eea-2537-044d32c08bb3@elvinger.fr>
In-Reply-To
<20230613094009.2663398-1-jiri.hubacek@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Hi Jiri!

I am wondering if this could be simply done by treating the message as 
an opaque sequence of bytes of another message:


```bare
type EmbeddedMessage = ...
```

```bare
type MainMessage = data
```

```code
let bytes = encodeEmbeddedMessage(x)
let msg = encodeMainMessage(bytes)
```

have a nice day!
Details
Message ID
<ZJno7CVoQxyhcWpS@gmail.com>
In-Reply-To
<6bba8dfb-58d7-0eea-2537-044d32c08bb3@elvinger.fr> (view parent)
DKIM signature
missing
Download raw message
Hi Victorien,

> I am wondering if this could be simply done by treating the message as
> an opaque sequence of bytes of another message:

I am afraid that not. To my understanding, when using streamed protocol
like TCP, you don't know where is the end of the message. So you need to
send the message length first.

BARE message with data primitive type (of arbitrary length) requires the
length of the data to be encoded before the data itself as uint.
However, the uint data type has no fixed length, so the length of the
uint is not known in advance, resulting in the same problem as the
original one.

Please, correct me if I am wrong.

Thank you!
Reply to thread Export thread (mbox)