xref: /netbsd-src/crypto/external/bsd/openssl/dist/doc/man3/UI_STRING.pod (revision b0d1725196a7921d003d2c66a14f186abda4176b)
113d40330Schristos=pod
213d40330Schristos
313d40330Schristos=head1 NAME
413d40330Schristos
513d40330SchristosUI_STRING, UI_string_types, UI_get_string_type,
613d40330SchristosUI_get_input_flags, UI_get0_output_string,
713d40330SchristosUI_get0_action_string, UI_get0_result_string, UI_get_result_string_length,
813d40330SchristosUI_get0_test_string, UI_get_result_minsize,
913d40330SchristosUI_get_result_maxsize, UI_set_result, UI_set_result_ex
1013d40330Schristos- User interface string parsing
1113d40330Schristos
1213d40330Schristos=head1 SYNOPSIS
1313d40330Schristos
1413d40330Schristos #include <openssl/ui.h>
1513d40330Schristos
1613d40330Schristos typedef struct ui_string_st UI_STRING;
1713d40330Schristos
1813d40330Schristos enum UI_string_types {
1913d40330Schristos     UIT_NONE = 0,
2013d40330Schristos     UIT_PROMPT,                 /* Prompt for a string */
2113d40330Schristos     UIT_VERIFY,                 /* Prompt for a string and verify */
2213d40330Schristos     UIT_BOOLEAN,                /* Prompt for a yes/no response */
2313d40330Schristos     UIT_INFO,                   /* Send info to the user */
2413d40330Schristos     UIT_ERROR                   /* Send an error message to the user */
2513d40330Schristos };
2613d40330Schristos
2713d40330Schristos enum UI_string_types UI_get_string_type(UI_STRING *uis);
2813d40330Schristos int UI_get_input_flags(UI_STRING *uis);
2913d40330Schristos const char *UI_get0_output_string(UI_STRING *uis);
3013d40330Schristos const char *UI_get0_action_string(UI_STRING *uis);
3113d40330Schristos const char *UI_get0_result_string(UI_STRING *uis);
3213d40330Schristos int UI_get_result_string_length(UI_STRING *uis);
3313d40330Schristos const char *UI_get0_test_string(UI_STRING *uis);
3413d40330Schristos int UI_get_result_minsize(UI_STRING *uis);
3513d40330Schristos int UI_get_result_maxsize(UI_STRING *uis);
3613d40330Schristos int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
3713d40330Schristos int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);
3813d40330Schristos
3913d40330Schristos=head1 DESCRIPTION
4013d40330Schristos
4113d40330SchristosThe B<UI_STRING> gets created internally and added to a B<UI> whenever
4213d40330Schristosone of the functions UI_add_input_string(), UI_dup_input_string(),
4313d40330SchristosUI_add_verify_string(), UI_dup_verify_string(),
4413d40330SchristosUI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(),
4513d40330SchristosUI_dup_info_string(), UI_add_error_string() or UI_dup_error_string()
4613d40330Schristosis called.
4713d40330SchristosFor a B<UI_METHOD> user, there's no need to know more.
4813d40330SchristosFor a B<UI_METHOD> creator, it is of interest to fetch text from these
4913d40330SchristosB<UI_STRING> objects as well as adding results to some of them.
5013d40330Schristos
5113d40330SchristosUI_get_string_type() is used to retrieve the type of the given
5213d40330SchristosB<UI_STRING>.
5313d40330Schristos
5413d40330SchristosUI_get_input_flags() is used to retrieve the flags associated with the
5513d40330Schristosgiven B<UI_STRING>.
5613d40330Schristos
5713d40330SchristosUI_get0_output_string() is used to retrieve the actual string to
5813d40330Schristosoutput (prompt, info, error, ...).
5913d40330Schristos
6013d40330SchristosUI_get0_action_string() is used to retrieve the action description
6113d40330Schristosassociated with a B<UIT_BOOLEAN> type B<UI_STRING>.
6213d40330SchristosFor all other B<UI_STRING> types, NULL is returned.
6313d40330SchristosSee L<UI_add_input_boolean(3)>.
6413d40330Schristos
6513d40330SchristosUI_get0_result_string() and UI_get_result_string_length() are used to
6613d40330Schristosretrieve the result of a prompt and its length.
6713d40330SchristosThis is only useful for B<UIT_PROMPT> and B<UIT_VERIFY> type strings.
6813d40330SchristosFor all other B<UI_STRING> types, UI_get0_result_string() returns NULL
6913d40330Schristosand UI_get_result_string_length() returns -1.
7013d40330Schristos
7113d40330SchristosUI_get0_test_string() is used to retrieve the string to compare the
7213d40330Schristosprompt result with.
7313d40330SchristosThis is only useful for B<UIT_VERIFY> type strings.
7413d40330SchristosFor all other B<UI_STRING> types, NULL is returned.
7513d40330Schristos
7613d40330SchristosUI_get_result_minsize() and UI_get_result_maxsize() are used to
7713d40330Schristosretrieve the minimum and maximum required size of the result.
7813d40330SchristosThis is only useful for B<UIT_PROMPT> and B<UIT_VERIFY> type strings.
7913d40330SchristosFor all other B<UI_STRING> types, -1 is returned.
8013d40330Schristos
8113d40330SchristosUI_set_result_ex() is used to set the result value of a prompt and its length.
8213d40330SchristosFor B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, this sets the
8313d40330Schristosresult retrievable with UI_get0_result_string() by copying the
8413d40330Schristoscontents of B<result> if its length fits the minimum and maximum size
8513d40330Schristosrequirements.
8613d40330SchristosFor B<UIT_BOOLEAN> type UI strings, this sets the first character of
8713d40330Schristosthe result retrievable with UI_get0_result_string() to the first
8813d40330SchristosB<ok_char> given with UI_add_input_boolean() or UI_dup_input_boolean()
8913d40330Schristosif the B<result> matched any of them, or the first of the
9013d40330SchristosB<cancel_chars> if the B<result> matched any of them, otherwise it's
9113d40330Schristosset to the NUL char C<\0>.
9213d40330SchristosSee L<UI_add_input_boolean(3)> for more information on B<ok_chars> and
9313d40330SchristosB<cancel_chars>.
9413d40330Schristos
9513d40330SchristosUI_set_result() does the same thing as UI_set_result_ex(), but calculates
9613d40330Schristosits length internally.
9713d40330SchristosIt expects the string to be terminated with a NUL byte, and is therefore
9813d40330Schristosonly useful with normal C strings.
9913d40330Schristos
10013d40330Schristos=head1 RETURN VALUES
10113d40330Schristos
10213d40330SchristosUI_get_string_type() returns the UI string type.
10313d40330Schristos
10413d40330SchristosUI_get_input_flags() returns the UI string flags.
10513d40330Schristos
10613d40330SchristosUI_get0_output_string() returns the UI string output string.
10713d40330Schristos
10813d40330SchristosUI_get0_action_string() returns the UI string action description
10913d40330Schristosstring for B<UIT_BOOLEAN> type UI strings, NULL for any other type.
11013d40330Schristos
11113d40330SchristosUI_get0_result_string() returns the UI string result buffer for
11213d40330SchristosB<UIT_PROMPT> and B<UIT_VERIFY> type UI strings, NULL for any other
11313d40330Schristostype.
11413d40330Schristos
11513d40330SchristosUI_get_result_string_length() returns the UI string result buffer's
11613d40330Schristoscontent length for B<UIT_PROMPT> and B<UIT_VERIFY> type UI strings,
11713d40330Schristos-1 for any other type.
11813d40330Schristos
11913d40330SchristosUI_get0_test_string() returns the UI string action description
12013d40330Schristosstring for B<UIT_VERIFY> type UI strings, NULL for any other type.
12113d40330Schristos
12213d40330SchristosUI_get_result_minsize() returns the minimum allowed result size for
12313d40330Schristosthe UI string for B<UIT_PROMPT> and B<UIT_VERIFY> type strings,
12413d40330Schristos-1 for any other type.
12513d40330Schristos
12613d40330SchristosUI_get_result_maxsize() returns the minimum allowed result size for
12713d40330Schristosthe UI string for B<UIT_PROMPT> and B<UIT_VERIFY> type strings,
12813d40330Schristos-1 for any other type.
12913d40330Schristos
13013d40330SchristosUI_set_result() returns 0 on success or when the UI string is of any
13113d40330Schristostype other than B<UIT_PROMPT>, B<UIT_VERIFY> or B<UIT_BOOLEAN>, -1 on
13213d40330Schristoserror.
13313d40330Schristos
13413d40330Schristos=head1 SEE ALSO
13513d40330Schristos
13613d40330SchristosL<UI(3)>
13713d40330Schristos
13813d40330Schristos=head1 COPYRIGHT
13913d40330Schristos
14013d40330SchristosCopyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
14113d40330Schristos
142*b0d17251SchristosLicensed under the Apache License 2.0 (the "License").  You may not use
14313d40330Schristosthis file except in compliance with the License.  You can obtain a copy
14413d40330Schristosin the file LICENSE in the source distribution or at
14513d40330SchristosL<https://www.openssl.org/source/license.html>.
14613d40330Schristos
14713d40330Schristos=cut
14813d40330Schristos
149