<?xml version="1.0"?>
<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
- 
-   http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
-->

<amqp major="0" minor="10" port="5672">

  <!-- Controls sent between cluster nodes. -->

  <class name = "cluster" code = "0x80" label="Qpid clustering extensions.">
    <doc>Qpid extension class to allow clustered brokers to communicate.</doc>

    <control name="dump-request" code="0x1" label="URL for a member.">
      <field name="url" type="str16"/>
    </control>

    <control name = "dump-offer" code="0x2" label="Member offering to be dumper for dumpee.">
      <field name="dumpee" type="uint64"/>
      <field name="cluster-id" type="uuid"/>
    </control>

Min     <control name="ready" code="0x10" label="New member is ready.">
      <field name="url" type="str16"/>
    </control>

    <control name="config-change" code="0x11" label="Raw cluster membership.">
      <field name="current" type="vbin16"/> <!-- packed member-id array -->
    </control>
    
    <control name="shutdown" code="0x20" label="Shut down entire cluster"/>
  </class>

  <!-- TODO aconway 2008-09-10: support for un-attached connections. -->
  
  <!-- Controls associated with a specific connection. -->

  <class name="cluster-connection" code="0x81" label="Qpid clustering extensions.">

    <control name="deliver-close" code="0x2">
    </control>

    <control name="deliver-do-output" code="0x3">
      <field name="bytes" type="uint32"/>
    </control>

    <!-- Brain-dump controls. Sent to a new broker in joining mode.
	 A connection is dumped as followed:
	 - open as a normal connection.
	 - attach sessions, create consumers, set flow with normal AMQP cokmmands.
	 - send /reset additional session state with controls below.
	 - send shadow-ready to mark end of shadow dump.
	 - send dump-complete when entire dump is complete.
    -->
    
    <!-- Consumer state that cannot be set by standard AMQP controls. -->
    <control name="consumer-state" code="0x10">
      <field name="name" type="str8"/>
      <field name="blocked" type="bit"/>
      <field name="notifyEnabled" type="bit"/>
    </control>

    <!-- Delivery-record for outgoing messages sent but not yet accepted. -->
    <control name="delivery-record" code ="0x11">
      <field name="queue" type="str8"/>
      <field name="position" type="sequence-no"/>
      <field name="tag" type="str8"/>
      <field name="id" type="sequence-no"/>
      <field name="acquired" type="bit"/>		       <!--If not set, message follows. -->
      <field name="accepted" type="bit"/>
      <field name="cancelled" type="bit"/>
      <field name="completed" type="bit"/>
      <field name="ended" type="bit"/>
      <field name="windowing" type="bit"/>
      <field name="credit" type="uint32"/>
    </control>
    
    <!-- Tx transaction state. -->
    <control name="tx-start" code="0x12"/> 
    <control name="tx-accept" code="0x13"> <field name="commands" type="sequence-set"/> </control>
    <control name="tx-dequeue" code="0x14"> <field name="queue" type="str8"/> </control>
    <control name="tx-enqueue" code="0x15"> <field name="queue" type="str8"/> </control>
    <control name="tx-publish" code="0x16">
      <field name="queues" type="array"/>  <!--Array of str8 -->
      <field name="delivered" type="bit"/>
    </control>
    <control name="tx-end" code="0x17"/>
    <control name="accumulated-ack" code="0x18"> <field name="commands" type="sequence-set"/> </control>
    
    <!-- Complete a session state dump. -->
    <control name="session-state" code="0x1F" label="Set session state during a brain dump.">
      <!-- Target session deduced from channel number.  -->
      <field name="replay-start" type="sequence-no"/>	       <!-- Replay frames will start from this point.-->
      <field name="command-point" type="sequence-no"/>	       <!-- Id of next command sent -->
      <field name="sent-incomplete" type="sequence-set"/>      <!-- Commands sent and incomplete. -->

      <field name="expected" type="sequence-no"/>	       <!-- Next command expected. -->
      <field name="received" type="sequence-no"/>	       <!-- Received up to here (>= expected) -->
      <field name="unknown-completed" type="sequence-set"/>    <!-- Completed but not known to peer. -->
      <field name="received-incomplete" type="sequence-set"/>  <!-- Received and incomplete -->
    </control>

    <!-- Complete a shadow connection dump. -->
    <control name="shadow-ready" code="0x20" label="End of shadow connection dump.">
      <field name="member-id" type="uint64"/>
      <field name="connection-id" type="uint64"/>
    </control>

    <!-- Complete a cluster state dump. -->
    <control name="membership" code="0x21" label="Cluster membership details.">
      <field name="newbies" type="map"/> <!-- member-id -> URL -->
      <field name="members" type="map"/> <!-- member-id -> state -->
    </control>

    <!-- Set the position of a replicated queue. -->
    <control name="queue-position" code="0x30">
      <field name="queue" type="str8"/>
      <field name="position" type="sequence-no"/>
    </control>
    
    <!-- Replicate encoded exchanges/queues. -->
    <control name="exchange" code="0x31"><field name="encoded" type="str32"/></control>
    <control name="queue" code="0x32"><field name="encoded" type="str32"/></control>
    

  </class>
</amqp>
