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

/** \file

    This file defines packet-generator interface APIs.
*/

vl_api_version 1.0.0

/** \brief PacketGenerator create interface request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param interface_id - interface index
*/
define pg_create_interface
{
  u32 client_index;
  u32 context;
  u32 interface_id;
};

/** \brief PacketGenerator create interface response
    @param context - sender context, to match reply w/ request
    @param retval - return value for request
*/
define pg_create_interface_reply
{
  u32 context;
  i32 retval;
  u32 sw_if_index;
};

/** \brief PacketGenerator capture packets on given interface request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param interface_id - pg interface index
    @param is_enabled - 1 if enabling streams, 0 if disabling
    @param count - number of packets to be captured
    @param pcap_file - pacp file name to store captured packets
*/
autoreply define pg_capture
{
  u32 client_index;
  u32 context;
  u32 interface_id;
  u8 is_enabled;
  u32 count;
  u32 pcap_name_length;
  u8 pcap_file_name[pcap_name_length];
};

/** \brief Enable / disable packet generator request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_enabled - 1 if enabling streams, 0 if disabling
    @param stream - stream name to be enable/disabled, if not specified handle all streams
*/
autoreply define pg_enable_disable
{
  u32 client_index;
  u32 context;
  u8 is_enabled;
  u32 stream_name_length;
  u8 stream_name[stream_name_length];
};

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