Lines Matching refs:ui
71 void UI_free(UI *ui) in UI_free() argument
73 if (ui == NULL) in UI_free()
75 if ((ui->flags & UI_FLAG_DUPL_DATA) != 0) { in UI_free()
76 ui->meth->ui_destroy_data(ui, ui->user_data); in UI_free()
78 sk_UI_STRING_pop_free(ui->strings, free_string); in UI_free()
79 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data); in UI_free()
80 CRYPTO_THREAD_lock_free(ui->lock); in UI_free()
81 OPENSSL_free(ui); in UI_free()
84 static int allocate_string_stack(UI *ui) in allocate_string_stack() argument
86 if (ui->strings == NULL) { in allocate_string_stack()
87 ui->strings = sk_UI_STRING_new_null(); in allocate_string_stack()
88 if (ui->strings == NULL) { in allocate_string_stack()
95 static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt, in general_allocate_prompt() argument
117 static int general_allocate_string(UI *ui, const char *prompt, in general_allocate_string() argument
124 UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable, in general_allocate_string()
128 if (allocate_string_stack(ui) >= 0) { in general_allocate_string()
132 ret = sk_UI_STRING_push(ui->strings, s); in general_allocate_string()
144 static int general_allocate_boolean(UI *ui, in general_allocate_boolean() argument
168 s = general_allocate_prompt(ui, prompt, prompt_freeable, in general_allocate_boolean()
172 if (allocate_string_stack(ui) >= 0) { in general_allocate_boolean()
176 ret = sk_UI_STRING_push(ui->strings, s); in general_allocate_boolean()
195 int UI_add_input_string(UI *ui, const char *prompt, int flags, in UI_add_input_string() argument
198 return general_allocate_string(ui, prompt, 0, in UI_add_input_string()
204 int UI_dup_input_string(UI *ui, const char *prompt, int flags, in UI_dup_input_string() argument
215 return general_allocate_string(ui, prompt_copy, 1, in UI_dup_input_string()
220 int UI_add_verify_string(UI *ui, const char *prompt, int flags, in UI_add_verify_string() argument
224 return general_allocate_string(ui, prompt, 0, in UI_add_verify_string()
229 int UI_dup_verify_string(UI *ui, const char *prompt, int flags, in UI_dup_verify_string() argument
241 return general_allocate_string(ui, prompt_copy, 1, in UI_dup_verify_string()
246 int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, in UI_add_input_boolean() argument
250 return general_allocate_boolean(ui, prompt, action_desc, in UI_add_input_boolean()
255 int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, in UI_dup_input_boolean() argument
288 return general_allocate_boolean(ui, prompt_copy, action_desc_copy, in UI_dup_input_boolean()
299 int UI_add_info_string(UI *ui, const char *text) in UI_add_info_string() argument
301 return general_allocate_string(ui, text, 0, UIT_INFO, 0, NULL, 0, 0, in UI_add_info_string()
305 int UI_dup_info_string(UI *ui, const char *text) in UI_dup_info_string() argument
315 return general_allocate_string(ui, text_copy, 1, UIT_INFO, 0, NULL, in UI_dup_info_string()
319 int UI_add_error_string(UI *ui, const char *text) in UI_add_error_string() argument
321 return general_allocate_string(ui, text, 0, UIT_ERROR, 0, NULL, 0, 0, in UI_add_error_string()
325 int UI_dup_error_string(UI *ui, const char *text) in UI_dup_error_string() argument
334 return general_allocate_string(ui, text_copy, 1, UIT_ERROR, 0, NULL, in UI_dup_error_string()
338 char *UI_construct_prompt(UI *ui, const char *phrase_desc, in UI_construct_prompt() argument
343 if (ui != NULL && ui->meth != NULL && ui->meth->ui_construct_prompt != NULL) in UI_construct_prompt()
344 prompt = ui->meth->ui_construct_prompt(ui, phrase_desc, object_name); in UI_construct_prompt()
371 void *UI_add_user_data(UI *ui, void *user_data) in UI_add_user_data() argument
373 void *old_data = ui->user_data; in UI_add_user_data()
375 if ((ui->flags & UI_FLAG_DUPL_DATA) != 0) { in UI_add_user_data()
376 ui->meth->ui_destroy_data(ui, old_data); in UI_add_user_data()
379 ui->user_data = user_data; in UI_add_user_data()
380 ui->flags &= ~UI_FLAG_DUPL_DATA; in UI_add_user_data()
384 int UI_dup_user_data(UI *ui, void *user_data) in UI_dup_user_data() argument
388 if (ui->meth->ui_duplicate_data == NULL in UI_dup_user_data()
389 || ui->meth->ui_destroy_data == NULL) { in UI_dup_user_data()
394 duplicate = ui->meth->ui_duplicate_data(ui, user_data); in UI_dup_user_data()
400 (void)UI_add_user_data(ui, duplicate); in UI_dup_user_data()
401 ui->flags |= UI_FLAG_DUPL_DATA; in UI_dup_user_data()
406 void *UI_get0_user_data(UI *ui) in UI_get0_user_data() argument
408 return ui->user_data; in UI_get0_user_data()
411 const char *UI_get0_result(UI *ui, int i) in UI_get0_result() argument
417 if (i >= sk_UI_STRING_num(ui->strings)) { in UI_get0_result()
421 return UI_get0_result_string(sk_UI_STRING_value(ui->strings, i)); in UI_get0_result()
424 int UI_get_result_length(UI *ui, int i) in UI_get_result_length() argument
430 if (i >= sk_UI_STRING_num(ui->strings)) { in UI_get_result_length()
434 return UI_get_result_string_length(sk_UI_STRING_value(ui->strings, i)); in UI_get_result_length()
437 static int print_error(const char *str, size_t len, UI *ui) in print_error() argument
445 if (ui->meth->ui_write_string != NULL in print_error()
446 && ui->meth->ui_write_string(ui, &uis) <= 0) in print_error()
451 int UI_process(UI *ui) in UI_process() argument
456 if (ui->meth->ui_open_session != NULL in UI_process()
457 && ui->meth->ui_open_session(ui) <= 0) { in UI_process()
463 if (ui->flags & UI_FLAG_PRINT_ERRORS) in UI_process()
465 print_error, (void *)ui); in UI_process()
467 for (i = 0; i < sk_UI_STRING_num(ui->strings); i++) { in UI_process()
468 if (ui->meth->ui_write_string != NULL in UI_process()
469 && (ui->meth->ui_write_string(ui, in UI_process()
470 sk_UI_STRING_value(ui->strings, i)) in UI_process()
479 if (ui->meth->ui_flush != NULL) in UI_process()
480 switch (ui->meth->ui_flush(ui)) { in UI_process()
482 ui->flags &= ~UI_FLAG_REDOABLE; in UI_process()
494 for (i = 0; i < sk_UI_STRING_num(ui->strings); i++) { in UI_process()
495 if (ui->meth->ui_read_string != NULL) { in UI_process()
496 switch (ui->meth->ui_read_string(ui, in UI_process()
497 sk_UI_STRING_value(ui->strings, in UI_process()
500 ui->flags &= ~UI_FLAG_REDOABLE; in UI_process()
512 ui->flags &= ~UI_FLAG_REDOABLE; in UI_process()
520 if (ui->meth->ui_close_session != NULL in UI_process()
521 && ui->meth->ui_close_session(ui) <= 0) { in UI_process()
532 int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)) in UI_ctrl() argument
534 if (ui == NULL) { in UI_ctrl()
541 int save_flag = ! !(ui->flags & UI_FLAG_PRINT_ERRORS); in UI_ctrl()
543 ui->flags |= UI_FLAG_PRINT_ERRORS; in UI_ctrl()
545 ui->flags &= ~UI_FLAG_PRINT_ERRORS; in UI_ctrl()
549 return ! !(ui->flags & UI_FLAG_REDOABLE); in UI_ctrl()
567 const UI_METHOD *UI_get_method(UI *ui) in UI_get_method() argument
569 return ui->meth; in UI_get_method()
572 const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth) in UI_set_method() argument
574 ui->meth = meth; in UI_set_method()
575 return ui->meth; in UI_set_method()
618 int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)) in UI_method_set_opener() argument
628 int (*writer) (UI *ui, UI_STRING *uis)) in UI_method_set_writer()
637 int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)) in UI_method_set_flusher() argument
647 int (*reader) (UI *ui, UI_STRING *uis)) in UI_method_set_reader()
656 int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)) in UI_method_set_closer() argument
666 void *(*duplicator) (UI *ui, void *ui_data), in UI_method_set_data_duplicator()
667 void (*destructor)(UI *ui, void *ui_data)) in UI_method_set_data_duplicator() argument
678 char *(*prompt_constructor) (UI *ui, in UI_method_set_prompt_constructor()
861 int UI_set_result(UI *ui, UI_STRING *uis, const char *result) in UI_set_result() argument
863 return UI_set_result_ex(ui, uis, result, strlen(result)); in UI_set_result()
866 int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len) in UI_set_result_ex() argument
868 ui->flags &= ~UI_FLAG_REDOABLE; in UI_set_result_ex()
874 ui->flags |= UI_FLAG_REDOABLE; in UI_set_result_ex()
882 ui->flags |= UI_FLAG_REDOABLE; in UI_set_result_ex()