/*
 * Copyright 2014-2017 Real Logic Ltd.
 *
 * Licensed 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.
 */
package io.aeron.command;

/**
 * List of event types used in the control protocol between the
 * media driver and the core.
 */
public class ControlProtocolEvents
{
    // Clients to Media Driver

    /** Add Publication */
    public static final int ADD_PUBLICATION = 0x01;
    /** Remove Publication */
    public static final int REMOVE_PUBLICATION = 0x02;
    /** Add Subscriber */
    public static final int ADD_SUBSCRIPTION = 0x04;
    /** Remove Subscriber */
    public static final int REMOVE_SUBSCRIPTION = 0x05;
    /** Keepalive from Client */
    public static final int CLIENT_KEEPALIVE = 0x06;
    /** Add Destination */
    public static final int ADD_DESTINATION = 0x07;
    /** Remove Destination */
    public static final int REMOVE_DESTINATION = 0x08;

    // Media Driver to Clients

    /** Error Response */
    public static final int ON_ERROR = 0x0F01;
    /** New subscription Buffer Notification */
    public static final int ON_AVAILABLE_IMAGE = 0x0F02;
    /** New publication Buffer Notification */
    public static final int ON_PUBLICATION_READY = 0x0F03;
    /** Operation Succeeded */
    public static final int ON_OPERATION_SUCCESS = 0x0F04;
    /** Inform client of timeout and removal of inactive image */
    public static final int ON_UNAVAILABLE_IMAGE = 0x0F05;
}

@@ -644,13 +644,8 @@
 vent
- type
 s us
@@ -683,40 +683,35 @@
 een 
-the%0A * media driver and the core
+client and the media driver
 .%0A *
@@ -788,21 +788,30 @@
 %0A    /**
+%0A     *
  Add 
+a 
 Publicat
@@ -805,32 +805,38 @@
 dd a Publication
+.%0A    
  */%0A    public s
@@ -875,31 +875,39 @@
 = 0x01;%0A
+%0A
     /**
+%0A     *
  Remove 
 Publicat
@@ -898,16 +898,18 @@
  Remove 
+a 
 Publicat
@@ -907,24 +907,30 @@
  Publication
+.%0A    
  */%0A    publ
@@ -976,27 +976,153 @@
 = 0x02;%0A
+%0A
     /**
- Add
+%0A     * Add an Exclusive Publication.%0A     */%0A    public static final int ADD_EXCLUSIVE_PUBLICATION = 0x03;%0A%0A    /**%0A     * Add a
  Subscri
@@ -1116,32 +1116,38 @@
 Add a Subscriber
+.%0A    
  */%0A    public s
@@ -1187,31 +1187,39 @@
 = 0x04;%0A
+%0A
     /**
+%0A     *
  Remove 
 Subscrib
@@ -1210,16 +1210,18 @@
  Remove 
+a 
 Subscrib
@@ -1222,16 +1222,22 @@
 bscriber
+.%0A    
  */%0A    
@@ -1288,23 +1288,31 @@
 = 0x05;%0A
+%0A
     /**
+%0A     *
  Keepali
@@ -1325,16 +1325,22 @@
 m Client
+.%0A    
  */%0A    
@@ -1388,23 +1388,31 @@
 = 0x06;%0A
+%0A
     /**
+%0A     *
  Add Des
@@ -1412,32 +1412,65 @@
 Add Destination 
+to an existing Publication.%0A     
 */%0A    public st
@@ -1508,23 +1508,31 @@
 = 0x07;%0A
+%0A
     /**
+%0A     *
  Remove 
@@ -1539,24 +1539,59 @@
 Destination 
+from an existing Publication.%0A     
 */%0A    publi
@@ -1637,16 +1637,17 @@
  0x08;%0A%0A
+%0A
     // M
@@ -1677,16 +1677,23 @@
 %0A    /**
+%0A     *
  Error R
@@ -1700,16 +1700,86 @@
 esponse 
+as a result of attempting to process a client command operation.%0A     
 */%0A    p
@@ -1824,41 +1824,64 @@
 01;%0A
+%0A
     /**
- New subscription Buffer N
+%0A     * Subscribed Image buffers are available n
 otif
@@ -1879,32 +1879,38 @@
 ble notification
+.%0A    
  */%0A    public s
@@ -1958,21 +1958,29 @@
 02;%0A
+%0A
     /**
+%0A     *
  New 
-p
+P
 ubli
@@ -1990,16 +1990,27 @@
 ion 
-B
+b
 uffer
- N
+s are ready n
 otif
@@ -2016,16 +2016,22 @@
 fication
+.%0A    
  */%0A    
@@ -2085,23 +2085,31 @@
 0x0F03;%0A
+%0A
     /**
+%0A     *
  Operati
@@ -2115,17 +2115,21 @@
 ion 
-S
+has s
 ucceeded
  */%0A
@@ -2124,16 +2124,22 @@
 ucceeded
+.%0A    
  */%0A    
@@ -2193,23 +2193,31 @@
 0x0F04;%0A
+%0A
     /**
+%0A     *
  Inform 
@@ -2249,16 +2249,19 @@
 oval of 
+an 
 inactive
@@ -2265,13 +2265,19 @@
 ive 
-i
+I
 mage
+.%0A    
  */%0A

Update control protocol for the inclusion of ADD_EXCLUSIVE_PUBLICATION.