Lines Matching defs:ui

1 /* crypto/ui/ui_lib.c */
64 #include <openssl/ui.h>
115 void UI_free(UI *ui)
117 if (ui == NULL)
119 sk_UI_STRING_pop_free(ui->strings, free_string);
120 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data);
121 OPENSSL_free(ui);
124 static int allocate_string_stack(UI *ui)
126 if (ui->strings == NULL) {
127 ui->strings = sk_UI_STRING_new_null();
128 if (ui->strings == NULL) {
135 static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt,
157 static int general_allocate_string(UI *ui, const char *prompt,
164 UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
168 if (allocate_string_stack(ui) >= 0) {
172 ret = sk_UI_STRING_push(ui->strings, s);
182 static int general_allocate_boolean(UI *ui,
207 s = general_allocate_prompt(ui, prompt, prompt_freeable,
211 if (allocate_string_stack(ui) >= 0) {
215 ret = sk_UI_STRING_push(ui->strings, s);
232 int UI_add_input_string(UI *ui, const char *prompt, int flags,
235 return general_allocate_string(ui, prompt, 0,
241 int UI_dup_input_string(UI *ui, const char *prompt, int flags,
254 return general_allocate_string(ui, prompt_copy, 1,
259 int UI_add_verify_string(UI *ui, const char *prompt, int flags,
263 return general_allocate_string(ui, prompt, 0,
268 int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
282 return general_allocate_string(ui, prompt_copy, 1,
287 int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
291 return general_allocate_boolean(ui, prompt, action_desc,
296 int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
337 return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
352 int UI_add_info_string(UI *ui, const char *text)
354 return general_allocate_string(ui, text, 0, UIT_INFO, 0, NULL, 0, 0,
358 int UI_dup_info_string(UI *ui, const char *text)
370 return general_allocate_string(ui, text_copy, 1, UIT_INFO, 0, NULL,
374 int UI_add_error_string(UI *ui, const char *text)
376 return general_allocate_string(ui, text, 0, UIT_ERROR, 0, NULL, 0, 0,
380 int UI_dup_error_string(UI *ui, const char *text)
391 return general_allocate_string(ui, text_copy, 1, UIT_ERROR, 0, NULL,
395 char *UI_construct_prompt(UI *ui, const char *object_desc,
400 if (ui->meth->ui_construct_prompt)
401 prompt = ui->meth->ui_construct_prompt(ui, object_desc, object_name);
427 void *UI_add_user_data(UI *ui, void *user_data)
429 void *old_data = ui->user_data;
430 ui->user_data = user_data;
434 void *UI_get0_user_data(UI *ui)
436 return ui->user_data;
439 const char *UI_get0_result(UI *ui, int i)
445 if (i >= sk_UI_STRING_num(ui->strings)) {
449 return UI_get0_result_string(sk_UI_STRING_value(ui->strings, i));
452 static int print_error(const char *str, size_t len, UI *ui)
460 if (ui->meth->ui_write_string && !ui->meth->ui_write_string(ui, &uis))
465 int UI_process(UI *ui)
469 if (ui->meth->ui_open_session && !ui->meth->ui_open_session(ui))
472 if (ui->flags & UI_FLAG_PRINT_ERRORS)
474 print_error, (void *)ui);
476 for (i = 0; i < sk_UI_STRING_num(ui->strings); i++) {
477 if (ui->meth->ui_write_string
478 && !ui->meth->ui_write_string(ui,
479 sk_UI_STRING_value(ui->strings, i)))
486 if (ui->meth->ui_flush)
487 switch (ui->meth->ui_flush(ui)) {
499 for (i = 0; i < sk_UI_STRING_num(ui->strings); i++) {
500 if (ui->meth->ui_read_string) {
501 switch (ui->meth->ui_read_string(ui,
502 sk_UI_STRING_value(ui->strings,
517 if (ui->meth->ui_close_session && !ui->meth->ui_close_session(ui))
522 int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void))
524 if (ui == NULL) {
531 int save_flag = ! !(ui->flags & UI_FLAG_PRINT_ERRORS);
533 ui->flags |= UI_FLAG_PRINT_ERRORS;
535 ui->flags &= ~UI_FLAG_PRINT_ERRORS;
539 return ! !(ui->flags & UI_FLAG_REDOABLE);
577 const UI_METHOD *UI_get_method(UI *ui)
579 return ui->meth;
582 const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth)
584 ui->meth = meth;
585 return ui->meth;
611 int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui))
621 int (*writer) (UI *ui, UI_STRING *uis))
630 int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui))
640 int (*reader) (UI *ui, UI_STRING *uis))
649 int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui))
659 char *(*prompt_constructor) (UI *ui,
801 int UI_set_result(UI *ui, UI_STRING *uis, const char *result)
805 ui->flags &= ~UI_FLAG_REDOABLE;
822 ui->flags |= UI_FLAG_REDOABLE;
829 ui->flags |= UI_FLAG_REDOABLE;