Home | History | Annotate | Download | only in ui

Lines Matching refs:UI

1 /* crypto/ui/ui_lib.c -*- mode:C; c-file-style: "eay" -*- */
63 #include <openssl/ui.h>
71 UI *UI_new(void)
76 UI *UI_new_method(const UI_METHOD *method)
78 UI *ret;
80 ret=(UI *)OPENSSL_malloc(sizeof(UI));
117 void UI_free(UI *ui)
119 if (ui == NULL)
121 sk_UI_STRING_pop_free(ui->strings,free_string);
122 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data);
123 OPENSSL_free(ui);
126 static int allocate_string_stack(UI *ui)
128 if (ui->strings == NULL)
130 ui->strings=sk_UI_STRING_new_null();
131 if (ui->strings == NULL)
139 static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt,
165 static int general_allocate_string(UI *ui, const char *prompt,
170 UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
175 if (allocate_string_stack(ui) >= 0)
180 ret=sk_UI_STRING_push(ui->strings, s);
190 static int general_allocate_boolean(UI *ui,
219 s = general_allocate_prompt(ui, prompt, prompt_freeable,
224 if (allocate_string_stack(ui) >= 0)
229 ret=sk_UI_STRING_push(ui->strings, s);
243 int UI_add_input_string(UI *ui, const char *prompt, int flags,
246 return general_allocate_string(ui, prompt, 0,
251 int UI_dup_input_string(UI *ui, const char *prompt, int flags,
266 return general_allocate_string(ui, prompt_copy, 1,
270 int UI_add_verify_string(UI *ui, const char *prompt, int flags,
273 return general_allocate_string(ui, prompt, 0,
277 int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
292 return general_allocate_string(ui, prompt_copy, 1,
296 int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
300 return general_allocate_boolean(ui, prompt, action_desc,
304 int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
353 return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
364 int UI_add_info_string(UI *ui, const char *text)
366 return general_allocate_string(ui, text, 0, UIT_INFO, 0, NULL, 0, 0,
370 int UI_dup_info_string(UI *ui, const char *text)
384 return general_allocate_string(ui, text_copy, 1, UIT_INFO, 0, NULL,
388 int UI_add_error_string(UI *ui, const char *text)
390 return general_allocate_string(ui, text, 0, UIT_ERROR, 0, NULL, 0, 0,
394 int UI_dup_error_string(UI *ui, const char *text)
407 return general_allocate_string(ui, text_copy, 1, UIT_ERROR, 0, NULL,
411 char *UI_construct_prompt(UI *ui, const char *object_desc,
416 if (ui->meth->ui_construct_prompt)
417 prompt = ui->meth->ui_construct_prompt(ui,
446 void *UI_add_user_data(UI *ui, void *user_data)
448 void *old_data = ui->user_data;
449 ui->user_data = user_data;
453 void *UI_get0_user_data(UI *ui)
455 return ui->user_data;
458 const char *UI_get0_result(UI *ui, int i)
465 if (i >= sk_UI_STRING_num(ui->strings))
470 return UI_get0_result_string(sk_UI_STRING_value(ui->strings, i));
473 static int print_error(const char *str, size_t len, UI *ui)
481 if (ui->meth->ui_write_string
482 && !ui->meth->ui_write_string(ui, &uis))
487 int UI_process(UI *ui)
491 if (ui->meth->ui_open_session && !ui->meth->ui_open_session(ui))
494 if (ui->flags & UI_FLAG_PRINT_ERRORS)
497 (void *)ui);
499 for(i=0; i<sk_UI_STRING_num(ui->strings); i++)
501 if (ui->meth->ui_write_string
502 && !ui->meth->ui_write_string(ui,
503 sk_UI_STRING_value(ui->strings, i)))
510 if (ui->meth->ui_flush)
511 switch(ui->meth->ui_flush(ui))
524 for(i=0; i<sk_UI_STRING_num(ui->strings); i++)
526 if (ui->meth->ui_read_string)
528 switch(ui->meth->ui_read_string(ui,
529 sk_UI_STRING_value(ui->strings, i)))
544 if (ui->meth->ui_close_session && !ui->meth->ui_close_session(ui))
549 int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void))
551 if (ui == NULL)
560 int save_flag = !!(ui->flags & UI_FLAG_PRINT_ERRORS);
562 ui->flags |= UI_FLAG_PRINT_ERRORS;
564 ui->flags &= ~UI_FLAG_PRINT_ERRORS;
568 return !!(ui->flags & UI_FLAG_REDOABLE);
583 int UI_set_ex_data(UI *r, int idx, void *arg)
588 void *UI_get_ex_data(UI *r, int idx)
607 const UI_METHOD *UI_get_method(UI *ui)
609 return ui->meth;
612 const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth)
614 ui->meth=meth;
615 return ui->meth;
641 int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui))
652 int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis))
663 int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui))
674 int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis))
685 int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui))
696 int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor)(UI* ui, const char* object_desc, const char* object_name))
707 int (*UI_method_get_opener(UI_METHOD *method))(UI*)
715 int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*)
723 int (*UI_method_get_flusher(UI_METHOD *method))(UI*)
731 int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*)
739 int (*UI_method_get_closer(UI_METHOD *method))(UI*)
747 char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*)
845 int UI_set_result(UI *ui, UI_STRING *uis, const char *result)
849 ui->flags &= ~UI_FLAG_REDOABLE;
868 ui->flags |= UI_FLAG_REDOABLE;
876 ui->flags |= UI_FLAG_REDOABLE;