Main Page | Data Structures | File List | Data Fields | Globals

ifdhandler.h File Reference


Detailed Description

Interface header file for the Linux PCSC code.

This provides a low-level reader specific interface for the smart cards. This dirver is used with the Linux PCSC interface library see http://www.linuxnet.com.

Note:
This is taken directly from the linux pcsc code and is subject to thier license
Author:
Rod Boyce
Date:
22/11/04

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  SCARD_IO_HEADER

Defines

#define TAG_IFD_ATR   0x0303
#define TAG_IFD_SLOTNUM   0x0180
#define TAG_IFD_SLOT_THREAD_SAFE   0x0FAC
#define TAG_IFD_THREAD_SAFE   0x0FAD
#define TAG_IFD_SLOTS_NUMBER   0x0FAE
#define TAG_IFD_SIMULTANEOUS_ACCESS   0x0FAF
#define IFD_HVERSION_1_0   0x00010000
#define IFD_POWER_UP   500 /**< Power up action */
#define IFD_POWER_DOWN   501 /**< Power down action */
#define IFD_RESET   502 /**< Reset Action */
#define IFD_NEGOTIATE_PTS1   1
#define IFD_NEGOTIATE_PTS2   2
#define IFD_NEGOTIATE_PTS3   4
#define IFD_SUCCESS   0
#define IFD_ERROR_TAG   600
#define IFD_ERROR_SET_FAILURE   601
#define IFD_ERROR_VALUE_READ_ONLY   602
#define IFD_ERROR_PTS_FAILURE   605
#define IFD_ERROR_NOT_SUPPORTED   606
#define IFD_PROTOCOL_NOT_SUPPORTED   607
#define IFD_ERROR_POWER_ACTION   608
#define IFD_ERROR_SWALLOW   609
#define IFD_ERROR_EJECT   610
#define IFD_ERROR_CONFISCATE   611
#define IFD_COMMUNICATION_ERROR   612
#define IFD_RESPONSE_TIMEOUT   613
#define IFD_NOT_SUPPORTED   614
#define IFD_ICC_PRESENT   615
#define IFD_ICC_NOT_PRESENT   616

Typedefs

typedef * PSCARD_IO_HEADER

Functions

RESPONSECODE IFDHCreateChannel (LONG, LONG)
 Called to open a channel to a smart card.

RESPONSECODE IFDHCloseChannel (LONG)
RESPONSECODE IFDHGetCapabilities (LONG, LONG, LONG *, BYTE *)
 Return the requested capibilities for a smart card.

RESPONSECODE IFDHSetCapabilities (LONG, LONG, LONG, BYTE *)
 Set the smart card capibilities for the smart card.

RESPONSECODE IFDHSetProtocolParameters (LONG, LONG, BYTE, BYTE, BYTE, BYTE)
 Set the protocol type selection using the three PTS parameters.

RESPONSECODE IFDHPowerICC (LONG, LONG, BYTE *, LONG *)
 Controls the power and reset signals of the smart card.

RESPONSECODE IFDHTransmitToICC (LONG, SCARD_IO_HEADER, BYTE *, LONG, BYTE *, LONG *, PSCARD_IO_HEADER)
 Perform an ADPU exchange with the smart card.

RESPONSECODE IFDHControl (LONG, BYTE *, LONG, BYTE *, LONG *)
 Perform a data exchange with the smart card reader.

RESPONSECODE IFDHICCPresence (LONG)
 Return the status of the card inserted into the reader.


Define Documentation

#define IFD_POWER_DOWN   501 /**< Power down action */
 

Power down action

#define IFD_POWER_UP   500 /**< Power up action */
 

Power up action

#define IFD_RESET   502 /**< Reset Action */
 

Reset Action


Function Documentation

RESPONSECODE IFDHCloseChannel LONG  lLun  ) 
 

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number.
Returns:
IFD_SUCCESS if the channel was closed, IFD_COMMUNICATION_ERROR if an error occured

History

RESPONSECODE IFDHControl LONG  lLun,
BYTE pabTxBuf,
LONG  lTxlen,
BYTE pabRxBuf,
LONG plRxLen
 

Perform a data exchange with the smart card reader.

This is not supported in this implementation

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
pabTxBuf - The data buffer to send to the reader
lTxlen - The number of bytes to send
pabRxBuf - The data returned.
plRxLen - The size of the returned buffer.
Returns:
IFD_SUCCESS for a successful transaction, |IFD_COMMUNICATION_ERROR if an error occured,

IFD_RESPONSE_TIMEOUT if the response timed out.

History

RESPONSECODE IFDHCreateChannel LONG  lLun,
LONG  lChannel
 

Called to open a channel to a smart card.

Open the chanel to the smart card. In this implementation the open is done later This will just initialise the channel for comms and allow IFDHICCPresence to return the card status

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit number. 0xxxxxyyyy xxxx multiple readers, yyyy multiple slots
lChannel - The channel ID starting from one.
Returns:
IFD_SUCCESS if the channel was opened sucessufully or IFD_COMMUNICATION_ERROR if the channel

is not supported.

History

Here is the call graph for this function:

RESPONSECODE IFDHGetCapabilities LONG  lLun,
LONG  lTag,
LONG plLen,
BYTE pabVal
 

Return the requested capibilities for a smart card.

Return the requested capibilities. At the moment only the ATR is returned all other Tags get ignored and IFD)ERROR is returned. This is what the acs_mouse driver was doing for the basic cards.

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
lTag - The tag for the requested infomation
plLen - Pointer to a long that is the size of the return buffer
pabVal - pointer to a buffer that will store the returned infomation
Returns:
IFD_SUCCESS - On success, IFD_ERROR_TAG - Tag not used.

History

RESPONSECODE IFDHICCPresence LONG  lLun  ) 
 

Return the status of the card inserted into the reader.

This function is surposed to detect if a smart card is inserted onto the smartcard holder.

Note:
For the moment this is not possible as the only way to do this is by trying to read the ATR (Answer To Reset). THis fn is called all the time by the upper layers to see if the smart card has been removed or not. There is a change to be able to read the smart card inserted pin of the socket in the future.
Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
Returns:
IFD_ICC_PRESENT if there is a card in the reader, IFD_ICC_NOT_PRESENT if there is no

card in the reader, IFD_COMMUNICATION_ERROR if a error occured.

History

RESPONSECODE IFDHPowerICC LONG  lLun,
LONG  lAction,
BYTE pabAtr,
LONG plAtrLen
 

Controls the power and reset signals of the smart card.

This function is surposed to control the power and reset signals of the smart card. Ok I had to add the extra functionality so lets see how that goes.

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
lAction - Action to be perormed, power up, power down, reset
pabAtr - Answer to reset the ATR value of the inserted card
plAtrLen - The length of the ATR buffer and the returned size of the ATR
Returns:
IDF_SUCCESS on sucess, IFD_ERROR_POWER_ACTION an error in powering or resetting the

card, IFD_COMMUNICATION_ERROR an error occured, IFD_NOT_SUPPORTED the requested action

was not supported.

History

< Reset Action

< Power down action

< Power up action

Here is the call graph for this function:

RESPONSECODE IFDHSetCapabilities LONG  lLun,
LONG  lTag,
LONG  lLen,
BYTE pabVal
 

Set the smart card capibilities for the smart card.

Return an error code this is what the acs_mouse driver did so this is what we are going to do. At least until I have a resonable need to do something better.

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
lTag - The tag for the infomation needing to be set
lLen - Length of the desired data value
pabVal - Value to set the lTag to.
Returns:
IFD_SUCCESS - for a sucessful operation, IFD_ERROR_TAG if the tag was not understood,

IFD_ERROR_SET_FAILURE - could not set the value, IFD_ERROR_VAULE_READ_ONLY - the value is readonly

History

RESPONSECODE IFDHSetProtocolParameters LONG  lLun,
LONG  lProto,
BYTE  bFlgs,
BYTE  bPts1,
BYTE  bPts2,
BYTE  bPts3
 

Set the protocol type selection using the three PTS parameters.

Again this is what the acs_mouse driver was doing to this is what I'm going to do until ther eis a better reason to do anything else.

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
lproto - The protocol to set the device to o ... 14 = T0 .. T14
bFlgs - Logical or of possible values IFD_NEGOTIATE_PTS1, PTS2, PTS3 to determine
which PTS values to negotiage
bPts1 - 1st PTS value (See ISO 7816 / EMV documentation)
bPts2 - 2nd PTS value (See ISO 7816 / EMV documentation)
bPts3 - 3rd PTS value (See ISO 7816 / EMV documentation)
Returns:
IFD_SUCCESS for a sucessful result, IFD_ERROR_PTS_FAILURE could not set the PTS value,

IFD_COMMUNICATION_ERROR an error has occured, IFD_PROTOCOL_NOT_SUPPORTED the requested

protocol is not supported

History

RESPONSECODE IFDHTransmitToICC LONG  lLun,
SCARD_IO_HEADER  sTxPci,
BYTE pabTxBuf,
LONG  lTxLen,
BYTE pabRxBuf,
LONG plRxLen,
PSCARD_IO_HEADER  psRxPci
 

Perform an ADPU exchange with the smart card.

Date:
16/11/04
Author:
Rod Boyce
Parameters:
lLun - Logical Unit Number
sTxPci - protocol to use the length member is not used.
pabTxBuf - The buffer to send to the smart card
lTxLen - The number of bytes to send to the smart card
pabRxBuf - The place to store the receive buffer
plRxLen - The size of the receive buffer
psRxPci - The protocol to use for the reply and the length but the length is not used
Returns:
IFD_SUCCESS after a successful transaction with thte smart card,

IFD_COMMUNICATION_ERROR if a comms error occured, IFD_RESPONSE_TIMEOUT if the response

timed out, IFD_PROTOCOL_NOT_SUPPORTED if the requested protocol is not supported.

History

Here is the call graph for this function:


Generated on Thu Jan 20 16:18:03 2005 for Smart-card ifd-handler for Axis by doxygen 1.3.6