Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

ctapi.h

Go to the documentation of this file.
00001 /*
00002     Simple Operating System for Smartcard Education
00003     Copyright (C) 2002  Matthias Bruestle <m@mbsks.franken.de>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00026 #ifndef H_CTAPI
00027 #define H_CTAPI
00028 
00029 #include <types.h>
00030 
00031 #define CTAPI_AD_ICC1           0
00032 #define CTAPI_AD_CT             1
00033 #define CTAPI_AD_HOST           2
00034 
00035 #define CTAPI_RV_OK                0
00036 #define CTAPI_RV_ERR_INVALID      -1
00037 #define CTAPI_RV_ERR_CT           -8
00038 #define CTAPI_RV_ERR_TRANS       -10
00039 #define CTAPI_RV_ERR_MEMORY      -11
00040 #define CTAPI_RV_ERR_HOST       -127
00041 #define CTAPI_RV_ERR_HTSI       -128
00042 
00043 #define CTAPI_PORT              1
00044 
00045 #define CTAPI_CLA               0x20
00046 #define CTAPI_INS_RESET_CT      0x11
00047 #define CTAPI_INS_REQUEST_ICC   0x12
00048 #define CTAPI_INS_GET_STATUS    0x13
00049 #define CTAPI_INS_EJECT_ICC     0x14
00050 #define CTAPI_INS_EEPROM        0xE0
00051 
00052 typedef unsigned char   IU8;
00053 typedef signed char     IS8;
00054 typedef unsigned short  IU16;
00055 typedef signed short    IS16;
00056 typedef unsigned long   IU32;
00057 typedef signed long     IS32;
00058 
00059 extern int      fd_fromCard[2], fd_toCard[2];
00060 extern int      loadEepromFile;
00061 extern int      saveEepromFile;
00062 extern char     eepromFile[256];
00063 extern int      fdEepromFile;
00064 
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif /* __cplusplus */
00068 
00069 IS8 CT_forkIcc( void );
00070 IS8 CT_stopIcc( void );
00071 IS8 CT_ifdCmdEepromFile( IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response );
00072 
00073 IS8 CT_ifdCmdResetCT( IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response );
00074 IS8 CT_ifdCmdRequestICC( IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response );
00075 IS8 CT_ifdCmdGetStatus( IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response );
00076 IS8 CT_ifdCmdEjectICC( IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response );
00077 IS8 CT_ifdCmd( IU16 lenc, IU8 *command, IU16 *lenr, IU8 *response );
00078 IS8 CT_iccCmd( IU8 *dad, IU8 *sad, IU16 lenc, IU8 *command,
00079     IU16 *lenr, IU8 *response );
00080 IS8 CT_init( IU16 ctn, IU16 pn );
00081 IS8 CT_data( IU16 ctn, IU8 *dad, IU8 *sad, IU16 lenc, IU8 *command,
00082     IU16 *lenr, IU8 *response );
00083 IS8 CT_close( IU16 ctn );
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif /* __cplusplus */
00088 #endif /* H_CTAPI */
00089 

Copyright 2002 by Matthias Bruestle. This is licensed under the GNU General Public License.