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