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

option version = "1.0.0";

/** \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_type - conform action type
    @param conform_dscp - DSCP for conform mar-and-transmit action
    @param exceed_action_type - exceed action type
    @param exceed_dscp - DSCP for exceed mar-and-transmit action
    @param violate_action_type - violate action type
    @param violate_dscp - DSCP for violate mar-and-transmit action
*/
define policer_add_del
{
  u32 client_index;
  u32 context;

  u8 is_add;
  u8 name[64];
  u32 cir;
  u32 eir;
  u64 cb;
  u64 eb;
  u8 rate_type;
  u8 round_type;
  u8 type;
  u8 color_aware;
  u8 conform_action_type;
  u8 conform_dscp;
  u8 exceed_action_type;
  u8 exceed_dscp;
  u8 violate_action_type;
  u8 violate_dscp;
};

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

  u8 match_name_valid;
  u8 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_type - conform action type
    @param conform_dscp - DSCP for conform mar-and-transmit action
    @param exceed_action_type - exceed action type
    @param exceed_dscp - DSCP for exceed mar-and-transmit action
    @param violate_action_type - violate action type
    @param violate_dscp - DSCP for violate mar-and-transmit 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;

  u8 name[64];
  u32 cir;
  u32 eir;
  u64 cb;
  u64 eb;
  u8 rate_type;
  u8 round_type;
  u8 type;
  u8 conform_action_type;
  u8 conform_dscp;
  u8 exceed_action_type;
  u8 exceed_dscp;
  u8 violate_action_type;
  u8 violate_dscp;
  u8 single_rate;
  u8 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:
 */
