Eneboo - Documentación para desarrolladores
src/libdigidoc/openssl/crypto/ui/ui_locl.h
Ir a la documentación de este archivo.
00001 /* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */
00002 /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
00003  * project 2001.
00004  */
00005 /* ====================================================================
00006  * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. All advertising materials mentioning features or use of this
00021  *    software must display the following acknowledgment:
00022  *    "This product includes software developed by the OpenSSL Project
00023  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
00024  *
00025  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00026  *    endorse or promote products derived from this software without
00027  *    prior written permission. For written permission, please contact
00028  *    openssl-core@openssl.org.
00029  *
00030  * 5. Products derived from this software may not be called "OpenSSL"
00031  *    nor may "OpenSSL" appear in their names without prior written
00032  *    permission of the OpenSSL Project.
00033  *
00034  * 6. Redistributions of any form whatsoever must retain the following
00035  *    acknowledgment:
00036  *    "This product includes software developed by the OpenSSL Project
00037  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00040  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00042  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00043  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00044  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00045  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00046  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00047  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00048  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00049  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00050  * OF THE POSSIBILITY OF SUCH DAMAGE.
00051  * ====================================================================
00052  *
00053  * This product includes cryptographic software written by Eric Young
00054  * (eay@cryptsoft.com).  This product includes software written by Tim
00055  * Hudson (tjh@cryptsoft.com).
00056  *
00057  */
00058 
00059 #ifndef HEADER_UI_LOCL_H
00060 #define HEADER_UI_LOCL_H
00061 
00062 #include <openssl/ui.h>
00063 #include <openssl/crypto.h>
00064 
00065 #ifdef _
00066 #undef _
00067 #endif
00068 
00069 struct ui_method_st
00070         {
00071         char *name;
00072 
00073         /* All the functions return 1 or non-NULL for success and 0 or NULL
00074            for failure */
00075 
00076         /* Open whatever channel for this, be it the console, an X window
00077            or whatever.
00078            This function should use the ex_data structure to save
00079            intermediate data. */
00080         int (*ui_open_session)(UI *ui);
00081 
00082         int (*ui_write_string)(UI *ui, UI_STRING *uis);
00083 
00084         /* Flush the output.  If a GUI dialog box is used, this function can
00085            be used to actually display it. */
00086         int (*ui_flush)(UI *ui);
00087 
00088         int (*ui_read_string)(UI *ui, UI_STRING *uis);
00089 
00090         int (*ui_close_session)(UI *ui);
00091 
00092         /* Construct a prompt in a user-defined manner.  object_desc is a
00093            textual short description of the object, for example "pass phrase",
00094            and object_name is the name of the object (might be a card name or
00095            a file name.
00096            The returned string shall always be allocated on the heap with
00097            OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). */
00098         char *(*ui_construct_prompt)(UI *ui, const char *object_desc,
00099                 const char *object_name);
00100         };
00101 
00102 struct ui_string_st
00103         {
00104         enum UI_string_types type; /* Input */
00105         const char *out_string; /* Input */
00106         int input_flags;        /* Flags from the user */
00107 
00108         /* The following parameters are completely irrelevant for UIT_INFO,
00109            and can therefore be set to 0 or NULL */
00110         char *result_buf;       /* Input and Output: If not NULL, user-defined
00111                                    with size in result_maxsize.  Otherwise, it
00112                                    may be allocated by the UI routine, meaning
00113                                    result_minsize is going to be overwritten.*/
00114         union
00115                 {
00116                 struct
00117                         {
00118                         int result_minsize;     /* Input: minimum required
00119                                                    size of the result.
00120                                                 */
00121                         int result_maxsize;     /* Input: maximum permitted
00122                                                    size of the result */
00123 
00124                         const char *test_buf;   /* Input: test string to verify
00125                                                    against */
00126                         } string_data;
00127                 struct
00128                         {
00129                         const char *action_desc; /* Input */
00130                         const char *ok_chars; /* Input */
00131                         const char *cancel_chars; /* Input */
00132                         } boolean_data;
00133                 } _;
00134 
00135 #define OUT_STRING_FREEABLE 0x01
00136         int flags;              /* flags for internal use */
00137         };
00138 
00139 struct ui_st
00140         {
00141         const UI_METHOD *meth;
00142         STACK_OF(UI_STRING) *strings; /* We might want to prompt for more
00143                                          than one thing at a time, and
00144                                          with different echoing status.  */
00145         void *user_data;
00146         CRYPTO_EX_DATA ex_data;
00147 
00148 #define UI_FLAG_REDOABLE        0x0001
00149 #define UI_FLAG_PRINT_ERRORS    0x0100
00150         int flags;
00151         };
00152 
00153 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'