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

enum crypto_dispatch_mode:u8
{
  CRYPTO_ASYNC_DISPATCH_POLLING = 0,
  CRYPTO_ASYNC_DISPATCH_INTERRUPT = 1,
};

enum crypto_op_class_type:u8
{
  CRYPTO_API_OP_SIMPLE = 0,
  CRYPTO_API_OP_CHAINED,
  CRYPTO_API_OP_BOTH,
};

 /** \brief crypto: Use polling or interrupt dispatch.
    Always unset the adaptive flag (that is why it is deprecated).
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param mode - dispatch mode
*/

autoreply define crypto_set_async_dispatch
{
  option deprecated;
  option replaced_by="crypto_set_async_dispatch_v2";
  u32 client_index;
  u32 context;
  vl_api_crypto_dispatch_mode_t mode;
};

 /** \brief crypto: Change the way crypto operations are dispatched.
    Use adaptive (or not) mode, starting in polling or interrupt state.
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param mode - dispatch initial state
    @param adaptive - whether on not the state shall change depending on load
*/

autoreply define crypto_set_async_dispatch_v2
{
  u32 client_index;
  u32 context;
  vl_api_crypto_dispatch_mode_t mode;
  bool adaptive;
};

 /** \brief crypto: set crypto handler
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param alg_name - Name of the algorithm to add
    @param engine - Name of the engine to add
    @param oct - Operation class type (simple, chained, both)
    @param is_async - Asynchronous or not
*/

autoreply define crypto_set_handler
{
  u32 client_index;
  u32 context;
  string alg_name[32];
  string engine[16];
  vl_api_crypto_op_class_type_t oct;
  u8 is_async;
};

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