chipcard3.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003                              -------------------
00004     cvs         : $Id: chipcard3.h.in 388 2007-05-02 19:24:12Z christian $
00005     begin       : Tue Dec 23 2003
00006     copyright   : (C) 2003 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *          Please see toplevel file COPYING for license details           *
00011  ***************************************************************************/
00012 
00013 
00014 #ifndef CHIPCARD_CHIPCARD3_H
00015 #define CHIPCARD_CHIPCARD3_H
00016 
00017 #define CHIPCARD_SYS_IS_WINDOWS 0
00018 
00019 
00020 #ifdef BUILDING_CHIPCARD
00021   /* building Gwenhywfar */
00022 # if CHIPCARD_SYS_IS_WINDOWS
00023     /* for windows */
00024 #   ifdef __declspec
00025 #     define CHIPCARD_API __declspec (dllexport)
00026 #   else /* if __declspec */
00027 #     define CHIPCARD_API
00028 #   endif /* if NOT __declspec */
00029 # else
00030     /* for non-win32 */
00031 #   ifdef GCC_WITH_VISIBILITY_ATTRIBUTE
00032 #     define CHIPCARD_API __attribute__((visibility("default")))
00033 #   else
00034 #     define CHIPCARD_API
00035 #   endif
00036 # endif
00037 #else
00038   /* not building Gwenhywfar */
00039 # if CHIPCARD_SYS_IS_WINDOWS
00040     /* for windows */
00041 #   ifdef __declspec
00042 #     define CHIPCARD_API __declspec (dllimport)
00043 #   else /* if __declspec */
00044 #     define CHIPCARD_API
00045 #   endif /* if NOT __declspec */
00046 # else
00047     /* for non-win32 */
00048 #   define CHIPCARD_API
00049 # endif
00050 #endif
00051 
00052 
00053 #if CHIPCARD_SYS_IS_WINDOWS
00054 # define CHIPCARD_CB __stdcall
00055 #else
00056 # define CHIPCARD_CB
00057 #endif
00058 
00059 
00060 #ifdef GCC_WITH_VISIBILITY_ATTRIBUTE
00061 # define CHIPCARD_EXPORT __attribute__((visibility("default")))
00062 # define CHIPCARD_NOEXPORT __attribute__((visibility("hidden")))
00063 #else
00064 # define CHIPCARD_EXPORT
00065 # define CHIPCARD_NOEXPORT
00066 #endif
00067 
00068 
00069 #ifndef CHIPCARD_NOWARN_DEPRECATED
00070 # ifdef __GNUC__
00071 #  define CHIPCARD_DEPRECATED __attribute((__deprecated__))
00072 # else
00073 #  define CHIPCARD_DEPRECATED
00074 # endif
00075 # else
00076 #  define CHIPCARD_DEPRECATED
00077 #endif
00078 
00079 #include <gwenhywfar/db.h>
00080 #include <gwenhywfar/xml.h>
00081 
00082 
00083 #define LC_DEFAULT_PORT 7392 /* FIXME: make this adjustable by configure */
00084 #define LC_DEFAULT_UDS_SOCK "/var/run/chipcard3.sock"
00085 
00088 #define LC_ERROR_NONE                  0x00000000
00089 #define LC_ERROR_GENERIC               0x00000001
00090 #define LC_ERROR_INVALID               0x00000002
00091 #define LC_ERROR_CARD_REMOVED          0x00000003
00092 #define LC_ERROR_CARD_NOT_OWNED        0x00000004
00093 #define LC_ERROR_NOT_SUPPORTED         0x00000005
00094 #define LC_ERROR_SETUP                 0x00000006
00095 #define LC_ERROR_NO_DATA               0x00000007
00096 #define LC_ERROR_LOCKED_BY_OTHER       0x00000008
00097 #define LC_ERROR_NOT_LOCKED            0x00000009
00098 
00099 #define LC_ERROR_BAD_RESPONSE          0x0000000a
00100 #define LC_ERROR_NO_SLOTS_CONNECTED    0x0000000b
00101 #define LC_ERROR_NO_SLOTS_DISCONNECTED 0x0000000c
00102 #define LC_ERROR_NO_SLOTS_AVAILABLE    0x0000000d
00103 #define LC_ERROR_BAD_PIN               0x0000000e
00104 #define LC_ERROR_USER_ABORTED          0x0000000f
00105 #define LC_ERROR_CARD_DESTROYED        0x00000010
00106 #define LC_ERROR_READER_REMOVED        0x00000011
00107 #define LC_ERROR_TIMEOUT               0x00000012
00108 #define LC_ERROR_IPC                   0x00000013
00109 
00110 const char *LC_Error_toString(GWEN_TYPE_UINT32 err);
00111 
00112 
00113 #define LC_LOGDOMAIN "ccclient"
00114 
00117 #define LC_READER_FLAGS_KEYPAD            0x00010000
00118 #define LC_READER_FLAGS_DISPLAY           0x00020000
00119 #define LC_READER_FLAGS_NOINFO            0x00040000
00120 #define LC_READER_FLAGS_REMOTE            0x00080000
00121 #define LC_READER_FLAGS_AUTO              0x00100000
00122 #define LC_READER_FLAGS_SUSPENDED_CHECKS  0x00200000
00123 #define LC_READER_FLAGS_DRIVER_HAS_VERIFY 0x00400000
00124 #define LC_READER_FLAGS_KEEP_RUNNING      0x00800000
00125 
00127 CHIPCARD_API
00128 GWEN_TYPE_UINT32 LC_ReaderFlags_fromXml(GWEN_XMLNODE *node, const char *name);
00129 CHIPCARD_API
00130 GWEN_TYPE_UINT32 LC_ReaderFlags_fromDb(GWEN_DB_NODE *db, const char *name);
00131 CHIPCARD_API void LC_ReaderFlags_toDb(GWEN_DB_NODE *db,
00132                                       const char *name,
00133                                       GWEN_TYPE_UINT32 fl);
00134 
00136 #define LC_DRIVER_FLAGS_RUNTIME_MASK  0xffff0000
00137 #define LC_DRIVER_FLAGS_AUTO          0x00010000
00138 #define LC_DRIVER_FLAGS_REMOTE        0x00020000
00139 #define LC_DRIVER_FLAGS_CONFIG        0x00040000
00140 
00141 #define LC_DRIVER_FLAGS_HAS_VERIFY_FN 0x00000001
00142 #define LC_DRIVER_FLAGS_HAS_MODIFY_FN 0x00000002
00143 
00144 CHIPCARD_API
00145 GWEN_TYPE_UINT32 LC_DriverFlags_fromDb(GWEN_DB_NODE *db, const char *name);
00146 
00147 CHIPCARD_API
00148 int LC_DriverFlags_toDb(GWEN_DB_NODE *db,
00149                         const char *name,
00150                         GWEN_TYPE_UINT32 flags);
00151 
00152 
00154 #define LC_SERVICE_FLAGS_RUNTIME_MASK (\
00155     LC_SERVICE_FLAGS_CLIENT \
00156     )
00157 #define LC_SERVICE_FLAGS_CLIENT   0x00000001
00158 #define LC_SERVICE_FLAGS_AUTOLOAD 0x00000002
00159 #define LC_SERVICE_FLAGS_SILENT   0x00000004
00160 
00161 CHIPCARD_API
00162 GWEN_TYPE_UINT32 LC_ServiceFlags_fromDb(GWEN_DB_NODE *db, const char *name);
00163 CHIPCARD_API void LC_ServiceFlags_toDb(GWEN_DB_NODE *db,
00164                                        const char *name,
00165                                        GWEN_TYPE_UINT32 fl);
00166 
00167 
00170 #define LC_NOTIFY_FLAGS_DRIVER_MASK      0x0000003f
00171 #define LC_NOTIFY_FLAGS_DRIVER_START     0x00000001
00172 #define LC_NOTIFY_FLAGS_DRIVER_UP        0x00000002
00173 #define LC_NOTIFY_FLAGS_DRIVER_DOWN      0x00000004
00174 #define LC_NOTIFY_FLAGS_DRIVER_ERROR     0x00000008
00175 #define LC_NOTIFY_FLAGS_DRIVER_ADD       0x00000010
00176 #define LC_NOTIFY_FLAGS_DRIVER_DEL       0x00000020
00177 
00178 #define LC_NOTIFY_FLAGS_READER_MASK      0x00000fc0
00179 #define LC_NOTIFY_FLAGS_READER_START     0x00000040
00180 #define LC_NOTIFY_FLAGS_READER_UP        0x00000080
00181 #define LC_NOTIFY_FLAGS_READER_DOWN      0x00000100
00182 #define LC_NOTIFY_FLAGS_READER_ERROR     0x00000200
00183 #define LC_NOTIFY_FLAGS_READER_ADD       0x00000400
00184 #define LC_NOTIFY_FLAGS_READER_DEL       0x00000800
00185 
00186 #define LC_NOTIFY_FLAGS_SERVICE_MASK     0x0000f000
00187 #define LC_NOTIFY_FLAGS_SERVICE_START    0x00001000
00188 #define LC_NOTIFY_FLAGS_SERVICE_UP       0x00002000
00189 #define LC_NOTIFY_FLAGS_SERVICE_DOWN     0x00004000
00190 #define LC_NOTIFY_FLAGS_SERVICE_ERROR    0x00008000
00191 
00192 #define LC_NOTIFY_FLAGS_CARD_MASK        0x000f0000
00193 #define LC_NOTIFY_FLAGS_CARD_INSERTED    0x00010000
00194 #define LC_NOTIFY_FLAGS_CARD_REMOVED     0x00020000
00195 #define LC_NOTIFY_FLAGS_CARD_RFU1        0x00040000
00196 #define LC_NOTIFY_FLAGS_CARD_RFU2        0x00080000
00197 
00198 #define LC_NOTIFY_FLAGS_CLIENT_MASK      0xfff00000
00199 #define LC_NOTIFY_FLAGS_CLIENT_UP        0x00100000
00200 #define LC_NOTIFY_FLAGS_CLIENT_DOWN      0x00200000
00201 #define LC_NOTIFY_FLAGS_CLIENT_STARTWAIT 0x00400000
00202 #define LC_NOTIFY_FLAGS_CLIENT_STOPWAIT  0x00800000
00203 #define LC_NOTIFY_FLAGS_CLIENT_TAKECARD  0x01000000
00204 #define LC_NOTIFY_FLAGS_CLIENT_GOTCARD   0x02000000
00205 
00206 #define LC_NOTIFY_FLAGS_CLIENT_CMDSEND   0x04000000
00207 #define LC_NOTIFY_FLAGS_CLIENT_CMDRECV   0x08000000
00208 
00209 #define LC_NOTIFY_FLAGS_SINGLESHOT       0x80000000
00210 
00211 #define LC_NOTIFY_FLAGS_PRIVILEGED (\
00212   LC_NOTIFY_FLAGS_CLIENT_CMDSEND |\
00213   LC_NOTIFY_FLAGS_CLIENT_CMDRECV)
00214 
00215 CHIPCARD_API
00216 GWEN_TYPE_UINT32 LC_NotifyFlags_fromDb(GWEN_DB_NODE *db, const char *name);
00217 CHIPCARD_API void LC_NotifyFlags_toDb(GWEN_DB_NODE *db,
00218                                       const char *name,
00219                                       GWEN_TYPE_UINT32 fl);
00220 
00221 
00230 #define LC_NOTIFY_TYPE_DRIVER           "driver"
00231 #define LC_NOTIFY_CODE_DRIVER_START     "start"
00232 #define LC_NOTIFY_CODE_DRIVER_UP        "up"
00233 #define LC_NOTIFY_CODE_DRIVER_DOWN      "down"
00234 #define LC_NOTIFY_CODE_DRIVER_ERROR     "error"
00235 #define LC_NOTIFY_CODE_DRIVER_ADD       "add"
00236 #define LC_NOTIFY_CODE_DRIVER_DEL       "del"
00237 
00238 #define LC_NOTIFY_TYPE_READER           "reader"
00239 #define LC_NOTIFY_CODE_READER_START     "start"
00240 #define LC_NOTIFY_CODE_READER_UP        "up"
00241 #define LC_NOTIFY_CODE_READER_DOWN      "down"
00242 #define LC_NOTIFY_CODE_READER_ERROR     "error"
00243 #define LC_NOTIFY_CODE_READER_ADD       "add"
00244 #define LC_NOTIFY_CODE_READER_DEL       "del"
00245 
00246 #define LC_NOTIFY_TYPE_SERVICE          "service"
00247 #define LC_NOTIFY_CODE_SERVICE_START    "start"
00248 #define LC_NOTIFY_CODE_SERVICE_UP       "up"
00249 #define LC_NOTIFY_CODE_SERVICE_DOWN     "down"
00250 #define LC_NOTIFY_CODE_SERVICE_ERROR    "error"
00251 
00252 #define LC_NOTIFY_TYPE_CARD             "card"
00253 #define LC_NOTIFY_CODE_CARD_INSERTED    "inserted"
00254 #define LC_NOTIFY_CODE_CARD_REMOVED     "removed"
00255 #define LC_NOTIFY_CODE_CARD_RFU1        "rfu1"
00256 #define LC_NOTIFY_CODE_CARD_RFU2        "rfu2"
00257 
00258 #define LC_NOTIFY_TYPE_CLIENT           "client"
00259 #define LC_NOTIFY_CODE_CLIENT_UP        "up"
00260 #define LC_NOTIFY_CODE_CLIENT_DOWN      "down"
00261 #define LC_NOTIFY_CODE_CLIENT_STARTWAIT "startwait"
00262 #define LC_NOTIFY_CODE_CLIENT_STOPWAIT  "stopwait"
00263 #define LC_NOTIFY_CODE_CLIENT_TAKECARD  "takecard"
00264 #define LC_NOTIFY_CODE_CLIENT_GOTCARD   "gotcard"
00265 
00266 #define LC_NOTIFY_CODE_CLIENT_CMDSEND   "cmdsend"
00267 #define LC_NOTIFY_CODE_CLIENT_CMDRECV   "cmdrecv"
00268 
00273 typedef enum {
00274   LC_DriverStatusDown=0,
00275   LC_DriverStatusWaitForStart,
00276   LC_DriverStatusStarted,
00277   LC_DriverStatusUp,
00278   LC_DriverStatusStopping,
00279   LC_DriverStatusAborted,
00280   LC_DriverStatusDisabled,
00281   LC_DriverStatusUnknown=999
00282 } LC_DRIVER_STATUS;
00283 
00284 CHIPCARD_API LC_DRIVER_STATUS LC_DriverStatus_fromString(const char *s);
00285 CHIPCARD_API const char *LC_DriverStatus_toString(LC_DRIVER_STATUS dst);
00286 
00287 
00288 typedef enum {
00289   LC_ReaderStatusDown=0,
00290   LC_ReaderStatusWaitForStart,
00291   LC_ReaderStatusWaitForDriver,
00292   LC_ReaderStatusWaitForReaderUp,
00293   LC_ReaderStatusWaitForReaderDown,
00294   LC_ReaderStatusUp,
00295   LC_ReaderStatusAborted,
00296   LC_ReaderStatusDisabled,
00297   LC_ReaderStatusHwAdd=900,  /* internal status code */
00298   LC_ReaderStatusHwDel=901,  /* internal status code */
00299   LC_ReaderStatusUnknown=999
00300 } LC_READER_STATUS;
00301 
00302 CHIPCARD_API LC_READER_STATUS LC_ReaderStatus_fromString(const char *s);
00303 CHIPCARD_API const char *LC_ReaderStatus_toString(LC_READER_STATUS rst);
00304 
00305 
00306 typedef enum {
00307   LC_ServiceStatusDown=0,
00308   LC_ServiceStatusWaitForStart,
00309   LC_ServiceStatusStarted,
00310   LC_ServiceStatusUp,
00311   LC_ServiceStatusSilentRunning,
00312   LC_ServiceStatusStopping,
00313   LC_ServiceStatusAborted,
00314   LC_ServiceStatusDisabled,
00315   LC_ServiceStatusUnknown=999
00316 } LC_SERVICE_STATUS;
00317 
00318 CHIPCARD_API LC_SERVICE_STATUS LC_ServiceStatus_fromString(const char *s);
00319 CHIPCARD_API const char *LC_ServiceStatus_toString(LC_SERVICE_STATUS st);
00320 
00321 
00322 typedef enum {
00323   LC_CardStatusInserted=0,
00324   LC_CardStatusRemoved,
00325   LC_CardStatusOrphaned,
00326 
00327   LC_CardStatusUnknown=999
00328 } LC_CARD_STATUS;
00329 
00330 
00331 typedef enum {
00332   LC_CardTypeUnknown=0,
00333   LC_CardTypeProcessor,
00334   LC_CardTypeMemory
00335 } LC_CARD_TYPE;
00336 
00337 
00338 #endif /* CHIPCARD_CHIPCARD3_H */

Generated on Sat Sep 22 04:43:21 2007 for libchipcard2 by  doxygen 1.5.3