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