<class
    name = "zre_msg"
    signature = "1"
    title = "work with ZRE messages"
    script = "zproto_codec_c"
    project_header = "../include/zyre.h"
    export_macro = "ZYRE_PRIVATE"
    >
    This is the ZRE protocol, version 2 draft, as defined by rfc.zeromq.org/spec:36/ZRE.

    <include filename = "../license.xml" />

    <grammar>
    zre             = greeting *traffic
    greeting        = hello
    traffic         = elect / leader / whisper / shout / join / leave / ping / ping-ok
    </grammar>

    <!-- Header for all messages -->
    <header>
        <field name = "version" type = "number" size = "1" value = "2">Version number (2)</field>
        <field name = "sequence" type = "number" size = "2">Cyclic sequence number</field>
    </header>

    <message name = "HELLO" id = "1">
        <!-- endpoint includes transport, etc. "tcp://127.0.0.1:2225" -->
        <field name = "endpoint" type = "string">Sender connect endpoint</field>
        <field name = "groups" type = "strings">List of groups sender is in</field>
        <field name = "status" type = "number" size = "1">Sender groups status value</field>
        <field name = "name" type = "string">Sender public name</field>
        <field name = "headers" type = "hash">Sender header properties</field>
    Greet a peer so it can connect back to us
    </message>

    <message name = "WHISPER" id = "2">
        <field name = "content" type = "msg">Wrapped message content</field>
    Send a multi-part message to a peer
    </message>

    <message name = "SHOUT" id = "3">
        <field name = "group" type = "string">Group to send to</field>
        <field name = "content" type = "msg">Wrapped message content</field>
    Send a multi-part message to a group
    </message>

    <message name = "JOIN" id = "4">
        <field name = "group" type = "string">Name of group</field>
        <field name = "status" type = "number" size = "1">Sender groups status value</field>
    Join a group
    </message>

    <message name = "LEAVE" id = "5">
        <field name = "group" type = "string">Name of group</field>
        <field name = "status" type = "number" size = "1">Sender groups status value</field>
    Leave a group
    </message>

    <message name = "PING" id = "6">
    Ping a peer that has gone silent
    </message>

    <message name = "PING-OK" id = "7">
    Reply to a peer's ping
    </message>

    <message name = "ELECT" id = "8">
        <field name = "group" type = "string">Name of group</field>
        <field name = "challenger id" type = "string">ID of the challenger</field>
    </message>

    <message name = "LEADER" id = "9">
        <field name = "group" type = "string">Name of group</field>
        <field name = "leader id" type = "string">ID of the elected leader</field>
    </message>
</class>
