/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2018 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 QoS record, store and mark API messages which are generally
 *    called through a shared memory interface.
 *
 * Definitions of verbs:
 *  store: write a QoS value into the buffer meta-data
 *  record: Extract a QoS value from a packet header and store it.
 *  mark: Make a change to the content of a packet header by writing a stored
 *        QoS value
 */
option version = "1.1.1";

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

enum qos_source : u8
{
  QOS_API_SOURCE_EXT = 0,
  QOS_API_SOURCE_VLAN = 1,
  QOS_API_SOURCE_MPLS = 2,
  QOS_API_SOURCE_IP = 3,
};

/**
 * QoS store.
 * @param sw_if_index - The interface on which store is enabled.
 * @param input_source - The input source/layer at which the QoS bits are stored
 *                       See qos_source_t. This determines what packets have a
 *                       value stored. i.e. If IP is seleted this affects on IP
 *                       packets.
 * @param value - The value to store.
 */
typedef qos_store
{
  vl_api_interface_index_t sw_if_index;
  vl_api_qos_source_t input_source;
  u8 value;
};

/**
 * Enable/Disable QoS storing
 * The QoS bits from the packet at the specified input layer are copied
 * into the packet. Storing should be used in conjunction with marking
 * @param enable - enable=1 or disable the feature
 * @param store - Store configuration
 */
autoreply define qos_store_enable_disable
{
  u32 client_index;
  u32 context;
  bool enable [default=true];
  vl_api_qos_store_t store;
};

/**
 * Dump the QoS store configs
 */
define qos_store_dump
{
  u32 client_index;
  u32 context;
};

/**
 * Details of QoS recording configs
 */
define qos_store_details
{
  u32 context;
  vl_api_qos_store_t store;
};

/**
 * QoS recording.
 * @param sw_if_index - The interface on which recording is enabled.
 * @param input_source - The input source/layer at which the QoS bits
                         are copied from the packet. See qos_source_t.
 */
typedef qos_record
{
  vl_api_interface_index_t sw_if_index;
  vl_api_qos_source_t input_source;
};

/**
 * Enable/Disable QoS recording
 * The QoS bits from the packet at the specified input layer are copied
 * into the packet. Recording should be used in conjunction with marking
 * @param enable - enable=1 or disable the feature
 * @param record - Recording configuration
 */
autoreply define qos_record_enable_disable
{
  u32 client_index;
  u32 context;
  bool enable [default=true];
  vl_api_qos_record_t record;
};

/**
 * Dump the QoS record configs
 */
define qos_record_dump
{
  u32 client_index;
  u32 context;
};

/**
 * Details of QoS recording configs
 */
define qos_record_details
{
  u32 context;
  vl_api_qos_record_t record;
};

/**
 * @brief A row within a QoS map
 *  Each value translates from an input value to an output.
 */
typedef qos_egress_map_row
{
  u8 outputs[256];
};

/**
 * QoS Translation Map
 *
 * @param id - client provided identifier for the map
 * @param rows - one row (per-input source) of output values
 */
typedef qos_egress_map
{
  u32 id;
  vl_api_qos_egress_map_row_t rows[4];
};

/**
 *  @brief Update a QoS Map
 *   A QoS map, translates from the QoS value in the packet set by the 'record'
 *   feature, to the value used for output in the 'mark' feature.
 *   There is one row in the map for each input/record source.
 *   The MAP is then applied to the egress interface at for a given output source
 * @param map - The Map
 */
autoreply define qos_egress_map_update
{
  u32 client_index;
  u32 context;
  vl_api_qos_egress_map_t map;
};

/**
 * @brief Delete a Qos Map
 * @param map_id - ID of the map to delete
 */
autoreply define qos_egress_map_delete
{
  u32 client_index;
  u32 context;
  u32 id;
};

/**
 * Dump the QoS egress maps
 */
define qos_egress_map_dump
{
  u32 client_index;
  u32 context;
};

/**
 * QoS map details
 */
define qos_egress_map_details
{
  u32 context;
  vl_api_qos_egress_map_t map;
};

/**
 * QoS marking Cponfiguration
 * The QoS bits from the buffer are mapped (using the desired egress map)
 * into the header of the 'output-source'. Marking should be used in
 * conjunction with recording
 * @param sw_if_index - The interface on which recording is enabled.
 * @param output_source - The output source/layer at which the QoS bits
 *                        are written into the packet. See qos_source_t.
 * @param map_id - The ID of the MAP in which the translation from input
 *                 to output is performed.
 */
typedef qos_mark
{
  u32 sw_if_index;
  u32 map_id;
  vl_api_qos_source_t output_source;
};

/**
 * @brief Enable/Disable QoS marking
 * @param enable - enable=1 or disable the feature
 * @param mark - Marking config
 */
autoreply define qos_mark_enable_disable
{
  u32 client_index;
  u32 context;
  bool enable [default=true];
  vl_api_qos_mark_t mark;
};

/**
 * Dump QoS marking configs
 */
define qos_mark_dump
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
};

/**
 * QoS marking details
 */
autoreply define qos_mark_details
{
  u32 context;
  vl_api_qos_mark_t mark;
};

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