sc-hsm-embedded
src/ctccid/ctapi.h File Reference

Defines

#define MAX_APDULEN   1040
#define OK   0
#define ERR_INVALID   -1
#define ERR_CT   -8
#define ERR_TRANS   -10
#define ERR_MEMORY   -11
#define ERR_HOST   -127
#define ERR_HTSI   -128
#define SMARTCARD_SUCCESS   0x9000
#define SMARTCARD_SUCCESS_ASYNC   0X9001
#define NOT_SUCCESSFUL   0x6400
#define W_NO_CARD_PRESENTED   0x6200
#define W_ICC_ALREADY_PRESENT   0x6201
#define DATA_CORRUPTED   0x6281
#define NO_CARD_PRESENT   0x64A1
#define CARD_NOT_ACTIVATED   0x64A2
#define WRONG_LENGTH   0x6700
#define COMMAND_NOT_ALLOWED   0x6900
#define VERIFICATION_METHOD_BLOCK   0x6983
#define VERIFICATION_UNSUCCESSFUL   0x63C0
#define WRONG_PARAMETERS_P1_P2   0x6A00
#define FILE_NOT_FOUND   0x6A82
#define OUT_OF_RANGE   0x6B00
#define WRONG_LENGTH_LE   0x6C00
#define WRONG_INSTRUCTION   0x6D00
#define CLASS_NOT_SUPPORTED   0x6E00
#define COMMUNICATION_NOT_POSSIBLE   0x6F00
#define CT   1
#define HOST   2

Functions

signed char CT_init (unsigned short ctn, unsigned short pn)
signed char CT_close (unsigned short ctn)
signed char CT_data (unsigned short ctn, unsigned char *dad, unsigned char *sad, unsigned short lc, unsigned char *cmd, unsigned short *lr, unsigned char *rsp)

Define Documentation

#define CARD_NOT_ACTIVATED   0x64A2
#define CLASS_NOT_SUPPORTED   0x6E00
#define COMMAND_NOT_ALLOWED   0x6900
#define COMMUNICATION_NOT_POSSIBLE   0x6F00
#define CT   1
#define DATA_CORRUPTED   0x6281
#define ERR_CT   -8

Cardterminal error

#define ERR_HOST   -127

Function aborted by host os

#define ERR_HTSI   -128

'HTSI' error

#define ERR_INVALID   -1

Invalid parameter or value

#define ERR_MEMORY   -11

Memory allocate error

#define ERR_TRANS   -10

Transmission error

#define FILE_NOT_FOUND   0x6A82
#define HOST   2
#define MAX_APDULEN   1040

Maximum length of APDU

#define NO_CARD_PRESENT   0x64A1
#define NOT_SUCCESSFUL   0x6400
#define OK   0

Successful completion

#define OUT_OF_RANGE   0x6B00
#define SMARTCARD_SUCCESS   0x9000
#define SMARTCARD_SUCCESS_ASYNC   0X9001
#define VERIFICATION_METHOD_BLOCK   0x6983
#define VERIFICATION_UNSUCCESSFUL   0x63C0
#define W_ICC_ALREADY_PRESENT   0x6201
#define W_NO_CARD_PRESENTED   0x6200
#define WRONG_INSTRUCTION   0x6D00
#define WRONG_LENGTH   0x6700
#define WRONG_LENGTH_LE   0x6C00
#define WRONG_PARAMETERS_P1_P2   0x6A00

Function Documentation

signed char CT_close ( unsigned short  ctn)

Close the interface and free all allocated resources

Parameters:
ctnCard terminal number
Returns:
Status code OK, ERR_INVALID, ERR_CT, ERR_TRANS, ERR_MEMORY, ERR_HOST, ERR_HTSI
signed char CT_data ( unsigned short  ctn,
unsigned char *  dad,
unsigned char *  sad,
unsigned short  lc,
unsigned char *  cmd,
unsigned short *  lr,
unsigned char *  rsp 
)

Pass a command to the reader driver and receive the response

Parameters:
ctnCard terminal number
dadDestination address
sadSource address
lcLength of command data
cmdCommand data
lrSize of response data buffer
rspResponse data
Returns:
Status code OK, ERR_INVALID, ERR_CT, ERR_TRANS, ERR_MEMORY, ERR_HOST, ERR_HTSI
signed char CT_init ( unsigned short  ctn,
unsigned short  pn 
)

Initialize the interface to the card reader ctn attached to the port number specified in pn

Parameters:
ctnCard terminal number
pnPort number
Returns:
Status code OK, ERR_INVALID, ERR_CT, ERR_TRANS, ERR_MEMORY, ERR_HOST, ERR_HTSI