xref: /freebsd/crypto/openssl/doc/man3/UI_STRING.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimUI_STRING, UI_string_types, UI_get_string_type,
6e71b7053SJung-uk KimUI_get_input_flags, UI_get0_output_string,
7e71b7053SJung-uk KimUI_get0_action_string, UI_get0_result_string, UI_get_result_string_length,
8e71b7053SJung-uk KimUI_get0_test_string, UI_get_result_minsize,
9e71b7053SJung-uk KimUI_get_result_maxsize, UI_set_result, UI_set_result_ex
10e71b7053SJung-uk Kim- User interface string parsing
11e71b7053SJung-uk Kim
12e71b7053SJung-uk Kim=head1 SYNOPSIS
13e71b7053SJung-uk Kim
14e71b7053SJung-uk Kim #include <openssl/ui.h>
15e71b7053SJung-uk Kim
16e71b7053SJung-uk Kim typedef struct ui_string_st UI_STRING;
17e71b7053SJung-uk Kim
18e71b7053SJung-uk Kim enum UI_string_types {
19e71b7053SJung-uk Kim     UIT_NONE = 0,
20e71b7053SJung-uk Kim     UIT_PROMPT,                 /* Prompt for a string */
21e71b7053SJung-uk Kim     UIT_VERIFY,                 /* Prompt for a string and verify */
22e71b7053SJung-uk Kim     UIT_BOOLEAN,                /* Prompt for a yes/no response */
23e71b7053SJung-uk Kim     UIT_INFO,                   /* Send info to the user */
24e71b7053SJung-uk Kim     UIT_ERROR                   /* Send an error message to the user */
25e71b7053SJung-uk Kim };
26e71b7053SJung-uk Kim
27e71b7053SJung-uk Kim enum UI_string_types UI_get_string_type(UI_STRING *uis);
28e71b7053SJung-uk Kim int UI_get_input_flags(UI_STRING *uis);
29e71b7053SJung-uk Kim const char *UI_get0_output_string(UI_STRING *uis);
30e71b7053SJung-uk Kim const char *UI_get0_action_string(UI_STRING *uis);
31e71b7053SJung-uk Kim const char *UI_get0_result_string(UI_STRING *uis);
32e71b7053SJung-uk Kim int UI_get_result_string_length(UI_STRING *uis);
33e71b7053SJung-uk Kim const char *UI_get0_test_string(UI_STRING *uis);
34e71b7053SJung-uk Kim int UI_get_result_minsize(UI_STRING *uis);
35e71b7053SJung-uk Kim int UI_get_result_maxsize(UI_STRING *uis);
36e71b7053SJung-uk Kim int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
37e71b7053SJung-uk Kim int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);
38e71b7053SJung-uk Kim
39e71b7053SJung-uk Kim=head1 DESCRIPTION
40e71b7053SJung-uk Kim
41e71b7053SJung-uk KimThe B<UI_STRING> gets created internally and added to a B<UI> whenever
42e71b7053SJung-uk Kimone of the functions UI_add_input_string(), UI_dup_input_string(),
43e71b7053SJung-uk KimUI_add_verify_string(), UI_dup_verify_string(),
44e71b7053SJung-uk KimUI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(),
45e71b7053SJung-uk KimUI_dup_info_string(), UI_add_error_string() or UI_dup_error_string()
46e71b7053SJung-uk Kimis called.
47e71b7053SJung-uk KimFor a B<UI_METHOD> user, there's no need to know more.
48e71b7053SJung-uk KimFor a B<UI_METHOD> creator, it is of interest to fetch text from these
49e71b7053SJung-uk KimB<UI_STRING> objects as well as adding results to some of them.
50e71b7053SJung-uk Kim
51e71b7053SJung-uk KimUI_get_string_type() is used to retrieve the type of the given
52e71b7053SJung-uk KimB<UI_STRING>.
53e71b7053SJung-uk Kim
54e71b7053SJung-uk KimUI_get_input_flags() is used to retrieve the flags associated with the
55e71b7053SJung-uk Kimgiven B<UI_STRING>.
56e71b7053SJung-uk Kim
57e71b7053SJung-uk KimUI_get0_output_string() is used to retrieve the actual string to
58e71b7053SJung-uk Kimoutput (prompt, info, error, ...).
59e71b7053SJung-uk Kim
60e71b7053SJung-uk KimUI_get0_action_string() is used to retrieve the action description
61e71b7053SJung-uk Kimassociated with a B<UIT_BOOLEAN> type B<UI_STRING>.
62e71b7053SJung-uk KimFor all other B<UI_STRING> types, NULL is returned.
63e71b7053SJung-uk KimSee L<UI_add_input_boolean(3)>.
64e71b7053SJung-uk Kim
65e71b7053SJung-uk KimUI_get0_result_string() and UI_get_result_string_length() are used to
66e71b7053SJung-uk Kimretrieve the result of a prompt and its length.
67e71b7053SJung-uk KimThis is only useful for B<UIT_PROMPT> and B<UIT_VERIFY> type strings.
68e71b7053SJung-uk KimFor all other B<UI_STRING> types, UI_get0_result_string() returns NULL
69e71b7053SJung-uk Kimand UI_get_result_string_length() returns -1.
70e71b7053SJung-uk Kim
71e71b7053SJung-uk KimUI_get0_test_string() is used to retrieve the string to compare the
72e71b7053SJung-uk Kimprompt result with.
73e71b7053SJung-uk KimThis is only useful for B<UIT_VERIFY> type strings.
74e71b7053SJung-uk KimFor all other B<UI_STRING> types, NULL is returned.
75e71b7053SJung-uk Kim
76e71b7053SJung-uk KimUI_get_result_minsize() and UI_get_result_maxsize() are used to
77e71b7053SJung-uk Kimretrieve the minimum and maximum required size of the result.
78e71b7053SJung-uk KimThis is only useful for B<UIT_PROMPT> and B<UIT_VERIFY> type strings.
79e71b7053SJung-uk KimFor all other B<UI_STRING> types, -1 is returned.
80e71b7053SJung-uk Kim
81e71b7053SJung-uk KimUI_set_result_ex() is used to set the result value of a prompt and its length.
82e71b7053SJung-uk KimFor B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, this sets the
83e71b7053SJung-uk Kimresult retrievable with UI_get0_result_string() by copying the
84e71b7053SJung-uk Kimcontents of B<result> if its length fits the minimum and maximum size
85e71b7053SJung-uk Kimrequirements.
86e71b7053SJung-uk KimFor B<UIT_BOOLEAN> type UI strings, this sets the first character of
87e71b7053SJung-uk Kimthe result retrievable with UI_get0_result_string() to the first
88e71b7053SJung-uk KimB<ok_char> given with UI_add_input_boolean() or UI_dup_input_boolean()
89e71b7053SJung-uk Kimif the B<result> matched any of them, or the first of the
90e71b7053SJung-uk KimB<cancel_chars> if the B<result> matched any of them, otherwise it's
91e71b7053SJung-uk Kimset to the NUL char C<\0>.
92e71b7053SJung-uk KimSee L<UI_add_input_boolean(3)> for more information on B<ok_chars> and
93e71b7053SJung-uk KimB<cancel_chars>.
94e71b7053SJung-uk Kim
95e71b7053SJung-uk KimUI_set_result() does the same thing as UI_set_result_ex(), but calculates
96e71b7053SJung-uk Kimits length internally.
97e71b7053SJung-uk KimIt expects the string to be terminated with a NUL byte, and is therefore
98e71b7053SJung-uk Kimonly useful with normal C strings.
99e71b7053SJung-uk Kim
100e71b7053SJung-uk Kim=head1 RETURN VALUES
101e71b7053SJung-uk Kim
102e71b7053SJung-uk KimUI_get_string_type() returns the UI string type.
103e71b7053SJung-uk Kim
104e71b7053SJung-uk KimUI_get_input_flags() returns the UI string flags.
105e71b7053SJung-uk Kim
106e71b7053SJung-uk KimUI_get0_output_string() returns the UI string output string.
107e71b7053SJung-uk Kim
108e71b7053SJung-uk KimUI_get0_action_string() returns the UI string action description
109e71b7053SJung-uk Kimstring for B<UIT_BOOLEAN> type UI strings, NULL for any other type.
110e71b7053SJung-uk Kim
111e71b7053SJung-uk KimUI_get0_result_string() returns the UI string result buffer for
112e71b7053SJung-uk KimB<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, NULL for any other
113e71b7053SJung-uk Kimtype.
114e71b7053SJung-uk Kim
115e71b7053SJung-uk KimUI_get_result_string_length() returns the UI string result buffer's
116e71b7053SJung-uk Kimcontent length for B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings,
117e71b7053SJung-uk Kim-1 for any other type.
118e71b7053SJung-uk Kim
119e71b7053SJung-uk KimUI_get0_test_string() returns the UI string action description
120e71b7053SJung-uk Kimstring for B<UIT_VERIFY> type UI strings, NULL for any other type.
121e71b7053SJung-uk Kim
122e71b7053SJung-uk KimUI_get_result_minsize() returns the minimum allowed result size for
123e71b7053SJung-uk Kimthe UI string for B<UIT_PROMPT> and B<UIT_VERIFY> type strings,
124e71b7053SJung-uk Kim-1 for any other type.
125e71b7053SJung-uk Kim
126e71b7053SJung-uk KimUI_get_result_maxsize() returns the minimum allowed result size for
127e71b7053SJung-uk Kimthe UI string for B<UIT_PROMPT> and B<UIT_VERIFY> type strings,
128e71b7053SJung-uk Kim-1 for any other type.
129e71b7053SJung-uk Kim
130e71b7053SJung-uk KimUI_set_result() returns 0 on success or when the UI string is of any
131e71b7053SJung-uk Kimtype other than B<UIT_PROMPT>, B<UIT_VERIFY> or B<UIT_BOOLEAN>, -1 on
132e71b7053SJung-uk Kimerror.
133e71b7053SJung-uk Kim
134e71b7053SJung-uk Kim=head1 SEE ALSO
135e71b7053SJung-uk Kim
136e71b7053SJung-uk KimL<UI(3)>
137e71b7053SJung-uk Kim
138e71b7053SJung-uk Kim=head1 COPYRIGHT
139e71b7053SJung-uk Kim
140e71b7053SJung-uk KimCopyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
141e71b7053SJung-uk Kim
142*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
143e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
144e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
145e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
146e71b7053SJung-uk Kim
147e71b7053SJung-uk Kim=cut
148e71b7053SJung-uk Kim
149