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