/* 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.
 */

 /** \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
*/
define sw_interface_span_enable_disable {
    u32 client_index;
    u32 context;
    u32 sw_if_index_from;
    u32 sw_if_index_to;
    u8  state;
};

/** \brief Reply to SPAN enable/disable request
    @param context - sender context which was passed in the request
*/
define sw_interface_span_enable_disable_reply {
    u32 context;
    i32 retval;
};

/** \brief SPAN dump request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define sw_interface_span_dump {
    u32 client_index;
    u32 context;
};

/** \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;
};
