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