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