# error.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: error.h,v $
    00003                              -------------------
    00004     cvs         : $Id: error.h,v 1.14 2005/04/30 07:54:55 aquamaniac Exp $
    00005     begin       : Tue Oct 02 2002
    00006     copyright   : (C) 2002 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00033 #ifndef GWENHYWFAR_ERROR_H
    00034 #define GWENHYWFAR_ERROR_H
    00035
    00036 #include <gwenhywfar/gwenhywfarapi.h>
    00037 #include <gwenhywfar/types.h>
    00038
    00039
    00057
    00058 /*
    00059  * Allow this to be used from C and C++
    00060  */
    00061 #ifdef __cplusplus
    00062 extern "C" {
    00063 #endif
    00064
    00069 #define GWEN_SUCCESS 0
    00070 /* generic errors */
    00071 #define GWEN_ERROR_GENERIC              (-1)
    00072 #define GWEN_ERROR_ABORTED              (-2)
    00073 #define GWEN_ERROR_NOT_AVAILABLE        (-3)
    00074 #define GWEN_ERROR_USER_ABORTED         (-4)
    00075 #define GWEN_ERROR_OPEN                 (-5)
    00076 #define GWEN_ERROR_INVALID              (-6)
    00077 /* socket errors */
    00078 #define GWEN_ERROR_BAD_SOCKETTYPE       (-32)
    00079 #define GWEN_ERROR_NOT_OPEN             (-33)
    00080 #define GWEN_ERROR_TIMEOUT              (-34)
    00081 #define GWEN_ERROR_IN_PROGRESS          (-35)
    00082 #define GWEN_ERROR_STARTUP              (-36)
    00083 #define GWEN_ERROR_INTERRUPTED          (-37)
    00084 #define GWEN_ERROR_UNSUPPORTED          (-38)
    00085 #define GWEN_ERROR_BROKEN_PIPE          (-39)
    00086 /* inet address errors */
    00087 #define GWEN_ERROR_MEMORY_FULL          (-40)
    00088 #define GWEN_ERROR_BAD_ADDRESS          (-41)
    00089 #define GWEN_ERROR_BUFFER_OVERFLOW      (-42)
    00090 #define GWEN_ERROR_HOST_NOT_FOUND       (-43)
    00091 #define GWEN_ERROR_NO_ADDRESS           (-44)
    00092 #define GWEN_ERROR_NO_RECOVERY          (-45)
    00093 #define GWEN_ERROR_TRY_AGAIN            (-46)
    00094 #define GWEN_ERROR_UNKNOWN_DNS_ERROR    (-47)
    00095 #define GWEN_ERROR_BAD_ADDRESS_FAMILY   (-48)
    00096 /* libloader errors */
    00097 #define GWEN_ERROR_COULD_NOT_LOAD       (-49)
    00098 #define GWEN_ERROR_COULD_NOT_RESOLVE    (-50)
    00099 #define GWEN_ERROR_NOT_FOUND            (-51)
    00100 /* buffered IO errors */
    00101 #define GWEN_ERROR_READ                 (-52)
    00102 #define GWEN_ERROR_WRITE                (-53)
    00103 #define GWEN_ERROR_CLOSE                (-54)
    00104 #define GWEN_ERROR_NO_DATA              (-55)
    00105 #define GWEN_ERROR_PARTIAL              (-56)
    00106 #define GWEN_ERROR_EOF                  (-57)
    00107 /* crypt errors */
    00108 #define GWEN_ERROR_ALREADY_REGISTERED   (-58)
    00109 #define GWEN_ERROR_NOT_REGISTERED       (-59)
    00110 #define GWEN_ERROR_BAD_SIZE             (-60)
    00111 #define GWEN_ERROR_ENCRYPT              (-62)
    00112 #define GWEN_ERROR_DECRYPT              (-63)
    00113 #define GWEN_ERROR_SIGN                 (-64)
    00114 #define GWEN_ERROR_VERIFY               (-65)
    00115 #define GWEN_ERROR_SSL                  (-66)
    00116
    00117 /* crypt token errors */
    00118 #define GWEN_ERROR_CT_NOT_IMPLEMENTED   (-67)
    00119 #define GWEN_ERROR_CT_NOT_SUPPORTED     (-68)
    00120 #define GWEN_ERROR_CT_BAD_NAME          (-69)
    00121 #define GWEN_ERROR_CT_IO_ERROR          (-70)
    00122
    00139 typedef GWEN_TYPE_UINT32 GWEN_ERRORCODE;
    00140
    00141 typedef struct GWEN_ERRORTYPEREGISTRATIONFORM
    00142   GWEN_ERRORTYPEREGISTRATIONFORM;
    00143
    00150 typedef const char* (*GWEN_ERRORMESSAGEPTR)(int c);
    00151
    00152
    00153 GWENHYWFAR_API
    00154 int GWEN_ErrorType_GetType(GWEN_ERRORTYPEREGISTRATIONFORM *f);
    00155
    00156
    00160 #define GWEN_ERROR_SEVERITY_DEBUG   0
    00161
    00164 #define GWEN_ERROR_SEVERITY_INFO    1
    00165
    00168 #define GWEN_ERROR_SEVERITY_WARN 2
    00169
    00172 #define GWEN_ERROR_SEVERITY_ERR   3
    00173
    00177 #define GWEN_ERROR_TYPE_ERROR 0
    00178
    00179 #define GWEN_ERROR_UNSPECIFIED          1
    00180 #define GWEN_ERROR_COULD_NOT_REGISTER   2
    00181 #define GWEN_ERROR_COULD_NOT_UNREGISTER 3
    00182 #define GWEN_ERROR_INVALID_BUFFERSIZE   4
    00183
    00184
    00189
    00190 GWENHYWFAR_API
    00191 GWEN_ERRORTYPEREGISTRATIONFORM *GWEN_ErrorType_new();
    00192
    00193 GWENHYWFAR_API
    00194 void GWEN_ErrorType_free(GWEN_ERRORTYPEREGISTRATIONFORM *f);
    00195
    00196 GWENHYWFAR_API
    00197 void GWEN_ErrorType_SetType(GWEN_ERRORTYPEREGISTRATIONFORM *f, int c);
    00198
    00199 GWENHYWFAR_API
    00200 void GWEN_ErrorType_SetName(GWEN_ERRORTYPEREGISTRATIONFORM *f,
    00201                             const char *name);
    00202
    00203 GWENHYWFAR_API
    00204 void GWEN_ErrorType_SetMsgPtr(GWEN_ERRORTYPEREGISTRATIONFORM *f,
    00205                               GWEN_ERRORMESSAGEPTR msgptr);
    00206
    00207 GWENHYWFAR_API
    00208 GWEN_ERRORMESSAGEPTR
    00209   GWEN_ErrorType_GetMsgPtr(GWEN_ERRORTYPEREGISTRATIONFORM *f);
    00223
    00229 GWENHYWFAR_API
    00230   GWEN_ERRORCODE GWEN_Error_RegisterType(GWEN_ERRORTYPEREGISTRATIONFORM *tptr);
    00231
    00237 GWENHYWFAR_API
    00238   GWEN_ERRORCODE GWEN_Error_UnregisterType(GWEN_ERRORTYPEREGISTRATIONFORM *tptr);
    00247
    00252 GWENHYWFAR_API int GWEN_Error_FindType(const char *name);
    00253
    00260 GWENHYWFAR_API const char *GWEN_Error_GetTypename(int t);
    00283 GWENHYWFAR_API GWEN_ERRORCODE GWEN_Error_new(int iscustom, int severity,
    00284                                              int typ, int code);
    00285
    00291 GWENHYWFAR_API int GWEN_Error_IsOk(GWEN_ERRORCODE c);
    00292
    00296 GWENHYWFAR_API int GWEN_Error_GetSeverity(GWEN_ERRORCODE c);
    00297
    00301 GWENHYWFAR_API void GWEN_Error_SetSeverity(GWEN_ERRORCODE *c, int v);
    00302
    00309 GWENHYWFAR_API int GWEN_Error_IsCustom(GWEN_ERRORCODE c);
    00310
    00314 GWENHYWFAR_API void GWEN_Error_SetIsCustom(GWEN_ERRORCODE *c, int iscustom);
    00315
    00319 GWENHYWFAR_API int GWEN_Error_GetType(GWEN_ERRORCODE c);
    00320
    00324 GWENHYWFAR_API void GWEN_Error_SetType(GWEN_ERRORCODE *c, int v);
    00325
    00329 GWENHYWFAR_API int GWEN_Error_GetCode(GWEN_ERRORCODE c);
    00330
    00334 GWENHYWFAR_API void GWEN_Error_SetCode(GWEN_ERRORCODE *c, int v);
    00353 GWENHYWFAR_API int GWEN_Error_ToString(GWEN_ERRORCODE c,
    00354                                        char *buffer,
    00355                                        int bsize);
    00367 GWENHYWFAR_API int GWEN_Error_GetSimpleCode(GWEN_ERRORCODE c);
    00368
    00369
    00372 #ifdef __cplusplus
    00373 }
    00374 #endif
    00375
    00379 #endif /* MOD_ERROR_H */
    00380
    00381