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

option 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 mirrored
    @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 - mirrored 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
    @param is_l2 - 0 = mirrored at hw device level, 1 = mirrored at l2
*/
define sw_interface_span_details {
    u32 context;
    u32 sw_if_index_from;
    u32 sw_if_index_to;
    u8 state;
    u8 is_l2;
};
