From 8f90ae8dfdf5efbb6c8429897dc95cad621af00b Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 10 Mar 2010 12:40:13 +0100 Subject: wire formats in docs clarified --- doc/zmq_tcp.txt | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'doc/zmq_tcp.txt') diff --git a/doc/zmq_tcp.txt b/doc/zmq_tcp.txt index c6eba21..3f21352 100644 --- a/doc/zmq_tcp.txt +++ b/doc/zmq_tcp.txt @@ -54,32 +54,35 @@ A 'peer address' may be specified by either of the following: WIRE FORMAT ----------- 0MQ messages are transmitted over TCP in frames consisting of the message -length followed by the message data. The size of the message data MUST -correspond to the message length. A single 'frame' can be defined by the +length followed by flags byte and the message data. The length MUST correspond +to the length of the remaining part of the frame. + +. A single 'frame' can be defined by the following ABNF grammar: .... - frame = (message-length message-data) - message-length = OCTET / (escape 8OCTET) + frame = (length flags data) + length = OCTET / (escape 8OCTET) + flags = OCTET escape = %xFF - message-data = *OCTET + data = *OCTET .... -For messages of 0 to 254 octets in length, the message length is represented by +For messages of 0 to 253 octets in length, the message length is represented by a single octet: .... 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Message size | Message body ... | +| Message size | Flags | Message body ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message body ... +-+-+-+-+-+-+- ... .... -For messages of 255 or more octets in length, the message length is represented +For messages of 254 or more octets in length, the message length is represented by a single octet with the value `255` followed by the message length represented as a 64-bit unsigned integer in network byte order: @@ -91,12 +94,13 @@ represented as a 64-bit unsigned integer in network byte order: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message size ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Message size | Message body ... | +| Message size | Flags | Message body ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message body ... +-+-+-+-+-+-+-+ ... .... +The flags field is reserved and MUST be set to 0. EXAMPLES -------- -- cgit v1.2.3