📄 stm_api.h
字号:
/**********************************************************************************
***********************************************************************************
****
**** File name: stm_api.h
****
**** Comment:
**** include file for STARCOS Library 3.3a
****
**** Revisions:
****
***********************************************************************************
******************** (C) Copyright Giesecke & Devrient 1996 ********************/
#if !defined STM_API_H
#define STM_API_H
/** **************************************************************************** **/
/** Build and OS-System detection **/
/** **************************************************************************** **/
#if defined(_WINDOWS) && !defined(WIN32) /* + WIN 16 bit */
#define STM_OS_WIN16
#if defined(_WINDLL) /* DLL (build) */
#define STM_BUILD_WIN16
#endif
#elif defined(WIN32) /* + WIN 32 bit */
#define STM_OS_WIN32
#if defined(_WINDLL) /* DLL (build) */
#define STM_BUILD_WIN32
#endif
#elif defined(_OS2) /* + OS/2 */
#if defined(_OS2DLL) /* DLL (build) */
#define STM_BUILD_OS216
#else /* call to DLL */
#define STM_OS_OS216
#endif
#elif defined(_UNIX) /* + Unix */
#define STM_OS_UNIX
#define STM_BUILD_UNIX
#else /* + DOS - Lib. */
#define STM_OS_DOS
#define STM_BUILD_DOS
#if defined(__TURBOC__)
#define __cdecl cdecl
#endif
#endif
/** **************************************************************************** **/
/** struct and class member alignment **/
/** **************************************************************************** **/
#if defined(_MSC_VER)
#if defined(STM_OS_WIN32)
#pragma pack(push, old_pack)
#pragma pack(8)
#else
#pragma pack(2)
#endif
#elif defined(__TURBOC__)
#if defined(STM_OS_WIN32)
#pragma option -a8
#else
#pragma option -a2
#endif
#endif
/** **************************************************************************** **/
/** checking memory model **/
/** **************************************************************************** **/
#if defined(STM_OS_WIN16) || defined(STM_OS_DOS)
#if !defined(M_I86LM)
#error memory models different from Large are not supported
#endif
#endif
/** **************************************************************************** **/
/** Global routine export macro STM_API (for avoiding def-files) **/
/** **************************************************************************** **/
#if defined(STM_OS_WIN32)
#if defined(STM_BUILD_WIN32)
#define STM_API1 __declspec(dllexport)
#define STM_API2 __stdcall
#define STM_INT1
#define STM_INT2
#define STM_INT3
#else /* !STM_BUILD_WIN32 */
#define STM_API1
#define STM_API2 __stdcall
#define STM_INT1
#define STM_INT2
#define STM_INT3
#endif
#elif defined(STM_OS_WIN16)
#if defined(STM_BUILD_WIN16)
#define STM_API1
#define STM_API2 __loadds __export __far pascal
#define STM_INT1
#define STM_INT2 __loadds __far
#define STM_INT3 __far
#else /* !STM_BUILD_WIN16 */
#define STM_API1
#define STM_API2 __loadds __far pascal
#define STM_INT1
#define STM_INT2 __loadds __far
#define STM_INT3 __far
#endif /* STM_BUILD_WIN16 */
#elif defined(STM_OS_UNIX)
#define STM_API1
#define STM_API2
#define STM_INT1
#define STM_INT2
#define STM_INT3
#else
#define STM_API1
#define STM_API2 __far
#define STM_INT1
#define STM_INT2 __far
#define STM_INT3 __far
#endif
/** *** BEGIN EXTRACTION *** **/
/** **************************************************************************** **/
/** basic constants and macros **/
/** **************************************************************************** **/
#if defined TRUE
#undef TRUE
#endif
#define TRUE (1==1)
#if defined FALSE
#undef FALSE
#endif
#define FALSE (1==0)
#if defined min
#undef min
#endif
#define min(a, b) (((a) < (b)) ? (a) : (b))
#if defined max
#undef max
#endif
#define max(a, b) (((a) > (b)) ? (a) : (b))
#if defined NULL
#undef NULL
#endif
#define NULL (0)
/** **************************************************************************** **/
/** type definition for the card terminal handle **/
/** **************************************************************************** **/
typedef unsigned long stmHandle;
/** **************************************************************************** **/
/** type definition for the journal callback function **/
/** **************************************************************************** **/
typedef void (*stmfctJouCbk)(unsigned short, unsigned short, unsigned short,
unsigned short, unsigned long, unsigned char*);
/** **************************************************************************** **/
/** return codes **/
/** **************************************************************************** **/
//return code if all went well
#define STM_OK 0
//error codes
#define STM_ERR_NONE 0x00
#define STM_ERR_NOT_AVAILABLE 0x01
#define STM_ERR_LIB_ALREADY_INIT 0x02
#define STM_ERR_LIB_NOT_INIT 0x03
/* parameter integrity */
#define STM_ERR_BAD_SOURCE_DATA 0x04
#define STM_ERR_BAD_DESTINATION_DATA 0x05
#define STM_ERR_DATA_TOO_LONG 0x06
/* communication errors */
#define STM_ERR_SEND_AUTO_REPEAT 0x100
#define STM_ERR_SEND_SW 0x101
#define STM_ERR_SEND_LEN 0x102
#define STM_ERR_SEND_T0_LESS_DATA 0x103
#define STM_ERR_SEND_BUFFER_TOO_SMALL 0x104
#define STM_ERR_SEND_AUTO_GET_RESPONSE 0x105
/* interface specific errors */
#define STM_ERR_INTERF_TERM_ALREADY_OPENED 0x140
#define STM_ERR_INTERF_TERM_NOT_OPENED 0x141
#define STM_ERR_INTERF_CARD_ALREADY_REQUESTED 0x142
#define STM_ERR_INTERF_CARD_NOT_REQUESTED 0x143
/* terminal commands: specific errors */
#define STM_ERR_TERM_NOT_EXIST 0x150
#define STM_ERR_TERM_ALREADY_USED 0x151
#define STM_ERR_TERM_USED_MULTIPLE 0x152
#define STM_ERR_TERM_ALREADY_CREATED 0x153
#define STM_ERR_TERM_NOT_CREATED 0x154
/* PC/CTI specific errors */
#define STM_ERR_TERM_NO_ICC 0x160
#define STM_ERR_TERM_STATE 0x161
#define STM_ERR_TERM_COMM_BREAK 0x162
#define STM_ERR_TERM_COMM_CT 0x163
#define STM_ERR_TERM_COMM_ICC 0x164
#define STM_ERR_TERM_COMX 0x165
#define STM_ERR_TERM_CTH 0x166
#define STM_ERR_TERM_NAD 0x167
#define STM_ERR_TERM_PARA_ERR 0x168
#define STM_ERR_TERM_CMD_LEN_ERR 0x169
#define STM_ERR_TERM_JOURNAL 0x16a
#define STM_ERR_TERM_INS_NOT_SUPP 0x16b
#define STM_ERR_TERM_CLASS_NOT_SUPP 0x16c
#define STM_ERR_TERM_RESET 0x16d
#define STM_ERR_TERM_USER_BREAK 0x16e
#define STM_ERR_TERM_USER_TIMEOUT 0x16f
#define STM_ERR_TERM_ICC_NOT_REMOVED 0x170
#define STM_ERR_TERM_CT_SW_ERR 0x171
#define STM_ERR_TERM_UNSPECIFIC 0x172
/* ICC errors */
#define STM_ERR_ICC_ALREADY_CREATED 0x180
#define STM_ERR_ICC_NOT_CREATED 0x181
#define STM_ERR_ICC_NOT_EJECTED_IN_USE 0x182
#define STM_ERR_ICC_SET_PTS 0x183
/* card commands: unspecific errors */
#define STM_ERR_CARD_KEY_NOT_ISO 0x200
#define STM_ERR_CARD_INVALID_SHORT_ID 0x201
#define STM_ERR_CARD_INVALID_RECORD_ID 0x202
#define STM_ERR_CARD_INVALID_FILE_STRUCTURE 0x203
#define STM_ERR_CARD_INVALID_OFFSET 0x204
#define STM_ERR_CARD_INVALID_AID 0x205
#define STM_ERR_CARD_INVALID_MODIFY_VALUE 0x206
#define STM_ERR_CARD_PIN_LENGTH 0x207
#define STM_ERR_CARD_PUK_LENGTH 0x208
#define STM_ERR_CARD_BYTE_AMOUNT 0x209
#define STM_ERR_CARD_CHAINING 0x20a
#define STM_ERR_CARD_NO_DEFAULT_KEY 0x20b
#define STM_ERR_CARD_KEY_TYPE 0x20c
#define STM_ERR_CARD_CHIP_CONFIG 0x20d
#define STM_ERR_CARD_INVALID_KEY 0x20e
#define STM_ERR_CARD_INVALID_MAC 0x20f
#define STM_ERR_CARD_MASTER_KEY 0x210
#define STM_ERR_CARD_DERIVE_MASTER_KEY 0x211
#define STM_ERR_CARD_INVALID_KEY_HEADER 0x212
#define STM_ERR_CARD_INVALID_CHALL_LENGTH 0x213
/* SPK: */
#define STM_ERR_CARD_INVALID_HASH_LENGTH 0x214
#define STM_ERR_CARD_INVALID_COUNTER_LENGTH 0x215
#define STM_ERR_CARD_INVALID_SIGNATURE_LENGTH 0x216
#define STM_ERR_CARD_INVALID_CHID_LENGTH 0x217
#define STM_ERR_CARD_DERIVE_SESSION_KEY 0x218
#define STM_ERR_CARD_SESSION_KEY 0x219
#define STM_ERR_CARD_INVALID_PAD_MODE 0x21a
#define STM_ERR_CARD_KEY_LENGTH 0x21b
#define STM_ERR_CARD_HASH_BUFFER_OVERFLOW 0x21c
#define STM_ERR_CARD_INVALID_KEY_NUMBER 0x21d
#define STM_ERR_CARD_INVALID_PADDING 0x21e
/* GSM: */
#define STM_ERR_CARD_INVALID_DATA_LENGTH 0x21f
/* card commands: specific errors */
#define STM_ERR_CARD_NOT_EXIST 0x250
#define STM_ERR_CARD_ALREADY_USED 0x251
#define STM_ERR_CARD_USED_MULTIPLE 0x252
#define STM_ERR_CARD_CANT_CREATE 0x253
#define STM_ERR_CARD_LOGCHN_NOTAVAIL 0x254
#define STM_ERR_CARD_SCVERSION_NOT_AVAIL 0x255
#define STM_ERR_CARD_SCVERSION 0x256
#define STM_ERR_CARD_EXT_AUTH 0x257
#define STM_ERR_CARD_INT_AUTH 0x258
#define STM_ERR_CARD_MUT_AUTH 0x259
#define STM_ERR_CARD_READ_BINARY 0x25a
#define STM_ERR_CARD_WRITE_BINARY 0x25b
#define STM_ERR_CARD_UPDATE_BINARY 0x25c
#define STM_ERR_CARD_READ_RECORD 0x25d
#define STM_ERR_CARD_UPDATE_RECORD 0x25e
#define STM_ERR_CARD_GET_CARD_DATA 0x25f
#define STM_ERR_CARD_GET_CHALLENGE 0x260
#define STM_ERR_CARD_SELECT_FILE 0x261
#define STM_ERR_CARD_INVALID_FILE_TYPE 0x262
#define STM_ERR_CARD_CANT_CHECK_FILE_TYPE 0x263
#define STM_ERR_CARD_INVALID_INFO_REQUEST 0x264
#define STM_ERR_CARD_GET_DATA 0x265
#define STM_ERR_CARD_LOCK_FILE 0x266
#define STM_ERR_CARD_INCREASE 0x267
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -