1UI_STRING(3ossl) OpenSSL UI_STRING(3ossl)
2
3
4
6 UI_STRING, UI_string_types, UI_get_string_type, UI_get_input_flags,
7 UI_get0_output_string, UI_get0_action_string, UI_get0_result_string,
8 UI_get_result_string_length, UI_get0_test_string,
9 UI_get_result_minsize, UI_get_result_maxsize, UI_set_result,
10 UI_set_result_ex - User interface string parsing
11
13 #include <openssl/ui.h>
14
15 typedef struct ui_string_st UI_STRING;
16
17 enum UI_string_types {
18 UIT_NONE = 0,
19 UIT_PROMPT, /* Prompt for a string */
20 UIT_VERIFY, /* Prompt for a string and verify */
21 UIT_BOOLEAN, /* Prompt for a yes/no response */
22 UIT_INFO, /* Send info to the user */
23 UIT_ERROR /* Send an error message to the user */
24 };
25
26 enum UI_string_types UI_get_string_type(UI_STRING *uis);
27 int UI_get_input_flags(UI_STRING *uis);
28 const char *UI_get0_output_string(UI_STRING *uis);
29 const char *UI_get0_action_string(UI_STRING *uis);
30 const char *UI_get0_result_string(UI_STRING *uis);
31 int UI_get_result_string_length(UI_STRING *uis);
32 const char *UI_get0_test_string(UI_STRING *uis);
33 int UI_get_result_minsize(UI_STRING *uis);
34 int UI_get_result_maxsize(UI_STRING *uis);
35 int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
36 int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);
37
39 The UI_STRING gets created internally and added to a UI whenever one of
40 the functions UI_add_input_string(), UI_dup_input_string(),
41 UI_add_verify_string(), UI_dup_verify_string(), UI_add_input_boolean(),
42 UI_dup_input_boolean(), UI_add_info_string(), UI_dup_info_string(),
43 UI_add_error_string() or UI_dup_error_string() is called. For a
44 UI_METHOD user, there's no need to know more. For a UI_METHOD creator,
45 it is of interest to fetch text from these UI_STRING objects as well as
46 adding results to some of them.
47
48 UI_get_string_type() is used to retrieve the type of the given
49 UI_STRING.
50
51 UI_get_input_flags() is used to retrieve the flags associated with the
52 given UI_STRING.
53
54 UI_get0_output_string() is used to retrieve the actual string to output
55 (prompt, info, error, ...).
56
57 UI_get0_action_string() is used to retrieve the action description
58 associated with a UIT_BOOLEAN type UI_STRING. For all other UI_STRING
59 types, NULL is returned. See UI_add_input_boolean(3).
60
61 UI_get0_result_string() and UI_get_result_string_length() are used to
62 retrieve the result of a prompt and its length. This is only useful
63 for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING
64 types, UI_get0_result_string() returns NULL and
65 UI_get_result_string_length() returns -1.
66
67 UI_get0_test_string() is used to retrieve the string to compare the
68 prompt result with. This is only useful for UIT_VERIFY type strings.
69 For all other UI_STRING types, NULL is returned.
70
71 UI_get_result_minsize() and UI_get_result_maxsize() are used to
72 retrieve the minimum and maximum required size of the result. This is
73 only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other
74 UI_STRING types, -1 is returned.
75
76 UI_set_result_ex() is used to set the result value of a prompt and its
77 length. For UIT_PROMPT and UIT_VERIFY type UI strings, this sets the
78 result retrievable with UI_get0_result_string() by copying the contents
79 of result if its length fits the minimum and maximum size requirements.
80 For UIT_BOOLEAN type UI strings, this sets the first character of the
81 result retrievable with UI_get0_result_string() to the first ok_char
82 given with UI_add_input_boolean() or UI_dup_input_boolean() if the
83 result matched any of them, or the first of the cancel_chars if the
84 result matched any of them, otherwise it's set to the NUL char "\0".
85 See UI_add_input_boolean(3) for more information on ok_chars and
86 cancel_chars.
87
88 UI_set_result() does the same thing as UI_set_result_ex(), but
89 calculates its length internally. It expects the string to be
90 terminated with a NUL byte, and is therefore only useful with normal C
91 strings.
92
94 UI_get_string_type() returns the UI string type.
95
96 UI_get_input_flags() returns the UI string flags.
97
98 UI_get0_output_string() returns the UI string output string.
99
100 UI_get0_action_string() returns the UI string action description string
101 for UIT_BOOLEAN type UI strings, NULL for any other type.
102
103 UI_get0_result_string() returns the UI string result buffer for
104 UIT_PROMPT and UIT_VERIFY type UI strings, NULL for any other type.
105
106 UI_get_result_string_length() returns the UI string result buffer's
107 content length for UIT_PROMPT and UIT_VERIFY type UI strings, -1 for
108 any other type.
109
110 UI_get0_test_string() returns the UI string action description string
111 for UIT_VERIFY type UI strings, NULL for any other type.
112
113 UI_get_result_minsize() returns the minimum allowed result size for the
114 UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other
115 type.
116
117 UI_get_result_maxsize() returns the minimum allowed result size for the
118 UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other
119 type.
120
121 UI_set_result() returns 0 on success or when the UI string is of any
122 type other than UIT_PROMPT, UIT_VERIFY or UIT_BOOLEAN, -1 on error.
123
125 UI(3)
126
128 Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
129
130 Licensed under the Apache License 2.0 (the "License"). You may not use
131 this file except in compliance with the License. You can obtain a copy
132 in the file LICENSE in the source distribution or at
133 <https://www.openssl.org/source/license.html>.
134
135
136
1373.0.9 2023-07-27 UI_STRING(3ossl)