/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 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.
 */

vl_api_version 1.0.0

 /** \brief Enable/Disable span to mirror traffic from one interface to another
    @param client_index - opaque cookie to identify the sender
    @param context - sender context which was passed in the request
    @param sw_if_index_from - interface to be mirorred
    @param sw_if_index_to - interface where the traffic is mirrored
    @param state - 0 = disabled, 1 = rx enabled, 2 = tx enabled, 3 tx & rx enabled
    @param is_l2 - 0 = mirror at hw device level, 1 = mirror at L2
*/
autoreply define sw_interface_span_enable_disable {
    u32 client_index;
    u32 context;
    u32 sw_if_index_from;
    u32 sw_if_index_to;
    u8  state;
    u8  is_l2;
};

/** \brief SPAN dump request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_l2 - 0 = hw device level, 1 = L2
*/
define sw_interface_span_dump {
    u32 client_index;
    u32 context;
    u8 is_l2;
};

/** \brief Reply to SPAN dump request
    @param context - sender context which was passed in the request
    @param sw_if_index_from - mirorred interface
    @param sw_if_index_to - interface where the traffic is mirrored
    @param state - 0 = disabled, 1 = rx enabled, 2 = tx enabled, 3 tx & rx enabled
*/
define sw_interface_span_details {
    u32 context;
    u32 sw_if_index_from;
    u32 sw_if_index_to;
    u8 state;
};
