/*
 * Copyright (c) 2020 Intel 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 = "0.0.3";

import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";
import "vnet/flow/flow_types.api";

/** \brief flow add request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param flow - flow rule
*/
define flow_add
{
  option deprecated;

  u32 client_index;
  u32 context;
  vl_api_flow_rule_t flow;
  option vat_help = "test flow add [src-ip <ip-addr/mask>] [dst-ip <ip-addr/mask>] [src-port <port/mask>] [dst-port <port/mask>] [proto <ip-proto>]";
};

/** \brief flow add request v2
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param flow - flow rule v2
*/
define flow_add_v2
{
  u32 client_index;
  u32 context;
  vl_api_flow_rule_v2_t flow;
  option vat_help = "test flow add [src-ip <ip-addr/mask>] [dst-ip <ip-addr/mask>] [src-port <port/mask>] [dst-port <port/mask>] [proto <ip-proto>] [spec <spec-string>] [mask <mask-string>]";
};

/** \brief reply for adding flow
    @param context - sender context, to match reply w/ request
    @param retval - return code
    @param flow_index - flow index, can be used for flow del/enable/disable
*/
define flow_add_reply
{
  option deprecated;

  u32 context;
  i32 retval;
  u32 flow_index;
};

/** \brief reply for adding flow v2
    @param context - sender context, to match reply w/ request
    @param retval - return code
    @param flow_index - flow index, can be used for flow del/enable/disable
*/
define flow_add_v2_reply
{
  u32 context;
  i32 retval;
  u32 flow_index;
};

/** \brief flow del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param flow_index - flow index
*/
autoreply define flow_del
{
  u32 client_index;
  u32 context;
  u32 flow_index;
  option vat_help = "test flow del index <index>";
};

/** \brief flow enable request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param flow_index - flow index
	@param hw_if_index - hardware interface index
*/
autoreply define flow_enable
{
  u32 client_index;
  u32 context;
  u32 flow_index;
  u32 hw_if_index;
  option vat_help = "test flow enable index <index> <interface name>";
};

/** \brief flow disable request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param flow_index - flow index
	@param hw_if_index - hardware interface index
*/
autoreply define flow_disable
{
  u32 client_index;
  u32 context;
  u32 flow_index;
  u32 hw_if_index;
  option vat_help = "test flow disable index <index> <interface name>";
};

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