/* 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
*/
typedef srv6_sid
{
  u8 addr[16];
};

typedef 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];
};

typedef 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 Set SRv6 encapsulation hop-limit
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param hop_limit is the hop-limit value to set
*/
autoreply define sr_set_encap_hop_limit
{
  u32 client_index;
  u32 context;
  u8 hop_limit;
};

/** \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:
 */
