1=pod 2 3=head1 NAME 4 5UI_STRING, UI_string_types, UI_get_string_type, 6UI_get_input_flags, UI_get0_output_string, 7UI_get0_action_string, UI_get0_result_string, UI_get_result_string_length, 8UI_get0_test_string, UI_get_result_minsize, 9UI_get_result_maxsize, UI_set_result, UI_set_result_ex 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 int UI_get_result_string_length(UI_STRING *uis); 33 const char *UI_get0_test_string(UI_STRING *uis); 34 int UI_get_result_minsize(UI_STRING *uis); 35 int UI_get_result_maxsize(UI_STRING *uis); 36 int UI_set_result(UI *ui, UI_STRING *uis, const char *result); 37 int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); 38 39=head1 DESCRIPTION 40 41The B<UI_STRING> gets created internally and added to a B<UI> whenever 42one of the functions UI_add_input_string(), UI_dup_input_string(), 43UI_add_verify_string(), UI_dup_verify_string(), 44UI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(), 45UI_dup_info_string(), UI_add_error_string() or UI_dup_error_string() 46is called. 47For a B<UI_METHOD> user, there's no need to know more. 48For a B<UI_METHOD> creator, it is of interest to fetch text from these 49B<UI_STRING> objects as well as adding results to some of them. 50 51UI_get_string_type() is used to retrieve the type of the given 52B<UI_STRING>. 53 54UI_get_input_flags() is used to retrieve the flags associated with the 55given B<UI_STRING>. 56 57UI_get0_output_string() is used to retrieve the actual string to 58output (prompt, info, error, ...). 59 60UI_get0_action_string() is used to retrieve the action description 61associated with a B<UIT_BOOLEAN> type B<UI_STRING>. 62For all other B<UI_STRING> types, NULL is returned. 63See L<UI_add_input_boolean(3)>. 64 65UI_get0_result_string() and UI_get_result_string_length() are used to 66retrieve the result of a prompt and its length. 67This is only useful for B<UIT_PROMPT> and B<UIT_VERIFY> type strings. 68For all other B<UI_STRING> types, UI_get0_result_string() returns NULL 69and UI_get_result_string_length() returns -1. 70 71UI_get0_test_string() is used to retrieve the string to compare the 72prompt result with. 73This is only useful for B<UIT_VERIFY> type strings. 74For all other B<UI_STRING> types, NULL is returned. 75 76UI_get_result_minsize() and UI_get_result_maxsize() are used to 77retrieve the minimum and maximum required size of the result. 78This is only useful for B<UIT_PROMPT> and B<UIT_VERIFY> type strings. 79For all other B<UI_STRING> types, -1 is returned. 80 81UI_set_result_ex() is used to set the result value of a prompt and its length. 82For B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, this sets the 83result retrievable with UI_get0_result_string() by copying the 84contents of B<result> if its length fits the minimum and maximum size 85requirements. 86For B<UIT_BOOLEAN> type UI strings, this sets the first character of 87the result retrievable with UI_get0_result_string() to the first 88B<ok_char> given with UI_add_input_boolean() or UI_dup_input_boolean() 89if the B<result> matched any of them, or the first of the 90B<cancel_chars> if the B<result> matched any of them, otherwise it's 91set to the NUL char C<\0>. 92See L<UI_add_input_boolean(3)> for more information on B<ok_chars> and 93B<cancel_chars>. 94 95UI_set_result() does the same thing as UI_set_result_ex(), but calculates 96its length internally. 97It expects the string to be terminated with a NUL byte, and is therefore 98only useful with normal C strings. 99 100=head1 RETURN VALUES 101 102UI_get_string_type() returns the UI string type. 103 104UI_get_input_flags() returns the UI string flags. 105 106UI_get0_output_string() returns the UI string output string. 107 108UI_get0_action_string() returns the UI string action description 109string for B<UIT_BOOLEAN> type UI strings, NULL for any other type. 110 111UI_get0_result_string() returns the UI string result buffer for 112B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, NULL for any other 113type. 114 115UI_get_result_string_length() returns the UI string result buffer's 116content length for B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, 117-1 for any other type. 118 119UI_get0_test_string() returns the UI string action description 120string for B<UIT_VERIFY> type UI strings, NULL for any other type. 121 122UI_get_result_minsize() returns the minimum allowed result size for 123the UI string for B<UIT_PROMPT> and B<UIT_VERIFY> type strings, 124-1 for any other type. 125 126UI_get_result_maxsize() returns the minimum allowed result size for 127the UI string for B<UIT_PROMPT> and B<UIT_VERIFY> type strings, 128-1 for any other type. 129 130UI_set_result() returns 0 on success or when the UI string is of any 131type other than B<UIT_PROMPT>, B<UIT_VERIFY> or B<UIT_BOOLEAN>, -1 on 132error. 133 134=head1 SEE ALSO 135 136L<UI(3)> 137 138=head1 COPYRIGHT 139 140Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. 141 142Licensed under the Apache License 2.0 (the "License"). You may not use 143this file except in compliance with the License. You can obtain a copy 144in the file LICENSE in the source distribution or at 145L<https://www.openssl.org/source/license.html>. 146 147=cut 148 149