/* Hey Emacs use -*- mode: C -*- */
/*
 * 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.2.0";

/** \brief SRv6 SID
*/
typeonly define srv6_sid
{
  u8 addr[16];
};

typeonly define srv6_sid_list
{
  u8 num_sids;
  u32 weight;
  vl_api_srv6_sid_t sids[16];
};

/** \brief IPv6 SR LocalSID add/del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_del Boolean of whether its a delete instruction
    @param localsid_addr IPv6 address of the localsid
    @param end_psp Boolean of whether decapsulation is allowed in this function
    @param behavior Type of behavior (function) for this localsid
    @param sw_if_index Only for L2/L3 xconnect. OIF. In VRF variant the
     fib_table.
    @param vlan_index Only for L2 xconnect. Outgoing VLAN tag.
    @param fib_table  FIB table in which we should install the localsid entry
    @param nh_addr6 Next Hop IPv6 address. Only for L2/L3 xconnect.
    @param nh_addr4 Next Hop IPv4 address. Only for L2/L3 xconnect.
*/
autoreply define sr_localsid_add_del
{
  u32 client_index;
  u32 context;
  u8 is_del;
  vl_api_srv6_sid_t localsid;
  u8 end_psp;
  u8 behavior;
  u32 sw_if_index;
  u32 vlan_index;
  u32 fib_table;
  u8 nh_addr6[16];
  u8 nh_addr4[4];
};

typeonly define sr_ip6_address
{
  u8 data[16];
};

/** \brief IPv6 SR policy add
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param bsid is the bindingSID of the SR Policy
    @param weight is the weight of the sid list. optional.
    @param is_encap is the behavior of the SR policy. (0.SRH insert // 1.Encapsulation)
    @param type is the type of the SR policy. (0.Default // 1.Spray)
    @param fib_table is the VRF where to install the FIB entry for the BSID
    @param sids is a srv6_sid_list object
*/
autoreply define sr_policy_add
{
  u32 client_index;
  u32 context;
  u8 bsid_addr[16];
  u32 weight;
  u8 is_encap;
  u8 type;
  u32 fib_table;
  vl_api_srv6_sid_list_t sids;
};

/** \brief IPv6 SR policy modification
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param bsid is the bindingSID of the SR Policy
    @param sr_policy_index is the index of the SR policy
    @param fib_table is the VRF where to install the FIB entry for the BSID
    @param operation is the operation to perform (among the top ones)
    @param sl_index is the index of the Segment List to modify/delete
    @param weight is the weight of the sid list. optional.
    @param sids is a srv6_sid_list object
*/
autoreply define sr_policy_mod
{
  u32 client_index;
  u32 context;
  u8 bsid_addr[16];
  u32 sr_policy_index;
  u32 fib_table;
  u8 operation;
  u32 sl_index;
  u32 weight;
  vl_api_srv6_sid_list_t sids;
};

/** \brief IPv6 SR policy deletion
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param bsid is the bindingSID of the SR Policy
    @param index is the index of the SR policy
*/
autoreply define sr_policy_del
{
  u32 client_index;
  u32 context;
  vl_api_srv6_sid_t bsid_addr;
  u32 sr_policy_index;
};

/** \brief IPv6 SR Set SRv6 encapsulation source
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param bsid is the bindingSID of the SR Policy
    @param index is the index of the SR policy
*/
autoreply define sr_set_encap_source
{
  u32 client_index;
  u32 context;
  u8 encaps_source[16];
};

/** \brief IPv6 SR steering add/del
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_del
    @param bsid is the bindingSID of the SR Policy (alt to sr_policy_index)
    @param sr_policy is the index of the SR Policy (alt to bsid)
    @param table_id is the VRF where to install the FIB entry for the BSID
    @param prefix is the IPv4/v6 address for L3 traffic type
    @param mask_width is the mask for L3 traffic type
    @param sw_if_index is the incoming interface for L2 traffic
    @param traffic_type describes the type of traffic
*/
autoreply define sr_steering_add_del
{
  u32 client_index;
  u32 context;
  u8 is_del;
  u8 bsid_addr[16];
  u32 sr_policy_index;
  u32 table_id;
  u8 prefix_addr[16];
  u32 mask_width;
  u32 sw_if_index;
  u8 traffic_type;
};

/** \brief Dump the list of SR LocalSIDs
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define sr_localsids_dump
{
  u32 client_index;
  u32 context;
};

define sr_localsids_details
{
  u32 context;
  vl_api_srv6_sid_t addr;
  u8 end_psp;
  u16 behavior;
  u32 fib_table;
  u32 vlan_index;
  u8 xconnect_nh_addr6[16];
  u8 xconnect_nh_addr4[4];
  u32 xconnect_iface_or_vrf_table;
};

/** \brief Dump the list of SR policies
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define sr_policies_dump
{
  u32 client_index;
  u32 context;
};

define sr_policies_details
{
  u32 context;
  vl_api_srv6_sid_t bsid;
  u8 type;
  u8 is_encap;
  u32 fib_table;
  u8 num_sid_lists;
  vl_api_srv6_sid_list_t sid_lists[num_sid_lists];
};

/** \brief Dump the steering policies
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define sr_steering_pol_dump
{
  u32 client_index;
  u32 context;
};

define sr_steering_pol_details
{
  u32 context;
  u8 traffic_type;
  u32 fib_table;
  u8 prefix_addr[16];
  u32 mask_width;
  u32 sw_if_index;
  vl_api_srv6_sid_t bsid;
};

/*
 * fd.io coding-style-patch-verification: OFF
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
