[rabbitmq-discuss] Two questions about AMQP protocol's marshalling/unmarshalling

Gordon Sim gsim at redhat.com
Mon Oct 1 17:35:46 BST 2012

On 10/01/2012 03:10 PM, raocheng wrote:
> While I am reading amqp0-9-1.pdf, I get two questions about  AMQP
> protocol's marshalling/unmarshalling:
> Strings:
> Short strings, stored as an 8-bit unsigned integer length followed by
> zero or more octets of data. Short strings can carry up to 255 octets of
> UTF-8 data, but may not contain binary zero octets.
> =======
> Question: What does "binary zero octets" mean ?

It means the octet with value 0x00.

> Why can they not be
> contained in shortstr ?

I think it is so the values can be treated as C-strings (where the 0x00 
or null character is the string terminator).

> =======
> field Tables
> ... The name-value pairs are encoded as short string defining the name,
> and octet defining the values type and then the value itself.
> =======
> Question: By the definition, there should be an octet used for defining
> the values type. So where can we know the detailed definition for each
> value type (e.g, 1 --> octet, 2 -> short, 3-> long, 4 -> longlong, 5 ->
> shortstr, 6-> longstr, 7->table, ...) ? I can not find the corresponding
> definition in AMQP's documents(amqp0-9-1.xml, amqp0-9-1.pdf)

I agree it is not terribly obvious given the flow of the text, but look 
at the protocol grammar in 4.2.1 section. The type codes are given 
against the definition of 'field-value'.

More information about the rabbitmq-discuss mailing list