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