/*
 * Copyright (c) 2015-2016 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.
 */

option version = "1.0.0";

typedef 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 - LISP locator records
*/
manual_endian manual_print define lisp_add_del_locator_set
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 locator_set_name[64];
  u32 locator_num;
  vl_api_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 lisp_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 lisp locator
    @param weight - weight of the lisp locator
*/
autoreply define lisp_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 lisp 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 lisp_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 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 lisp_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 lisp_add_del_map_resolver
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 is_ipv6;
  u8 ip_address[16];
};

/** \brief enable or disable LISP 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 lisp_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_en;
};

/** \brief configure or disable LISP 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 lisp_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 pitr
*/
autoreply define lisp_use_petr
{
  u32 client_index;
  u32 context;
  u8 is_ip4;
  u8 address[16];
  u8 is_add;
};

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

/** \brief LISP PETR status, enable or disable
    @param context - sender context, to match reply w/ request
    @param status - LISP 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_lisp_use_petr_reply
{
  u32 context;
  i32 retval;
  u8 status;
  u8 is_ip4;
  u8 address[16];
};

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

/** \brief Reply for show_lisp_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_lisp_rloc_probe_state_reply
{
  u32 context;
  i32 retval;
  u8 is_enabled;
};

/** \brief enable/disable LISP 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 lisp_rloc_probe_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_enabled;
};

/** \brief enable/disable LISP 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 lisp_map_register_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_enabled;
};

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

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

/** \brief set LISP 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/destination
*/
autoreply define lisp_map_request_mode
{
  u32 client_index;
  u32 context;
  u8 mode;
};

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

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

typedef 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
    @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 lisp_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_remote_locator_t rlocs[rloc_num];
};

/** \brief add or delete LISP 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 lisp_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 lisp_add_del_map_request_itr_rlocs
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 locator_set_name[64];
};

/** \brief Reply for lisp_add_del_map_request_itr_rlocs
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/

/** \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 lisp_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 lisp 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 lisp_locator_dump
{
  u32 client_index;
  u32 context;
  u32 ls_index;
  u8 ls_name[64];
  u8 is_index_set;
};

/** \brief LISP 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 lisp_locator_details
{
  u32 context;
  u8 local;
  u32 sw_if_index;
  u8 is_ipv6;
  u8 ip_address[16];
  u8 priority;
  u8 weight;
};

/** \brief LISP 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 lisp_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 lisp_locator_set_dump
{
  u32 client_index;
  u32 context;
  u8 filter;
};

/** \brief Dump lisp 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 lisp_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
    @param eid - endpoint identifier
    @param filter - filter type;
      Support values:
        0: all eid
        1: local eid
        2: remote eid
 */
define lisp_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 LISP 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
  */
typedef lisp_adjacency
{
  u8 eid_type;
  u8 reid[16];
  u8 leid[16];
  u8 reid_prefix_len;
  u8 leid_prefix_len;
};

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

/** \brief Request for LISP 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 lisp_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 - virtual network instance
  */
define lisp_eid_table_map_details
{
  u32 context;
  u32 vni;
  u32 dp_table;
};

/** \brief Request for lisp_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 lisp_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 lisp_eid_table_vni_dump
{
  u32 client_index;
  u32 context;
};

/** \brief reply to lisp_eid_table_vni_dump
    @param context - sender context, to match reply w/ request
    @param vni - virtual network instance
 */
define lisp_eid_table_vni_details
{
  u32 context;
  u32 vni;
};

/** \brief LISP map resolver status
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param ip_address - array of address bytes
 */
define lisp_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 lisp_map_resolver_dump
{
  u32 client_index;
  u32 context;
};

/** \brief LISP map server details
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param ip_address - array of address bytes
 */
define lisp_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 lisp_map_server_dump
{
  u32 client_index;
  u32 context;
};

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

/** \brief Status of lisp, enable or disable
    @param context - sender context, to match reply w/ request
    @param feature_status - lisp enable if non-zero, else disable
    @param gpe_status - lisp enable if non-zero, else disable
*/
define show_lisp_status_reply
{
  u32 context;
  i32 retval;
  u8 feature_status;
  u8 gpe_status;
};

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

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

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

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

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