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