/*
 * Copyright (c) 2015-2017 Cisco and/or its affiliates.
 * 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.
 */

typeonly manual_print manual_endian define one_local_locator
{
  u32 sw_if_index;
  u8 priority;
  u8 weight;
};

/** \brief add or delete locator_set
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param locator_set_name - locator name
    @param locator_num - number of locators
    @param locators - locator records
*/
manual_endian manual_print define one_add_del_locator_set
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 locator_set_name[64];
  u32 locator_num;
  vl_api_one_local_locator_t locators[locator_num];
};

/** \brief Reply for locator_set add/del
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param ls_index - locator set index
*/
define one_add_del_locator_set_reply
{
  u32 context;
  i32 retval;
  u32 ls_index;
};

/** \brief add or delete locator for locator set
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param locator_set_name - name of locator_set to add/del locator
    @param sw_if_index - index of the interface
    @param priority - priority of the locator
    @param weight - weight of the locator
*/
autoreply define one_add_del_locator
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 locator_set_name[64];
  u32 sw_if_index;
  u8 priority;
  u8 weight;
};

/** \brief add or delete ONE eid-table
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param eid_type:
      0 : ipv4
      1 : ipv6
      2 : mac
    @param eid - EID can be ip4, ip6 or mac
    @param prefix_len - prefix len
    @param locator_set_name - name of locator_set to add/del eid-table
    @param vni - virtual network instance
    @param key_id
      HMAC_NO_KEY           0
      HMAC_SHA_1_96         1
      HMAC_SHA_256_128      2
    @param key - secret key
*/
autoreply define one_add_del_local_eid
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 eid_type;
  u8 eid[16];
  u8 prefix_len;
  u8 locator_set_name[64];
  u32 vni;
  u16 key_id;
  u8 key[64];
};

/** \brief Set TTL for map register messages
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param ttl - time to live
*/
autoreply define one_map_register_set_ttl
{
  u32 client_index;
  u32 context;
  u32 ttl;
};

/** \brief Get TTL for map register messages
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_map_register_ttl
{
  u32 client_index;
  u32 context;
};

/** \brief Contains current TTL for map register messages
    @param client_index - opaque cookie to identify the sender
    @param retval - return code
    @param ttl - time to live
*/
define show_one_map_register_ttl_reply
{
  u32 context;
  i32 retval;
  u32 ttl;
};

/** \brief Add/delete map server
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero; delete otherwise
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param ip_address - map server IP address
*/
autoreply define one_add_del_map_server
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 is_ipv6;
  u8 ip_address[16];
};

/** \brief add or delete map-resolver
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param ip_address - array of address bytes
*/
autoreply define one_add_del_map_resolver
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 is_ipv6;
  u8 ip_address[16];
};

/** \brief enable or disable ONE feature
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_en - enable protocol if non-zero, else disable
*/
autoreply define one_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_en;
};

/** \brief configure or delete ONE NSH mapping
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param ls_name - locator set name
    @param is_add - add locator set if non-zero; delete otherwise
*/
autoreply define one_nsh_set_locator_set
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 ls_name[64];
};

/** \brief configure or disable ONE PITR node
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param ls_name - locator set name
    @param is_add - add locator set if non-zero, else disable pitr
*/
autoreply define one_pitr_set_locator_set
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 ls_name[64];
};

/** \brief configure or disable use of PETR
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_ip4 - Address is IPv4 if set and IPv6 otherwise
    @param address - PETR IP address
    @param is_add - add locator set if non-zero, else disable PETR
*/
autoreply define one_use_petr
{
  u32 client_index;
  u32 context;
  u8 is_ip4;
  u8 address[16];
  u8 is_add;
};

/** \brief Request for ONE PETR status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_use_petr
{
  u32 client_index;
  u32 context;
};

/** \brief ONE PETR status, enable or disable
    @param context - sender context, to match reply w/ request
    @param status - ONE PETR enable if non-zero, else disable
    @param is_ip4 - Address is IPv4 if non-zero, else IPv6
    @param address - PETR IP address
*/
define show_one_use_petr_reply
{
  u32 context;
  i32 retval;
  u8 status;
  u8 is_ip4;
  u8 address[16];
};

/** \brief Get state of ONE RLOC probing
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_rloc_probe_state
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for show_one_rloc_probe_state
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param is_enabled - state of RLOC probing
*/
define show_one_rloc_probe_state_reply
{
  u32 context;
  i32 retval;
  u8 is_enabled;
};

/** \brief enable/disable ONE RLOC probing
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_enable - enable if non-zero; disable otherwise
*/
autoreply define one_rloc_probe_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_enabled;
};

/** \brief enable/disable ONE map-register
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_enable - enable if non-zero; disable otherwise
*/
autoreply define one_map_register_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_enabled;
};

/** \brief Get state of ONE map-register
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_map_register_state
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for show_one_map_register_state
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define show_one_map_register_state_reply
{
  u32 context;
  i32 retval;
  u8 is_enabled;
};

/** \brief set ONE map-request mode. Based on configuration VPP will send
      src/dest or just normal destination map requests.
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param mode - new map-request mode. Supported values are:
      0 - destination only
      1 - source/destaination
*/
autoreply define one_map_request_mode
{
  u32 client_index;
  u32 context;
  u8 mode;
};

/** \brief Request for ONE map-request mode
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_map_request_mode
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for show_one_map_request_mode
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param mode - map-request mode
*/
define show_one_map_request_mode_reply
{
  u32 context;
  i32 retval;
  u8 mode;
};

typeonly manual_endian manual_print define one_remote_locator
{
  u8 is_ip4;
  u8 priority;
  u8 weight;
  u8 addr[16];
};

/** \brief add or delete remote static mapping
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param is_src_dst - flag indicating src/dst based routing policy
    @param del_all - if set, delete all remote mappings
    @param vni - virtual network instance
    @param action - negative map-reply action
    @param eid_type -
      0 : ipv4
      1 : ipv6
      2 : mac
      3 : NSH : both information (service path ID and service index) are
        encoded in 'eid' field in a following way:

        |4 B |1 B |
        -----------
        |SPI | SI |
    @param deid - dst EID
    @param seid - src EID, valid only if is_src_dst is enabled
    @param rloc_num - number of remote locators
    @param rlocs - remote locator records
*/
autoreply manual_print manual_endian define one_add_del_remote_mapping
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 is_src_dst;
  u8 del_all;
  u32 vni;
  u8 action;
  u8 eid_type;
  u8 eid[16];
  u8 eid_len;
  u8 seid[16];
  u8 seid_len;
  u32 rloc_num;
  vl_api_one_remote_locator_t rlocs[rloc_num];
};

/** \brief Add/delete L2 ARP entries
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add if non-zero; delete otherwise
    @param bd - bridge domain
    @param mac - MAC address
    @param ip4 - IPv4 address
*/
autoreply define one_add_del_l2_arp_entry
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 mac[6];
  u32 bd;
  u32 ip4;
};

/** \brief Request for L2 ARP entries from specified bridge domain
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param bd - bridge domain
*/
define one_l2_arp_entries_get
{
  u32 client_index;
  u32 context;
  u32 bd;
};

typeonly manual_print manual_endian define one_l2_arp_entry
{
  u8 mac[6];
  u32 ip4;
};

/** \brief Reply with L2 ARP entries from specified bridge domain
    @param context - sender context, to match reply w/ request
    @param retval - error code
    @param count - number of elements in the list
    @param vl_api_one_arp_entry_t - list of entries
*/
manual_print manual_endian define one_l2_arp_entries_get_reply
{
  u32 context;
  i32 retval;
  u32 count;
  vl_api_one_l2_arp_entry_t entries[count];
};

autoreply define one_add_del_ndp_entry
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 mac[6];
  u32 bd;
  u8 ip6[16];
};

define one_ndp_entries_get
{
  u32 client_index;
  u32 context;
  u32 bd;
};

typeonly manual_print manual_endian define one_ndp_entry
{
  u8 mac[6];
  u8 ip6[16];
};

manual_print manual_endian define one_ndp_entries_get_reply
{
  u32 context;
  i32 retval;
  u32 count;
  vl_api_one_ndp_entry_t entries[count];
};

/** \brief Set ONE transport protocol
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param protocol - supported vaules:
      1: UDP based LISP (default)
      2: binary API
*/
autoreply define one_set_transport_protocol
{
  u32 client_index;
  u32 context;
  u8 protocol;
};

define one_get_transport_protocol
{
  u32 client_index;
  u32 context;
};

define one_get_transport_protocol_reply
{
  u32 context;
  i32 retval;
  u8 protocol;
};

/** \brief Request for list of bridge domains used by neighbor discovery
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define one_ndp_bd_get
{
  u32 client_index;
  u32 context;
};

/** \brief Reply with list of bridge domains used by neighbor discovery
    @param context - sender context, to match reply w/ request
    @param count - number of elements in the list
    @param bridge_domains - list of BDs
*/
manual_print manual_endian define one_ndp_bd_get_reply
{
  u32 context;
  i32 retval;
  u32 count;
  u32 bridge_domains[count];
};

/** \brief Request for list of bridge domains used by L2 ARP table
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define one_l2_arp_bd_get
{
  u32 client_index;
  u32 context;
};

/** \brief Reply with list of bridge domains used by L2 ARP table
    @param context - sender context, to match reply w/ request
    @param count - number of elements in the list
    @param bridge_domains - list of BDs
*/
manual_print manual_endian define one_l2_arp_bd_get_reply
{
  u32 context;
  i32 retval;
  u32 count;
  u32 bridge_domains[count];
};

/** \brief add or delete ONE adjacency adjacency
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param vni - virtual network instance
    @param eid_type -
      0 : ipv4
      1 : ipv6
      2 : mac
    @param reid - remote EID
    @param leid - local EID
*/
autoreply define one_add_del_adjacency
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u32 vni;
  u8 eid_type;
  u8 reid[16];
  u8 leid[16];
  u8 reid_len;
  u8 leid_len;
};

/** \brief add or delete map request itr rlocs
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add address if non-zero, else delete
    @param locator_set_name - locator set name
*/
autoreply define one_add_del_map_request_itr_rlocs
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 locator_set_name[64];
};

/** \brief map/unmap vni/bd_index to vrf
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add or delete mapping
    @param dp_table - virtual network id/bridge domain index
    @param vrf - vrf
*/
autoreply define one_eid_table_add_del_map
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u32 vni;
  u32 dp_table;
  u8 is_l2;
};

/** \brief Request for map one locator status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param locator_set_index - index of locator_set
    @param ls_name - locator set name
    @param is_index_set - flag indicating whether ls_name or ls_index is set
 */
define one_locator_dump
{
  u32 client_index;
  u32 context;
  u32 ls_index;
  u8 ls_name[64];
  u8 is_index_set;
};

/** \brief ONE locator_set status
    @param local - if is set, then locator is local
    @param locator_set_name - name of the locator_set
    @param sw_if_index - sw_if_index of the locator
    @param priority - locator priority
    @param weight - locator weight
  */
define one_locator_details
{
  u32 context;
  u8 local;
  u32 sw_if_index;
  u8 is_ipv6;
  u8 ip_address[16];
  u8 priority;
  u8 weight;
};

/** \brief ONE locator_set status
    @param context - sender context, to match reply w/ request
    @param ls_index - locator set index
    @param ls_name - name of the locator set
 */
define one_locator_set_details
{
  u32 context;
  u32 ls_index;
  u8 ls_name[64];
};

/** \brief Request for locator_set summary status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param filter - filter type
      Supported values:
        0: all locator sets
        1: local locator sets
        2: remote locator sets
 */
define one_locator_set_dump
{
  u32 client_index;
  u32 context;
  u8 filter;
};

/** \brief Dump ONE eid-table
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param locator_set_index - index of locator_set, if ~0 then the mapping
                                is negative
    @param action - negative map request action
    @param is_local - local if non-zero, else remote
    @param eid_type:
      0 : ipv4
      1 : ipv6
      2 : mac
    @param is_src_dst - EID is type of source/destination
    @param eid - EID can be ip4, ip6 or mac
    @param eid_prefix_len - prefix length
    @param seid - source EID can be ip4, ip6 or mac
    @param seid_prefix_len - source prefix length
    @param vni - virtual network instance
    @param ttl - time to live
    @param authoritative - authoritative
    @param key_id
      HMAC_NO_KEY           0
      HMAC_SHA_1_96         1
      HMAC_SHA_256_128      2
    @param key - secret key
*/

define one_eid_table_details
{
  u32 context;
  u32 locator_set_index;
  u8 action;
  u8 is_local;
  u8 eid_type;
  u8 is_src_dst;
  u32 vni;
  u8 eid[16];
  u8 eid_prefix_len;
  u8 seid[16];
  u8 seid_prefix_len;
  u32 ttl;
  u8 authoritative;
  u16 key_id;
  u8 key[64];
};

/** \brief Request for eid table summary status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param eid_set - if non-zero request info about specific mapping
    @param vni - virtual network instance; valid only if eid_set != 0
    @param prefix_length - prefix length if EID is IP address;
      valid only if eid_set != 0
    @param eid_type - EID type; valid only if eid_set != 0
      Supported values:
        0: EID is IPv4
        1: EID is IPv6
        2: EID is ethernet address
        3 : NSH : both information (service path ID and service index) are
          encoded in 'eid' field in a following way:

          |4 B |1 B |
          -----------
          |SPI | SI |
    @param eid - endpoint identifier
    @param filter - filter type;
      Support values:
        0: all eid
        1: local eid
        2: remote eid
 */
define one_eid_table_dump
{
  u32 client_index;
  u32 context;
  u8 eid_set;
  u8 prefix_length;
  u32 vni;
  u8 eid_type;
  u8 eid[16];
  u8 filter;
};

/** \brief ONE adjacency
    @param eid_type -
      0 : ipv4
      1 : ipv6
      2 : mac
    @param reid - remote EID
    @param leid - local EID
    @param reid_prefix_len - remote EID IP prefix length
    @param leid_prefix_len - local EID IP prefix length
  */
typeonly manual_print manual_endian define one_adjacency
{
  u8 eid_type;
  u8 reid[16];
  u8 leid[16];
  u8 reid_prefix_len;
  u8 leid_prefix_len;
};

/** \brief ONE adjacency reply
    @param count - number of adjacencies
    @param adjacencies - array of adjacencies
  */
manual_endian manual_print define one_adjacencies_get_reply
{
  u32 context;
  i32 retval;
  u32 count;
  vl_api_one_adjacency_t adjacencies[count];
};

/** \brief Request for ONE adjacencies
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param vni - filter adjacencies by VNI
 */
define one_adjacencies_get
{
  u32 client_index;
  u32 context;
  u32 vni;
};

/** \brief Shows relationship between vni and vrf/bd
    @param dp_table - VRF index or bridge domain index
    @param vni - vitual network instance
  */
define one_eid_table_map_details
{
  u32 context;
  u32 vni;
  u32 dp_table;
};

/** \brief Request for one_eid_table_map_details
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_l2 - if set dump vni/bd mappings else vni/vrf
 */
define one_eid_table_map_dump
{
  u32 client_index;
  u32 context;
  u8 is_l2;
};

/** \brief Dumps all VNIs used in mappings
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
  */
define one_eid_table_vni_dump
{
  u32 client_index;
  u32 context;
};

/** \brief reply to one_eid_table_vni_dump
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param vni - virtual network instance
 */
define one_eid_table_vni_details
{
  u32 client_index;
  u32 context;
  u32 vni;
};

/** \brief ONE map resolver status
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param ip_address - array of address bytes
 */
define one_map_resolver_details
{
  u32 context;
  u8 is_ipv6;
  u8 ip_address[16];
};

/** \brief Request for map resolver summary status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
 */
define one_map_resolver_dump
{
  u32 client_index;
  u32 context;
};

/** \brief ONE map server details
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param ip_address - array of address bytes
 */
define one_map_server_details
{
  u32 context;
  u8 is_ipv6;
  u8 ip_address[16];
};

/** \brief Request for map server summary status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
 */
define one_map_server_dump
{
  u32 client_index;
  u32 context;
};

/** \brief Request for ONE status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_status
{
  u32 client_index;
  u32 context;
};

/** \brief ONE status
    @param context - sender context, to match reply w/ request
    @param feature_status - enabled if non-zero, else disabled
    @param gpe_status - enabled if non-zero, else disabled
*/
define show_one_status_reply
{
  u32 context;
  i32 retval;
  u8 feature_status;
  u8 gpe_status;
};

/** \brief Get ONE map request itr rlocs status
    @param context - sender context, to match reply w/ request
    @param locator_set_name - name of the locator_set
 */
define one_get_map_request_itr_rlocs
{
  u32 client_index;
  u32 context;
};

/** \brief Request for map request itr rlocs summary status
 */
define one_get_map_request_itr_rlocs_reply
{
  u32 context;
  i32 retval;
  u8 locator_set_name[64];
};

/** \brief Request for ONE NSH mapping
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_nsh_mapping
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for ONE NSH mapping
    @param context - sender context, to match reply w/ request
    @param is_set - is ONE NSH mapping set
    @param locator_set_name - name of the locator_set if NSH mapping is set
*/
define show_one_nsh_mapping_reply
{
  u32 context;
  i32 retval;
  u8 is_set;
  u8 locator_set_name[64];
};

/** \brief Request for ONE PITR status
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define show_one_pitr
{
  u32 client_index;
  u32 context;
};

/** \brief Status of ONE PITR, enable or disable
    @param context - sender context, to match reply w/ request
    @param status - ONE PITR enable if non-zero, else disable
    @param locator_set_name -  name of the locator_set
*/
define show_one_pitr_reply
{
  u32 context;
  i32 retval;
  u8 status;
  u8 locator_set_name[64];
};

define one_stats_dump
{
  u32 client_index;
  u32 context;
};

define one_stats_details
{
  u32 context;
  u32 vni;
  u8 eid_type;
  u8 deid[16];
  u8 seid[16];
  u8 deid_pref_len;
  u8 seid_pref_len;
  u8 is_ip4;
  u8 rloc[16];
  u8 lloc[16];

  u32 pkt_count;
  u32 bytes;
};

autoreply define one_stats_flush
{
  u32 client_index;
  u32 context;
};

autoreply define one_stats_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_en;
};

define show_one_stats_enable_disable
{
  u32 client_index;
  u32 context;
};

define show_one_stats_enable_disable_reply
{
  u32 context;
  i32 retval;
  u8 is_en;
};

autoreply define one_map_register_fallback_threshold
{
  u32 client_index;
  u32 context;
  u32 value;
};

define show_one_map_register_fallback_threshold
{
  u32 client_index;
  u32 context;
};

define show_one_map_register_fallback_threshold_reply
{
  u32 context;
  i32 retval;
  u32 value;
};

autoreply define one_enable_disable_xtr_mode
{
  u32 client_index;
  u32 context;
  u8 is_en;
};

define one_show_xtr_mode
{
  u32 client_index;
  u32 context;
};

define one_show_xtr_mode_reply
{
  u32 context;
  i32 retval;
  u8 is_en;
};

autoreply define one_enable_disable_petr_mode
{
  u32 client_index;
  u32 context;
  u8 is_en;
};

define one_show_petr_mode
{
  u32 client_index;
  u32 context;
};

define one_show_petr_mode_reply
{
  u32 context;
  i32 retval;
  u8 is_en;
};

autoreply define one_enable_disable_pitr_mode
{
  u32 client_index;
  u32 context;
  u8 is_en;
};

define one_show_pitr_mode
{
  u32 client_index;
  u32 context;
};

define one_show_pitr_mode_reply
{
  u32 context;
  i32 retval;
  u8 is_en;
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
