/*
 * 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.1.0";
import "vnet/fib/fib_types.api";

/** \brief Bind/Unbind an MPLS local label to an IP prefix. i.e. create
           a per-prefix label entry.
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param mb_mpls_table_id - The MPLS table-id the MPLS entry will be added in
    @param mb_label - The MPLS label value to bind
    @param mb_ip_table_id - The IP table-id of the IP prefix to bind to.
    @param mb_is_bind - Bind or unbind
    @param mb_is_ip4 - The prefix to bind to is IPv4
    @param mb_address_length - Length of IP prefix
    @param mb_address[16] - IP prefix/
*/
autoreply define mpls_ip_bind_unbind
{
  u32 client_index;
  u32 context;
  u32 mb_mpls_table_id;
  u32 mb_label;
  u32 mb_ip_table_id;
  u8 mb_is_bind;
  u8 mb_is_ip4;
  u8 mb_address_length;
  u8 mb_address[16];
};

define mpls_tunnel_add_del
{
  u32 client_index;
  u32 context;
  u32 mt_sw_if_index;
  u8 mt_is_add;
  u8 mt_l2_only;
  u8 mt_is_multicast;
  u8 mt_next_hop_proto_is_ip4;
  u8 mt_next_hop_weight;
  u8 mt_next_hop_preference;
  u8 mt_next_hop[16];
  u8 mt_next_hop_n_out_labels;
  u32 mt_next_hop_via_label;
  u32 mt_next_hop_sw_if_index;
  u32 mt_next_hop_table_id;
  vl_api_fib_mpls_label_t mt_next_hop_out_label_stack[mt_next_hop_n_out_labels];
};

/** \brief Reply for MPLS tunnel add / del request
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param sw_if_index - SW interface index of the tunnel created
*/
define mpls_tunnel_add_del_reply
{
  u32 context;
  i32 retval;
  u32 sw_if_index;
};

/** \brief Dump mpls eth tunnel table
    @param client_index - opaque cookie to identify the sender
    @param tunnel_index - eth tunnel identifier or -1 in case of all tunnels
*/
define mpls_tunnel_dump
{
  u32 client_index;
  u32 context;
  i32 tunnel_index;
};

/** \brief mpls tunnel details
*/
manual_endian manual_print define mpls_tunnel_details
{
  u32 context;
  u8 mt_sw_if_index;
  u8 mt_tunnel_index;
  u8 mt_l2_only;
  u8 mt_is_multicast;
  u32 mt_count;
  vl_api_fib_path_t mt_paths[mt_count];
};

/** \brief MPLS Route Add / del route
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param mt_table_id - The MPLS table-id the route is added in
    @param mt_is_add - Is this a route add or delete
    @param mt_name - A client provided name/tag for the table. If this
                     is not set by the client, then VPP will generate
		     something meaningfull.
*/
autoreply define mpls_table_add_del
{
  u32 client_index;
  u32 context;
  u32 mt_table_id;
  u8  mt_is_add;
  u8  mt_name[64];
};

/** \brief MPLS Route Add / del route
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param mr_label - The MPLS label value
    @param mr_eos - The End of stack bit
    @param mr_table_id - The MPLS table-id the route is added in
    @param mr_classify_table_index - If this is a classify route, 
                                     this is the classify table index
                                        create them
    @param mr_is_add - Is this a route add or delete
    @param mr_is_classify - Is this route result a classify
    @param mr_is_multicast - Is this a multicast route
    @param mr_is_multipath - Is this route update a multipath - i.e. is this
                             a path addition to an existing route
    @param mr_is_resolve_host - Recurse resolution constraint via a host prefix
    @param mr_is_resolve_attached - Recurse resolution constraint via attached prefix
    @param mr_is_interface_rx - Interface Receive path
    @param mr_is_interface_rx - RPF-ID Receive path. The next-hop interface
                                is used as the RPF-ID
    @param mr_next_hop_proto - The next-hop protocol, of type dpo_proto_t
    @param mr_next_hop_weight - The weight, for UCMP
    @param mr_next_hop[16] - the nextop address
    @param mr_next_hop_sw_if_index - the next-hop SW interface
    @param mr_next_hop_table_id - the next-hop table-id (if appropriate)
    @param mr_next_hop_n_out_labels - the number of labels in the label stack
    @param mr_next_hop_out_label_stack - the next-hop output label stack, outer most first
    @param next_hop_via_label - The next-hop is a resolved via a local label
*/
autoreply define mpls_route_add_del
{
  u32 client_index;
  u32 context;
  u32 mr_label;
  u8 mr_eos;
  u32 mr_table_id;
  u32 mr_classify_table_index;
  u8 mr_is_add;
  u8 mr_is_classify;
  u8 mr_is_multicast;
  u8 mr_is_multipath;
  u8 mr_is_resolve_host;
  u8 mr_is_resolve_attached;
  u8 mr_is_interface_rx;
  u8 mr_is_rpf_id;
  u8 mr_next_hop_proto;
  u8 mr_next_hop_weight;
  u8 mr_next_hop_preference;
  u8 mr_next_hop[16];
  u8 mr_next_hop_n_out_labels;
  u32 mr_next_hop_sw_if_index;
  u32 mr_next_hop_table_id;
  u32 mr_next_hop_via_label;
  vl_api_fib_mpls_label_t mr_next_hop_out_label_stack[mr_next_hop_n_out_labels];
};

/** \brief Dump MPLS fib table
    @param client_index - opaque cookie to identify the sender
*/
define mpls_fib_dump
{
  u32 client_index;
  u32 context;
};

/** \brief mpls FIB table response
    @param table_id - MPLS fib table id
    @param s_bit - End-of-stack bit
    @param label - MPLS label value
    @param count - the number of fib_path in path
    @param path  - array of of fib_path structures
*/
manual_endian manual_print define mpls_fib_details
{
  u32 context;
  u32 table_id;
  u8  table_name[64];
  u8  eos_bit;
  u32 label;
  u32 count;
  vl_api_fib_path_t path[count];
};

/** \brief Enable or Disable MPLS on and interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - index of the interface
    @param enable - if non-zero enable, else disable
*/
autoreply define sw_interface_set_mpls_enable
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 enable;
};

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