OLD | NEW |
1 /* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ | 1 /* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ |
2 /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | 2 /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL |
3 * project 2001. | 3 * project 2001. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 has been given, after which the reader only grabs the given data and puts | 280 has been given, after which the reader only grabs the given data and puts |
281 them back into the UI strings. | 281 them back into the UI strings. |
282 | 282 |
283 All method functions take a UI as argument. Additionally, the writer and | 283 All method functions take a UI as argument. Additionally, the writer and |
284 the reader take a UI_STRING. | 284 the reader take a UI_STRING. |
285 */ | 285 */ |
286 | 286 |
287 /* The UI_STRING type is the data structure that contains all the needed info | 287 /* The UI_STRING type is the data structure that contains all the needed info |
288 about a string or a prompt, including test data for a verification prompt. | 288 about a string or a prompt, including test data for a verification prompt. |
289 */ | 289 */ |
| 290 typedef struct ui_string_st UI_STRING; |
290 DECLARE_STACK_OF(UI_STRING) | 291 DECLARE_STACK_OF(UI_STRING) |
291 typedef struct ui_string_st UI_STRING; | |
292 | 292 |
293 /* The different types of strings that are currently supported. | 293 /* The different types of strings that are currently supported. |
294 This is only needed by method authors. */ | 294 This is only needed by method authors. */ |
295 enum UI_string_types | 295 enum UI_string_types |
296 { | 296 { |
297 UIT_NONE=0, | 297 UIT_NONE=0, |
298 UIT_PROMPT, /* Prompt for a string */ | 298 UIT_PROMPT, /* Prompt for a string */ |
299 UIT_VERIFY, /* Prompt for a string and verify */ | 299 UIT_VERIFY, /* Prompt for a string and verify */ |
300 UIT_BOOLEAN, /* Prompt for a yes/no response */ | 300 UIT_BOOLEAN, /* Prompt for a yes/no response */ |
301 UIT_INFO, /* Send info to the user */ | 301 UIT_INFO, /* Send info to the user */ |
302 UIT_ERROR /* Send an error message to the user */ | 302 UIT_ERROR /* Send an error message to the user */ |
303 }; | 303 }; |
304 | 304 |
305 /* Create and manipulate methods */ | 305 /* Create and manipulate methods */ |
306 UI_METHOD *UI_create_method(char *name); | 306 UI_METHOD *UI_create_method(char *name); |
307 void UI_destroy_method(UI_METHOD *ui_method); | 307 void UI_destroy_method(UI_METHOD *ui_method); |
308 int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)); | 308 int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)); |
309 int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis
)); | 309 int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis
)); |
310 int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); | 310 int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); |
311 int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis
)); | 311 int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis
)); |
312 int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); | 312 int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); |
| 313 int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_construct
or)(UI* ui, const char* object_desc, const char* object_name)); |
313 int (*UI_method_get_opener(UI_METHOD *method))(UI*); | 314 int (*UI_method_get_opener(UI_METHOD *method))(UI*); |
314 int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); | 315 int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); |
315 int (*UI_method_get_flusher(UI_METHOD *method))(UI*); | 316 int (*UI_method_get_flusher(UI_METHOD *method))(UI*); |
316 int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); | 317 int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); |
317 int (*UI_method_get_closer(UI_METHOD *method))(UI*); | 318 int (*UI_method_get_closer(UI_METHOD *method))(UI*); |
| 319 char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, c
onst char*); |
318 | 320 |
319 /* The following functions are helpers for method writers to access relevant | 321 /* The following functions are helpers for method writers to access relevant |
320 data from a UI_STRING. */ | 322 data from a UI_STRING. */ |
321 | 323 |
322 /* Return type of the UI_STRING */ | 324 /* Return type of the UI_STRING */ |
323 enum UI_string_types UI_get_string_type(UI_STRING *uis); | 325 enum UI_string_types UI_get_string_type(UI_STRING *uis); |
324 /* Return input flags of the UI_STRING */ | 326 /* Return input flags of the UI_STRING */ |
325 int UI_get_input_flags(UI_STRING *uis); | 327 int UI_get_input_flags(UI_STRING *uis); |
326 /* Return the actual string to output (the prompt, info or error) */ | 328 /* Return the actual string to output (the prompt, info or error) */ |
327 const char *UI_get0_output_string(UI_STRING *uis); | 329 const char *UI_get0_output_string(UI_STRING *uis); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 #define UI_R_INDEX_TOO_SMALL 103 | 374 #define UI_R_INDEX_TOO_SMALL 103 |
373 #define UI_R_NO_RESULT_BUFFER 105 | 375 #define UI_R_NO_RESULT_BUFFER 105 |
374 #define UI_R_RESULT_TOO_LARGE 100 | 376 #define UI_R_RESULT_TOO_LARGE 100 |
375 #define UI_R_RESULT_TOO_SMALL 101 | 377 #define UI_R_RESULT_TOO_SMALL 101 |
376 #define UI_R_UNKNOWN_CONTROL_COMMAND 106 | 378 #define UI_R_UNKNOWN_CONTROL_COMMAND 106 |
377 | 379 |
378 #ifdef __cplusplus | 380 #ifdef __cplusplus |
379 } | 381 } |
380 #endif | 382 #endif |
381 #endif | 383 #endif |
OLD | NEW |