xref: /src/crypto/openssl/apps/include/function.h (revision f25b8c9fb4f58cf61adb47d7570abe7caa6d385d)
1e4520c8bSEnji Cooper /*
2e4520c8bSEnji Cooper  * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
3e4520c8bSEnji Cooper  *
4e4520c8bSEnji Cooper  * Licensed under the Apache License 2.0 (the "License").  You may not use
5e4520c8bSEnji Cooper  * this file except in compliance with the License.  You can obtain a copy
6e4520c8bSEnji Cooper  * in the file LICENSE in the source distribution or at
7e4520c8bSEnji Cooper  * https://www.openssl.org/source/license.html
8e4520c8bSEnji Cooper  */
9e4520c8bSEnji Cooper 
10e4520c8bSEnji Cooper #ifndef OSSL_APPS_FUNCTION_H
11e4520c8bSEnji Cooper #define OSSL_APPS_FUNCTION_H
12e4520c8bSEnji Cooper 
13e4520c8bSEnji Cooper #include <openssl/lhash.h>
14e4520c8bSEnji Cooper #include "opt.h"
15e4520c8bSEnji Cooper 
16e4520c8bSEnji Cooper #define DEPRECATED_NO_ALTERNATIVE "unknown"
17e4520c8bSEnji Cooper 
18e4520c8bSEnji Cooper typedef enum FUNC_TYPE {
19808413daSEnji Cooper     FT_none,
20808413daSEnji Cooper     FT_general,
21808413daSEnji Cooper     FT_md,
22808413daSEnji Cooper     FT_cipher,
23808413daSEnji Cooper     FT_pkey,
24808413daSEnji Cooper     FT_md_alg,
25808413daSEnji Cooper     FT_cipher_alg
26e4520c8bSEnji Cooper } FUNC_TYPE;
27e4520c8bSEnji Cooper 
28e4520c8bSEnji Cooper typedef struct function_st {
29e4520c8bSEnji Cooper     FUNC_TYPE type;
30e4520c8bSEnji Cooper     const char *name;
31e4520c8bSEnji Cooper     int (*func)(int argc, char *argv[]);
32e4520c8bSEnji Cooper     const OPTIONS *help;
33e4520c8bSEnji Cooper     const char *deprecated_alternative;
34e4520c8bSEnji Cooper     const char *deprecated_version;
35e4520c8bSEnji Cooper } FUNCTION;
36e4520c8bSEnji Cooper 
3729536654SEnji Cooper DEFINE_LHASH_OF_EX(FUNCTION);
38e4520c8bSEnji Cooper 
39e4520c8bSEnji Cooper /* Structure to hold the number of columns to be displayed and the
40e4520c8bSEnji Cooper  * field width used to display them.
41e4520c8bSEnji Cooper  */
42e4520c8bSEnji Cooper typedef struct {
43e4520c8bSEnji Cooper     int columns;
44e4520c8bSEnji Cooper     int width;
45e4520c8bSEnji Cooper } DISPLAY_COLUMNS;
46e4520c8bSEnji Cooper 
47e4520c8bSEnji Cooper void calculate_columns(FUNCTION *functions, DISPLAY_COLUMNS *dc);
48e4520c8bSEnji Cooper 
49e4520c8bSEnji Cooper #endif
50