Blame MacOSX/ifdhandler.h

Packit 9f0df5
/*
Packit 9f0df5
 * MUSCLE SmartCard Development ( http://pcsclite.alioth.debian.org/pcsclite.html )
Packit 9f0df5
 *
Packit 9f0df5
 * Copyright (C) 1999-2004
Packit 9f0df5
 *  David Corcoran <corcoran@musclecard.com>
Packit 9f0df5
 * Copyright (C) 2003-2004
Packit 9f0df5
 *  Damien Sauveron <damien.sauveron@labri.fr>
Packit 9f0df5
 * Copyright (C) 2002-2011
Packit 9f0df5
 *  Ludovic Rousseau <ludovic.rousseau@free.fr>
Packit 9f0df5
 *
Packit 9f0df5
Redistribution and use in source and binary forms, with or without
Packit 9f0df5
modification, are permitted provided that the following conditions
Packit 9f0df5
are met:
Packit 9f0df5
Packit 9f0df5
1. Redistributions of source code must retain the above copyright
Packit 9f0df5
   notice, this list of conditions and the following disclaimer.
Packit 9f0df5
2. Redistributions in binary form must reproduce the above copyright
Packit 9f0df5
   notice, this list of conditions and the following disclaimer in the
Packit 9f0df5
   documentation and/or other materials provided with the distribution.
Packit 9f0df5
3. The name of the author may not be used to endorse or promote products
Packit 9f0df5
   derived from this software without specific prior written permission.
Packit 9f0df5
Packit 9f0df5
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
Packit 9f0df5
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Packit 9f0df5
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Packit 9f0df5
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit 9f0df5
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
Packit 9f0df5
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 9f0df5
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 9f0df5
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 9f0df5
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
Packit 9f0df5
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 9f0df5
 */
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * @file
Packit 9f0df5
 * @defgroup IFDHandler IFDHandler
Packit 9f0df5
 * @brief This provides reader specific low-level calls.
Packit 9f0df5
Packit 9f0df5
The routines specified hereafter will allow you to write an IFD handler
Packit 9f0df5
for the PC/SC Lite resource manager. Please use the complement
Packit 9f0df5
developer's kit complete with headers and Makefile at:
Packit 9f0df5
http://www.musclecard.com/drivers.html
Packit 9f0df5
Packit 9f0df5
This gives a common API for communication to most readers in a
Packit 9f0df5
homogeneous fashion. This document assumes that the driver developer is
Packit 9f0df5
experienced with standards such as ISO-7816-(1, 2, 3, 4), EMV and MCT
Packit 9f0df5
specifications. For listings of these specifications please access the
Packit 9f0df5
above web site.
Packit 9f0df5
Packit 9f0df5
@section UsbReaders USB readers
Packit 9f0df5
Packit 9f0df5
USB readers use the bundle approach so that the reader can be loaded
Packit 9f0df5
and unloaded upon automatic detection of the device. The bundle
Packit 9f0df5
approach is simple: the actual library is just embedded in a
Packit 9f0df5
directory so additional information can be gathered about the device.
Packit 9f0df5
Packit 9f0df5
A bundle looks like the following:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
GenericReader.bundle/
Packit 9f0df5
  Contents/
Packit 9f0df5
    Info.plist  - XML file describing the reader
Packit 9f0df5
    MacOS/      - Driver directory for OS X
Packit 9f0df5
    Solaris/    - Driver directory for Solaris
Packit 9f0df5
    Linux/      - Driver directory for Linux
Packit 9f0df5
    HPUX/       - Driver directory for HPUX
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
The @c Info.plist file describes the driver and gives the loader
Packit 9f0df5
all the necessary information. The following must be contained in the
Packit 9f0df5
@c Info.plist file:
Packit 9f0df5
Packit 9f0df5
@subsection ifdVendorID
Packit 9f0df5
Packit 9f0df5
The vendor ID of the USB device.
Packit 9f0df5
Packit 9f0df5
Example:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
    <key>ifdVendorID</key>
Packit 9f0df5
    <string>0x04E6</string>
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
You may have an OEM of this reader in which an additional @c <string>
Packit 9f0df5
can be used like in the below example:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
    <key>ifdVendorID</key>
Packit 9f0df5
    <array>
Packit 9f0df5
      <string>0x04E6</string>
Packit 9f0df5
      <string>0x0973</string>
Packit 9f0df5
    </array>
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
If multiples exist all the other parameters must have a second value
Packit 9f0df5
also. You may chose not to support this feature but it is useful when
Packit 9f0df5
reader vendors OEM products so you only distribute one driver.
Packit 9f0df5
Packit 9f0df5
Packit 9f0df5
The CCID driver from Ludovic Rousseau
Packit 9f0df5
http://pcsclite.alioth.debian.org/ccid.html uses this feature since the
Packit 9f0df5
same driver supports many different readers.
Packit 9f0df5
Packit 9f0df5
@subsection ifdProductID
Packit 9f0df5
Packit 9f0df5
   The product id of the USB device.
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
   <key>ifdProductID</key>
Packit 9f0df5
   <string>0x3437</string>
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
@subsection ifdFriendlyName
Packit 9f0df5
Packit 9f0df5
   Example:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
   <key>ifdFriendlyName</key>
Packit 9f0df5
   <string>SCM Microsystems USB Reader</string>
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
The reader name must use the ASCII character set.
Packit 9f0df5
Packit 9f0df5
@subsection CFBundleExecutable
Packit 9f0df5
Packit 9f0df5
   The executable name which exists in the particular platform's directory.
Packit 9f0df5
Packit 9f0df5
   Example:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
   <key>CFBundleExecutable</key>
Packit 9f0df5
   <string>libccid.so.0.4.2</string>
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
@subsection ifdCapabilities
Packit 9f0df5
Packit 9f0df5
   List of capabilities supported by the driver. This is a bit field. Possible values are:
Packit 9f0df5
Packit 9f0df5
- 0
Packit 9f0df5
  No special capabilities
Packit 9f0df5
- 1 IFD_GENERATE_HOTPLUG
Packit 9f0df5
  The driver supports the hot plug feature.
Packit 9f0df5
Packit 9f0df5
Complete sample file:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
Packit 9f0df5
Packit 9f0df5
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Packit 9f0df5
<plist version="1.0">
Packit 9f0df5
<dict>
Packit 9f0df5
    <key>CFBundleDevelopmentRegion</key>
Packit 9f0df5
    <string>English</string>
Packit 9f0df5
    <key>CFBundleInfoDictionaryVersion</key>
Packit 9f0df5
    <string>6.0</string>
Packit 9f0df5
    <key>CFBundlePackageType</key>
Packit 9f0df5
    <string>BNDL</string>
Packit 9f0df5
    <key>CFBundleSignature</key>
Packit 9f0df5
    <string>????</string>
Packit 9f0df5
    <key>CFBundleVersion</key>
Packit 9f0df5
    <string>0.0.1d1</string>
Packit 9f0df5
    <key>ifdCapabilities</key>
Packit 9f0df5
    <string>0x00000000</string>
Packit 9f0df5
    <key>ifdProtocolSupport</key>
Packit 9f0df5
    <string>0x00000001</string>
Packit 9f0df5
    <key>ifdVersionNumber</key>
Packit 9f0df5
    <string>0x00000001</string>
Packit 9f0df5
Packit 9f0df5
    <key>CFBundleExecutable</key>
Packit 9f0df5
    <string>libfoobar.so.x.y</string>
Packit 9f0df5
Packit 9f0df5
    <key>ifdManufacturerString</key>
Packit 9f0df5
    <string>Foo bar inc.</string>
Packit 9f0df5
Packit 9f0df5
    <key>ifdProductString</key>
Packit 9f0df5
    <string>Driver for Foobar reader, version x.y</string>
Packit 9f0df5
Packit 9f0df5
    <key>ifdVendorID</key>
Packit 9f0df5
    <string>0x1234</string>
Packit 9f0df5
Packit 9f0df5
    <key>ifdProductID</key>
Packit 9f0df5
    <string>0x5678</string>
Packit 9f0df5
Packit 9f0df5
    <key>ifdFriendlyName</key>
Packit 9f0df5
    <string>Foobar USB reader</string>
Packit 9f0df5
</dict>
Packit 9f0df5
</plist>
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
As indicated in the XML file the DTD is available at
Packit 9f0df5
http://www.apple.com/DTDs/PropertyList-1.0.dtd.
Packit 9f0df5
Packit 9f0df5
@section SerialReaders Serial readers
Packit 9f0df5
Packit 9f0df5
Serial drivers must be configured to operate on a particular port and
Packit 9f0df5
respond to a particular name. The @c reader.conf file is used for this
Packit 9f0df5
purpose.
Packit 9f0df5
Packit 9f0df5
It has the following syntax:
Packit 9f0df5
Packit 9f0df5
@verbatim
Packit 9f0df5
# Configuration file for pcsc-lite
Packit 9f0df5
# David Corcoran <corcoran@musclecard.com>
Packit 9f0df5
Packit 9f0df5
FRIENDLYNAME  Generic Reader
Packit 9f0df5
DEVICENAME    /dev/ttyS0
Packit 9f0df5
LIBPATH       /usr/lib/pcsc/drivers/libgen_ifd.so
Packit 9f0df5
CHANNELID     1
Packit 9f0df5
@endverbatim
Packit 9f0df5
Packit 9f0df5
The pound sign # denotes a comment.
Packit 9f0df5
Packit 9f0df5
@subsection FRIENDLYNAME
Packit 9f0df5
The FRIENDLYNAME field is an arbitrary text used to identify the reader.
Packit 9f0df5
This text is displayed by commands like @c pcsc_scan
Packit 9f0df5
http://ludovic.rousseau.free.fr/softwares/pcsc-tools/ that prints the
Packit 9f0df5
names of all the connected and detected readers.
Packit 9f0df5
Packit 9f0df5
@subsection DEVICENAME
Packit 9f0df5
The DEVICENAME field was not used for old drivers (using the IFD handler
Packit 9f0df5
version 2.0 or previous). It is now (IFD handler version 3.0) used to
Packit 9f0df5
identify the physical port on which the reader is connected.  This is
Packit 9f0df5
the device name of this port. It is dependent of the OS kernel. For
Packit 9f0df5
example the first serial port device is called @c /dev/ttyS0 under Linux
Packit 9f0df5
and @c /dev/cuaa0 under FreeBSD.
Packit 9f0df5
Packit 9f0df5
If you want to use IFDHCreateChannel() instead of
Packit 9f0df5
IFDHCreateChannelByName() then do not use any DEVICENAME line in the
Packit 9f0df5
configuration file.  IFDHCreateChannel() will then be called with the
Packit 9f0df5
CHANNELID parameter.
Packit 9f0df5
Packit 9f0df5
@subsection LIBPATH
Packit 9f0df5
The LIBPATH field is the filename of the driver code. The driver is a
Packit 9f0df5
dynamically loaded piece of code (generally a @c drivername.so* file).
Packit 9f0df5
Packit 9f0df5
@subsection CHANNELID
Packit 9f0df5
The CHANNELID is no more used for recent drivers (IFD handler 3.0) and
Packit 9f0df5
has been superseded by DEVICENAME.
Packit 9f0df5
Packit 9f0df5
If you have an old driver this field is used to indicate the port to
Packit 9f0df5
use. You should read your driver documentation to know what information
Packit 9f0df5
is needed here. It should be the serial port number for a serial reader.
Packit 9f0df5
Packit 9f0df5
CHANNELID was the numeric version of the port in which the reader will
Packit 9f0df5
be located. This may be done by a symbolic link where @c /dev/pcsc/1 is
Packit 9f0df5
the first device which may be a symbolic link to @c /dev/ttyS0 or
Packit 9f0df5
whichever location your reader resides.
Packit 9f0df5
Packit 9f0df5
 */
Packit 9f0df5
Packit 9f0df5
#ifndef _ifd_handler_h_
Packit 9f0df5
#define _ifd_handler_h_
Packit 9f0df5
Packit 9f0df5
#include <pcsclite.h>
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * List of data structures available to ifdhandler
Packit 9f0df5
	 */
Packit 9f0df5
	typedef struct _DEVICE_CAPABILITIES
Packit 9f0df5
	{
Packit 9f0df5
		LPSTR Vendor_Name;		/**< Tag 0x0100 */
Packit 9f0df5
		LPSTR IFD_Type;			/**< Tag 0x0101 */
Packit 9f0df5
		DWORD IFD_Version;		/**< Tag 0x0102 */
Packit 9f0df5
		LPSTR IFD_Serial;		/**< Tag 0x0103 */
Packit 9f0df5
		DWORD IFD_Channel_ID;	/**< Tag 0x0110 */
Packit 9f0df5
Packit 9f0df5
		DWORD Asynch_Supported;	/**< Tag 0x0120 */
Packit 9f0df5
		DWORD Default_Clock;	/**< Tag 0x0121 */
Packit 9f0df5
		DWORD Max_Clock;		/**< Tag 0x0122 */
Packit 9f0df5
		DWORD Default_Data_Rate;	/**< Tag 0x0123 */
Packit 9f0df5
		DWORD Max_Data_Rate;	/**< Tag 0x0124 */
Packit 9f0df5
		DWORD Max_IFSD;			/**< Tag 0x0125 */
Packit 9f0df5
		DWORD Synch_Supported;	/**< Tag 0x0126 */
Packit 9f0df5
		DWORD Power_Mgmt;		/**< Tag 0x0131 */
Packit 9f0df5
		DWORD Card_Auth_Devices;	/**< Tag 0x0140 */
Packit 9f0df5
		DWORD User_Auth_Device;	/**< Tag 0x0142 */
Packit 9f0df5
		DWORD Mechanics_Supported;	/**< Tag 0x0150 */
Packit 9f0df5
		DWORD Vendor_Features;	/**< Tag 0x0180 - 0x01F0 User Defined. */
Packit 9f0df5
	}
Packit 9f0df5
	DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
Packit 9f0df5
Packit 9f0df5
	typedef struct _ICC_STATE
Packit 9f0df5
	{
Packit 9f0df5
		UCHAR ICC_Presence;		/**< Tag 0x0300 */
Packit 9f0df5
		UCHAR ICC_Interface_Status;	/**< Tag 0x0301 */
Packit 9f0df5
		UCHAR ATR[MAX_ATR_SIZE];	/**< Tag 0x0303 */
Packit 9f0df5
		UCHAR ICC_Type;			/**< Tag 0x0304 */
Packit 9f0df5
	}
Packit 9f0df5
	ICC_STATE, *PICC_STATE;
Packit 9f0df5
Packit 9f0df5
	typedef struct _PROTOCOL_OPTIONS
Packit 9f0df5
	{
Packit 9f0df5
		DWORD Protocol_Type;	/**< Tag 0x0201 */
Packit 9f0df5
		DWORD Current_Clock;	/**< Tag 0x0202 */
Packit 9f0df5
		DWORD Current_F;		/**< Tag 0x0203 */
Packit 9f0df5
		DWORD Current_D;		/**< Tag 0x0204 */
Packit 9f0df5
		DWORD Current_N;		/**< Tag 0x0205 */
Packit 9f0df5
		DWORD Current_W;		/**< Tag 0x0206 */
Packit 9f0df5
		DWORD Current_IFSC;		/**< Tag 0x0207 */
Packit 9f0df5
		DWORD Current_IFSD;		/**< Tag 0x0208 */
Packit 9f0df5
		DWORD Current_BWT;		/**< Tag 0x0209 */
Packit 9f0df5
		DWORD Current_CWT;		/**< Tag 0x020A */
Packit 9f0df5
		DWORD Current_EBC;		/**< Tag 0x020B */
Packit 9f0df5
	}
Packit 9f0df5
	PROTOCOL_OPTIONS, *PPROTOCOL_OPTIONS;
Packit 9f0df5
Packit 9f0df5
	/**
Packit 9f0df5
	 * Use by SCardTransmit()
Packit 9f0df5
	 */
Packit 9f0df5
	typedef struct _SCARD_IO_HEADER
Packit 9f0df5
	{
Packit 9f0df5
		DWORD Protocol;
Packit 9f0df5
		DWORD Length;
Packit 9f0df5
	}
Packit 9f0df5
	SCARD_IO_HEADER, *PSCARD_IO_HEADER;
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * The list of tags should be alot more but this is all I use in the
Packit 9f0df5
	 * meantime
Packit 9f0df5
	 */
Packit 9f0df5
#define TAG_IFD_ATR                     0x0303	/**< ATR */
Packit 9f0df5
#define TAG_IFD_SLOTNUM                 0x0180	/**< select a slot */
Packit 9f0df5
#define TAG_IFD_SLOT_THREAD_SAFE        0x0FAC	/**< support access to different slots of the reader */
Packit 9f0df5
#define TAG_IFD_THREAD_SAFE             0x0FAD	/**< driver is thread safe */
Packit 9f0df5
#define TAG_IFD_SLOTS_NUMBER            0x0FAE	/**< number of slots of the reader */
Packit 9f0df5
#define TAG_IFD_SIMULTANEOUS_ACCESS     0x0FAF	/**< number of reader the driver can manage */
Packit 9f0df5
#define TAG_IFD_POLLING_THREAD          0x0FB0	/**< not used. See TAG_IFD_POLLING_THREAD_WITH_TIMEOUT */
Packit 9f0df5
#define TAG_IFD_POLLING_THREAD_KILLABLE 0x0FB1	/**< the polling thread can be killed */
Packit 9f0df5
#define TAG_IFD_STOP_POLLING_THREAD     0x0FB2	/**< method used to stop the polling thread (instead of just pthread_kill()) */
Packit 9f0df5
#define TAG_IFD_POLLING_THREAD_WITH_TIMEOUT 0x0FB3	/**< driver uses a polling thread with a timeout parameter */
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * IFD Handler version number enummerations
Packit 9f0df5
	 */
Packit 9f0df5
#define IFD_HVERSION_1_0               0x00010000
Packit 9f0df5
#define IFD_HVERSION_2_0               0x00020000
Packit 9f0df5
#define IFD_HVERSION_3_0               0x00030000
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * List of defines available to ifdhandler
Packit 9f0df5
	 */
Packit 9f0df5
#define IFD_POWER_UP			500 /**< power up the card */
Packit 9f0df5
#define IFD_POWER_DOWN			501 /**< power down the card */
Packit 9f0df5
#define IFD_RESET			502 /**< warm reset */
Packit 9f0df5
Packit 9f0df5
#define IFD_NEGOTIATE_PTS1		1   /**< negotiate PTS1 */
Packit 9f0df5
#define IFD_NEGOTIATE_PTS2		2   /**< negotiate PTS2 */
Packit 9f0df5
#define IFD_NEGOTIATE_PTS3              4   /**< negotiate PTS3 */
Packit 9f0df5
Packit 9f0df5
#define	IFD_SUCCESS			0   /**< no error */
Packit 9f0df5
#define IFD_ERROR_TAG			600 /**< tag unknown */
Packit 9f0df5
#define IFD_ERROR_SET_FAILURE		601 /**< set failed */
Packit 9f0df5
#define IFD_ERROR_VALUE_READ_ONLY	602 /**< value is read only */
Packit 9f0df5
#define IFD_ERROR_PTS_FAILURE		605 /**< failed to negotiate PTS */
Packit 9f0df5
#define IFD_ERROR_NOT_SUPPORTED		606
Packit 9f0df5
#define IFD_PROTOCOL_NOT_SUPPORTED	607 /**< requested protocol not supported */
Packit 9f0df5
#define IFD_ERROR_POWER_ACTION		608 /**< power up failed */
Packit 9f0df5
#define IFD_ERROR_SWALLOW		609
Packit 9f0df5
#define IFD_ERROR_EJECT			610
Packit 9f0df5
#define IFD_ERROR_CONFISCATE		611
Packit 9f0df5
#define IFD_COMMUNICATION_ERROR		612 /**< generic error */
Packit 9f0df5
#define IFD_RESPONSE_TIMEOUT		613 /**< timeout */
Packit 9f0df5
#define IFD_NOT_SUPPORTED		614 /**< request is not supported */
Packit 9f0df5
#define IFD_ICC_PRESENT			615 /**< card is present */
Packit 9f0df5
#define IFD_ICC_NOT_PRESENT		616 /**< card is absent */
Packit 9f0df5
/**
Packit 9f0df5
 * The \ref IFD_NO_SUCH_DEVICE error must be returned by the driver when
Packit 9f0df5
 * it detects the reader is no more present. This will tell pcscd to
Packit 9f0df5
 * remove the reader from the list of available readers.
Packit 9f0df5
 */
Packit 9f0df5
#define IFD_NO_SUCH_DEVICE		617
Packit 9f0df5
#define IFD_ERROR_INSUFFICIENT_BUFFER	618 /**< buffer is too small */
Packit 9f0df5
Packit 9f0df5
#ifndef RESPONSECODE_DEFINED_IN_WINTYPES_H
Packit 9f0df5
	typedef long RESPONSECODE;
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * If you want to compile a V2.0 IFDHandler, define IFDHANDLERv2
Packit 9f0df5
	 * before you include this file.
Packit 9f0df5
	 *
Packit 9f0df5
	 * By default it is setup for for most recent version of the API (V3.0)
Packit 9f0df5
	 */
Packit 9f0df5
Packit 9f0df5
#ifndef IFDHANDLERv2
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * List of Defined Functions Available to IFD_Handler 3.0
Packit 9f0df5
	 *
Packit 9f0df5
	 * All the functions of IFD_Handler 2.0 are available
Packit 9f0df5
	 * IFDHCreateChannelByName() is new
Packit 9f0df5
	 * IFDHControl() API changed
Packit 9f0df5
	 */
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function is required to open a communications channel to the port
Packit 9f0df5
listed by @p DeviceName.
Packit 9f0df5
Packit 9f0df5
Once the channel is opened the reader must be in a state in which it is
Packit 9f0df5
possible to query IFDHICCPresence() for card status.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number\n
Packit 9f0df5
  Use this for multiple card slots or multiple readers. 0xXXXXYYYY -
Packit 9f0df5
  XXXX multiple readers, YYYY multiple slots. The resource manager will
Packit 9f0df5
  set these automatically. By default the resource manager loads a new
Packit 9f0df5
  instance of the driver so if your reader does not have more than one
Packit 9f0df5
  smart card slot then ignore the Lun in all the functions.\n
Packit 9f0df5
  \n
Packit 9f0df5
  PC/SC supports the loading of multiple readers through one instance of
Packit 9f0df5
  the driver in which XXXX is important. XXXX identifies the unique
Packit 9f0df5
  reader in which the driver communicates to. The driver should set up
Packit 9f0df5
  an array of structures that asociate this XXXX with the underlying
Packit 9f0df5
  details of the particular reader.
Packit 9f0df5
Packit 9f0df5
@param[in] DeviceName Filename to use by the driver.\n
Packit 9f0df5
  For drivers configured by @p /etc/reader.conf this is the value of the
Packit 9f0df5
  field \ref DEVICENAME.
Packit 9f0df5
  \n
Packit 9f0df5
  For USB drivers the @p DeviceName must start with @p usb:VID/PID. VID
Packit 9f0df5
  is the Vendor ID and PID is the Product ID. Both are a 4-digits hex
Packit 9f0df5
  number.
Packit 9f0df5
Packit 9f0df5
Typically the string is generated by:
Packit 9f0df5
Packit 9f0df5
@code
Packit 9f0df5
printf("usb:%04x/%04x", idVendor, idProduct);
Packit 9f0df5
@endcode
Packit 9f0df5
Packit 9f0df5
The @p DeviceName string may also contain a more specialised
Packit 9f0df5
identification string. This additional information is used to
Packit 9f0df5
differentiate between two identical readers connected at the same time.
Packit 9f0df5
In this case the driver can't differentiate the two readers using VID
Packit 9f0df5
and PID and must use some additional information identifying the USB
Packit 9f0df5
port used by each reader.
Packit 9f0df5
Packit 9f0df5
- libusb
Packit 9f0df5
Packit 9f0df5
  For USB drivers using libusb-1.0 http://libusb.sourceforge.net/ for USB
Packit 9f0df5
  abstraction the @p DeviceName the string may be generated by:
Packit 9f0df5
Packit 9f0df5
  @code
Packit 9f0df5
  printf("usb:%04x/%04x:libusb-1.0:%d:%d:%d",
Packit 9f0df5
    idVendor, idProduct, bus_number, device_address, interface)
Packit 9f0df5
  @endcode
Packit 9f0df5
Packit 9f0df5
  So it is something like: <tt>usb:08e6/3437:libusb-1.0:7:99:0</tt> under
Packit 9f0df5
  GNU/Linux.
Packit 9f0df5
Packit 9f0df5
- libudev
Packit 9f0df5
Packit 9f0df5
  If pcscd is compiled with libudev support instead of libusb (default
Packit 9f0df5
  since pcsc-lite 1.6.8) the string will look like:
Packit 9f0df5
Packit 9f0df5
  @code
Packit 9f0df5
  printf("usb:%04x/%04x:libudev:%d:%s", idVendor, idProduct,
Packit 9f0df5
		bInterfaceNumber, devpath);
Packit 9f0df5
  @endcode
Packit 9f0df5
Packit 9f0df5
  bInterfaceNumber is the number of the interface on the device. It is
Packit 9f0df5
  only usefull for devices with more than one CCID interface.
Packit 9f0df5
Packit 9f0df5
  devpath is the filename of the device on the file system.
Packit 9f0df5
Packit 9f0df5
  So it is something like:
Packit 9f0df5
  <tt>usb:08e6/3437:libudev:0:/dev/bus/usb/008/047</tt>
Packit 9f0df5
  under GNU/Linux.
Packit 9f0df5
Packit 9f0df5
- other
Packit 9f0df5
Packit 9f0df5
  If the driver does not understand the <tt>:libusb:</tt> or
Packit 9f0df5
  <tt>:libudev:</tt> scheme or if a new scheme is used, the driver should
Packit 9f0df5
  ignore the part it does not understand instead of failing.
Packit 9f0df5
Packit 9f0df5
  The driver shall recognize the <tt>usb:VID/PID</tt> part and, only if
Packit 9f0df5
  possible, the remaining of the DeviceName field.
Packit 9f0df5
Packit 9f0df5
  It is the responsibility of the driver to correctly identify the reader.
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
  */
Packit 9f0df5
RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR DeviceName);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function performs a data exchange with the reader (not the card)
Packit 9f0df5
specified by Lun. It is responsible for abstracting functionality such
Packit 9f0df5
as PIN pads, biometrics, LCD panels, etc. You should follow the MCT and
Packit 9f0df5
CTBCS specifications for a list of accepted commands to implement. This
Packit 9f0df5
function is fully voluntary and does not have to be implemented unless
Packit 9f0df5
you want extended functionality.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
@param[in] dwControlCode Control code for the operation\n
Packit 9f0df5
  This value identifies the specific operation to be performed. This
Packit 9f0df5
  value is driver specific.
Packit 9f0df5
@param[in] TxBuffer Transmit data
Packit 9f0df5
@param[in] TxLength Length of this buffer
Packit 9f0df5
@param[out] RxBuffer Receive data
Packit 9f0df5
@param[in] RxLength Length of the response buffer
Packit 9f0df5
@param[out] pdwBytesReturned Length of response\n
Packit 9f0df5
  This function will be passed the length of the buffer RxBuffer in
Packit 9f0df5
  RxLength and it must set the length of the received data in
Packit 9f0df5
  pdwBytesReturned.
Packit 9f0df5
Packit 9f0df5
@note
Packit 9f0df5
  @p *pdwBytesReturned should be set to zero on error.
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_RESPONSE_TIMEOUT The response timed out (\ref IFD_RESPONSE_TIMEOUT)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, PUCHAR
Packit 9f0df5
	TxBuffer, DWORD TxLength, PUCHAR RxBuffer, DWORD RxLength,
Packit 9f0df5
	LPDWORD pdwBytesReturned);
Packit 9f0df5
Packit 9f0df5
#else
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
 * Available in IFD_Handler 2.0
Packit 9f0df5
 *
Packit 9f0df5
 * @deprecated
Packit 9f0df5
 * You should use the new form of IFDHControl()
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHControl(DWORD Lun, PUCHAR TxBuffer, DWORD TxLength,
Packit 9f0df5
	PUCHAR RxBuffer, PDWORD RxLength);
Packit 9f0df5
Packit 9f0df5
#endif
Packit 9f0df5
Packit 9f0df5
	/*
Packit 9f0df5
	 * common functions in IFD_Handler 2.0 and 3.0
Packit 9f0df5
	 */
Packit 9f0df5
/**
Packit 9f0df5
This function is required to open a communications channel to the port
Packit 9f0df5
listed by Channel. For example, the first serial reader on COM1 would
Packit 9f0df5
link to @p /dev/pcsc/1 which would be a symbolic link to @p /dev/ttyS0
Packit 9f0df5
on some machines This is used to help with inter-machine independence.
Packit 9f0df5
Packit 9f0df5
On machines with no /dev directory the driver writer may choose to map
Packit 9f0df5
their Channel to whatever they feel is appropriate.
Packit 9f0df5
Packit 9f0df5
Once the channel is opened the reader must be in a state in which it is
Packit 9f0df5
possible to query IFDHICCPresence() for card status.
Packit 9f0df5
Packit 9f0df5
USB readers can ignore the @p Channel parameter and query the USB bus
Packit 9f0df5
for the particular reader by manufacturer and product id.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number\n
Packit 9f0df5
  Use this for multiple card slots or multiple readers. 0xXXXXYYYY -
Packit 9f0df5
  XXXX multiple readers, YYYY multiple slots. The resource manager will
Packit 9f0df5
  set these automatically. By default the resource manager loads a new
Packit 9f0df5
  instance of the driver so if your reader does not have more than one
Packit 9f0df5
  smart card slot then ignore the Lun in all the functions.\n
Packit 9f0df5
  \n
Packit 9f0df5
  PC/SC supports the loading of multiple readers through one instance of
Packit 9f0df5
  the driver in which XXXX is important. XXXX identifies the unique
Packit 9f0df5
  reader in which the driver communicates to. The driver should set up
Packit 9f0df5
  an array of structures that associate this XXXX with the underlying
Packit 9f0df5
  details of the particular reader.
Packit 9f0df5
@param[in] Channel Channel ID
Packit 9f0df5
  This is denoted by the following:
Packit 9f0df5
  - 0x000001 	@p /dev/pcsc/1
Packit 9f0df5
  - 0x000002 	@p /dev/pcsc/2
Packit 9f0df5
  - 0x000003 	@p /dev/pcsc/3
Packit 9f0df5
  - 0x000004 	@p /dev/pcsc/4
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHCreateChannel(DWORD Lun, DWORD Channel);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function should close the reader communication channel for the
Packit 9f0df5
particular reader. Prior to closing the communication channel the reader
Packit 9f0df5
should make sure the card is powered down and the terminal is also
Packit 9f0df5
powered down.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
  */
Packit 9f0df5
RESPONSECODE IFDHCloseChannel(DWORD Lun);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function should get the slot/card capabilities for a particular
Packit 9f0df5
slot/card specified by Lun. Again, if you have only 1 card slot and
Packit 9f0df5
don't mind loading a new driver for each reader then ignore Lun.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
@param[in] Tag Tag of the desired data value
Packit 9f0df5
- \ref TAG_IFD_ATR
Packit 9f0df5
  Return the ATR and its size (implementation is mandatory).
Packit 9f0df5
- \ref TAG_IFD_SLOTNUM
Packit 9f0df5
  Unused/deprecated
Packit 9f0df5
- \ref SCARD_ATTR_ATR_STRING
Packit 9f0df5
  Same as \ref TAG_IFD_ATR but this one is not mandatory. It is defined
Packit 9f0df5
  in Microsoft PC/SC SCardGetAttrib().
Packit 9f0df5
- \ref TAG_IFD_SIMULTANEOUS_ACCESS
Packit 9f0df5
  Return the number of sessions (readers) the driver can handle in
Packit 9f0df5
  <tt>Value[0]</tt>.
Packit 9f0df5
  This is used for multiple readers sharing the same driver.
Packit 9f0df5
- \ref TAG_IFD_THREAD_SAFE
Packit 9f0df5
  If the driver supports more than one reader (see
Packit 9f0df5
  \ref TAG_IFD_SIMULTANEOUS_ACCESS above) this tag indicates if the
Packit 9f0df5
  driver supports access to multiple readers at the same time.\n
Packit 9f0df5
  <tt>Value[0] = 1</tt> indicates the driver supports simultaneous accesses.
Packit 9f0df5
- \ref TAG_IFD_SLOTS_NUMBER
Packit 9f0df5
  Return the number of slots in this reader in <tt>Value[0]</tt>.
Packit 9f0df5
- \ref TAG_IFD_SLOT_THREAD_SAFE
Packit 9f0df5
  If the reader has more than one slot (see \ref TAG_IFD_SLOTS_NUMBER
Packit 9f0df5
  above) this tag indicates if the driver supports access to multiple
Packit 9f0df5
  slots of the same reader at the same time.\n
Packit 9f0df5
  <tt>Value[0] = 1</tt> indicates the driver supports simultaneous slot
Packit 9f0df5
  accesses.
Packit 9f0df5
- \ref TAG_IFD_POLLING_THREAD
Packit 9f0df5
  Unused/deprecated
Packit 9f0df5
- \ref TAG_IFD_POLLING_THREAD_WITH_TIMEOUT
Packit 9f0df5
  If the driver provides a polling thread then @p Value is a pointer to
Packit 9f0df5
  this function. The function prototype is:
Packit 9f0df5
@verbatim
Packit 9f0df5
  RESPONSECODE foo(DWORD Lun, int timeout);
Packit 9f0df5
@endverbatim
Packit 9f0df5
- \ref TAG_IFD_POLLING_THREAD_KILLABLE
Packit 9f0df5
  Tell if the polling thread can be killed (pthread_kill()) by pcscd
Packit 9f0df5
- \ref TAG_IFD_STOP_POLLING_THREAD
Packit 9f0df5
  Returns a pointer in @p Value to the function used to stop the polling
Packit 9f0df5
  thread returned by \ref TAG_IFD_POLLING_THREAD_WITH_TIMEOUT. The
Packit 9f0df5
  function prototype is:
Packit 9f0df5
@verbatim
Packit 9f0df5
  RESPONSECODE foo(DWORD Lun);
Packit 9f0df5
@endverbatim
Packit 9f0df5
@param[in,out] Length Length of the desired data value
Packit 9f0df5
@param[out] Value Value of the desired data
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_ERROR_TAG Invalid tag given (\ref IFD_ERROR_TAG)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHGetCapabilities(DWORD Lun, DWORD Tag, PDWORD Length,
Packit 9f0df5
	PUCHAR Value);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function should set the slot/card capabilities for a particular
Packit 9f0df5
slot/card specified by @p Lun. Again, if you have only 1 card slot and
Packit 9f0df5
don't mind loading a new driver for each reader then ignore @p Lun.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
@param[in] Tag Tag of the desired data value
Packit 9f0df5
@param[in,out] Length Length of the desired data value
Packit 9f0df5
@param[out] Value Value of the desired data
Packit 9f0df5
Packit 9f0df5
This function is also called when the application uses the PC/SC
Packit 9f0df5
SCardGetAttrib() function. The list of supported tags is not limited.
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_ERROR_TAG Invalid tag given (\ref IFD_ERROR_TAG)
Packit 9f0df5
@retval IFD_ERROR_SET_FAILURE Could not set value (\ref IFD_ERROR_SET_FAILURE)
Packit 9f0df5
@retval IFD_ERROR_VALUE_READ_ONLY Trying to set read only value (\ref IFD_ERROR_VALUE_READ_ONLY)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHSetCapabilities(DWORD Lun, DWORD Tag, DWORD Length, PUCHAR Value);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function should set the Protocol Type Selection (PTS) of a
Packit 9f0df5
particular card/slot using the three PTS parameters sent
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
@param[in] Protocol Desired protocol
Packit 9f0df5
- \ref SCARD_PROTOCOL_T0
Packit 9f0df5
  T=0 protocol
Packit 9f0df5
- \ref SCARD_PROTOCOL_T1
Packit 9f0df5
  T=1 protocol
Packit 9f0df5
@param[in] Flags Logical OR of possible values to determine which PTS values
Packit 9f0df5
to negotiate
Packit 9f0df5
- \ref IFD_NEGOTIATE_PTS1
Packit 9f0df5
- \ref IFD_NEGOTIATE_PTS2
Packit 9f0df5
- \ref IFD_NEGOTIATE_PTS3
Packit 9f0df5
@param[in] PTS1 1st PTS Value
Packit 9f0df5
@param[in] PTS2 2nd PTS Value
Packit 9f0df5
@param[in] PTS3 3rd PTS Value\n
Packit 9f0df5
  See ISO 7816/EMV documentation.
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_ERROR_PTS_FAILURE Could not set PTS value (\ref IFD_ERROR_PTS_FAILURE)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_PROTOCOL_NOT_SUPPORTED Protocol is not supported (\ref IFD_PROTOCOL_NOT_SUPPORTED)
Packit 9f0df5
@retval IFD_NOT_SUPPORTED Action not supported (\ref IFD_NOT_SUPPORTED)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHSetProtocolParameters(DWORD Lun, DWORD Protocol, UCHAR Flags,
Packit 9f0df5
	UCHAR PTS1, UCHAR PTS2, UCHAR PTS3);
Packit 9f0df5
/**
Packit 9f0df5
This function controls the power and reset signals of the smart card
Packit 9f0df5
reader at the particular reader/slot specified by @p Lun.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
@param[in] Action Action to be taken on the card
Packit 9f0df5
- \ref IFD_POWER_UP
Packit 9f0df5
  Power up the card (store and return Atr and AtrLength)
Packit 9f0df5
- \ref IFD_POWER_DOWN
Packit 9f0df5
  Power down the card (Atr and AtrLength should be zeroed)
Packit 9f0df5
- \ref IFD_RESET
Packit 9f0df5
  Perform a warm reset of the card (no power down). If the card is not powered then power up the card (store and return Atr and AtrLength)
Packit 9f0df5
@param[out] Atr Answer to Reset (ATR) of the card\n
Packit 9f0df5
  The driver is responsible for caching this value in case
Packit 9f0df5
  IFDHGetCapabilities() is called requesting the ATR and its length. The
Packit 9f0df5
  ATR length should not exceed \ref MAX_ATR_SIZE.
Packit 9f0df5
@param[in,out] AtrLength Length of the ATR\n
Packit 9f0df5
  This should not exceed \ref MAX_ATR_SIZE.
Packit 9f0df5
Packit 9f0df5
@note
Packit 9f0df5
Memory cards without an ATR should return \ref IFD_SUCCESS on reset but the
Packit 9f0df5
Atr should be zeroed and the length should be zero Reset errors should
Packit 9f0df5
return zero for the AtrLength and return \ref IFD_ERROR_POWER_ACTION.
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_ERROR_POWER_ACTION Error powering/resetting card (\ref IFD_ERROR_POWER_ACTION)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_NOT_SUPPORTED Action not supported (\ref IFD_NOT_SUPPORTED)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHPowerICC(DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD
Packit 9f0df5
	AtrLength);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function performs an APDU exchange with the card/slot specified by
Packit 9f0df5
Lun. The driver is responsible for performing any protocol specific
Packit 9f0df5
exchanges such as T=0, 1, etc. differences. Calling this function will
Packit 9f0df5
abstract all protocol differences.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
@param[in] SendPci contains two structure members
Packit 9f0df5
- Protocol 0, 1, ... 14\n
Packit 9f0df5
  T=0 ... T=14
Packit 9f0df5
- Length\n
Packit 9f0df5
  Not used.
Packit 9f0df5
@param[in] TxBuffer Transmit APDU\n
Packit 9f0df5
      Example: "\x00\xA4\x00\x00\x02\x3F\x00"
Packit 9f0df5
@param[in] TxLength Length of this buffer
Packit 9f0df5
@param[out] RxBuffer Receive APDU\n
Packit 9f0df5
      Example: "\x61\x14"
Packit 9f0df5
@param[in,out] RxLength Length of the received APDU\n
Packit 9f0df5
  This function will be passed the size of the buffer of RxBuffer and
Packit 9f0df5
  this function is responsible for setting this to the length of the
Packit 9f0df5
  received APDU response. This should be ZERO on all errors. The
Packit 9f0df5
  resource manager will take responsibility of zeroing out any temporary
Packit 9f0df5
  APDU buffers for security reasons.
Packit 9f0df5
@param[out] RecvPci contains two structure members
Packit 9f0df5
- Protocol - 0, 1, ... 14\n
Packit 9f0df5
  T=0 ... T=14
Packit 9f0df5
- Length\n
Packit 9f0df5
  Not used.
Packit 9f0df5
Packit 9f0df5
@note
Packit 9f0df5
The driver is responsible for knowing what type of card it has. If the
Packit 9f0df5
current slot/card contains a memory card then this command should ignore
Packit 9f0df5
the Protocol and use the MCT style commands for support for these style
Packit 9f0df5
cards and transmit them appropriately. If your reader does not support
Packit 9f0df5
memory cards or you don't want to implement this functionality, then
Packit 9f0df5
ignore this.
Packit 9f0df5
@par
Packit 9f0df5
RxLength should be set to zero on error.
Packit 9f0df5
@par
Packit 9f0df5
The driver is not responsible for doing an automatic Get Response
Packit 9f0df5
command for received buffers containing 61 XX.
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_RESPONSE_TIMEOUT The response timed out (\ref IFD_RESPONSE_TIMEOUT)
Packit 9f0df5
@retval IFD_ICC_NOT_PRESENT ICC is not present (\ref IFD_ICC_NOT_PRESENT)
Packit 9f0df5
@retval IFD_NOT_SUPPORTED Action not supported (\ref IFD_NOT_SUPPORTED)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHTransmitToICC(DWORD Lun, SCARD_IO_HEADER SendPci,
Packit 9f0df5
	PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, PDWORD
Packit 9f0df5
	RxLength, PSCARD_IO_HEADER RecvPci);
Packit 9f0df5
Packit 9f0df5
/**
Packit 9f0df5
This function returns the status of the card inserted in the reader/slot
Packit 9f0df5
specified by @p Lun. In cases where the device supports asynchronous
Packit 9f0df5
card insertion/removal detection, it is advised that the driver manages
Packit 9f0df5
this through a thread so the driver does not have to send and receive a
Packit 9f0df5
command each time this function is called.
Packit 9f0df5
Packit 9f0df5
@ingroup IFDHandler
Packit 9f0df5
@param[in] Lun Logical Unit Number
Packit 9f0df5
Packit 9f0df5
@return Error codes
Packit 9f0df5
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
Packit 9f0df5
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
Packit 9f0df5
@retval IFD_ICC_NOT_PRESENT ICC is not present (\ref IFD_ICC_NOT_PRESENT)
Packit 9f0df5
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
Packit 9f0df5
 */
Packit 9f0df5
RESPONSECODE IFDHICCPresence(DWORD Lun);
Packit 9f0df5
Packit 9f0df5
#endif