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

import "vnet/interface_types.api";
import "vnet/policer/policer_types.api";

/** \brief policer bind: Associate/disassociate a policer with a worker thread.
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param name - policer name to bind
    @param worker_index - the worker thread to bind to
    @param bind_enable - Associate/disassociate
*/
autoreply define policer_bind
{
  u32 client_index;
  u32 context;

  string name[64];
  u32 worker_index;
  bool bind_enable;
};

/** \brief policer input: Apply policer as an input feature.
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param name - policer name
    @param sw_if_index - interface to apply the policer
    @param apply - Apply/remove
*/
autoreply define policer_input
{
  u32 client_index;
  u32 context;

  string name[64];
  vl_api_interface_index_t sw_if_index;
  bool apply;
};

/** \brief Add/del policer
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add policer if non-zero, else delete
    @param name - policer name
    @param cir - CIR
    @param eir - EIR
    @param cb - Committed Burst
    @param eb - Excess or Peak Burst
    @param rate_type - rate type
    @param round_type - rounding type
    @param type - policer algorithm
    @param color_aware - 0=color-blind, 1=color-aware
    @param conform_action - conform action
    @param exceed_action - exceed action type
    @param violate_action - violate action type
*/
define policer_add_del
{
  u32 client_index;
  u32 context;

  bool is_add;
  string name[64];
  u32 cir;
  u32 eir;
  u64 cb;
  u64 eb;
  vl_api_sse2_qos_rate_type_t rate_type;
  vl_api_sse2_qos_round_type_t round_type;
  vl_api_sse2_qos_policer_type_t type;
  bool color_aware;
  vl_api_sse2_qos_action_t conform_action;
  vl_api_sse2_qos_action_t exceed_action;
  vl_api_sse2_qos_action_t violate_action;
};

/** \brief Add/del policer response
    @param context - sender context, to match reply w/ request
    @param retval - return value for request
    @param policer_index - for add, returned index of the new policer
*/
define policer_add_del_reply
{
  u32 context;
  i32 retval;
  u32 policer_index;
};

/** \brief Get list of policers
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param match_name_valid - if 0 request all policers otherwise use match_name
    @param match_name - policer name
*/
define policer_dump
{
  u32 client_index;
  u32 context;

  bool match_name_valid;
  string match_name[64];
};

/** \brief Policer operational state response.
    @param context - sender context, to match reply w/ request
    @param name - policer name
    @param cir - CIR
    @param eir - EIR
    @param cb - Committed Burst
    @param eb - Excess or Peak Burst
    @param rate_type - rate type
    @param round_type - rounding type
    @param type - policer algorithm
    @param conform_action - conform action
    @param exceed_action - exceed action
    @param violate_action - violate action
    @param single_rate - 1 = single rate policer, 0 = two rate policer
    @param color_aware - for hierarchical policing
    @param scale - power-of-2 shift amount for lower rates
    @param cir_tokens_per_period - number of tokens for each period
    @param pir_tokens_per_period - number of tokens for each period for 2-rate policer
    @param current_limit - current limit
    @param current_bucket - current bucket
    @param extended_limit - extended limit
    @param extended_bucket - extended bucket
    @param last_update_time - last update time
*/
define policer_details
{
  u32 context;

  string name[64];
  u32 cir;
  u32 eir;
  u64 cb;
  u64 eb;
  vl_api_sse2_qos_rate_type_t rate_type;
  vl_api_sse2_qos_round_type_t round_type;
  vl_api_sse2_qos_policer_type_t type;
  vl_api_sse2_qos_action_t conform_action;
  vl_api_sse2_qos_action_t exceed_action;
  vl_api_sse2_qos_action_t violate_action;
  bool single_rate;
  bool color_aware;
  u32 scale;
  u32 cir_tokens_per_period;
  u32 pir_tokens_per_period;
  u32 current_limit;
  u32 current_bucket;
  u32 extended_limit;
  u32 extended_bucket;
  u64 last_update_time;
};

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