UI_STRING.pod 4.9 KB

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