Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 8db5617ff88aacc3075d0be1db459900 > files > 93

pcsc-lite-doc-1.8.11-4.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>pcsc-lite: IFDHandler</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">pcsc-lite
   &#160;<span id="projectnumber">1.8.11</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">IFDHandler</div>  </div>
</div><!--header-->
<div class="contents">

<p>This provides reader specific low-level calls.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gabb9fe35a68fa080ce9397f0b830b1e7e"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gabb9fe35a68fa080ce9397f0b830b1e7e">IFDHCreateChannelByName</a> (DWORD Lun, LPSTR DeviceName)</td></tr>
<tr class="memdesc:gabb9fe35a68fa080ce9397f0b830b1e7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is required to open a communications channel to the port listed by <code>DeviceName</code>.  <a href="#gabb9fe35a68fa080ce9397f0b830b1e7e">More...</a><br /></td></tr>
<tr class="separator:gabb9fe35a68fa080ce9397f0b830b1e7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabc775e84456eab0bac55df678a147dc9"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gabc775e84456eab0bac55df678a147dc9">IFDHControl</a> (DWORD Lun, DWORD dwControlCode, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, DWORD RxLength, LPDWORD pdwBytesReturned)</td></tr>
<tr class="memdesc:gabc775e84456eab0bac55df678a147dc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function performs a data exchange with the reader (not the card) specified by Lun.  <a href="#gabc775e84456eab0bac55df678a147dc9">More...</a><br /></td></tr>
<tr class="separator:gabc775e84456eab0bac55df678a147dc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaccb95bc0b2e679c992c6928b0e0e3fe3"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gaccb95bc0b2e679c992c6928b0e0e3fe3">IFDHCreateChannel</a> (DWORD Lun, DWORD Channel)</td></tr>
<tr class="memdesc:gaccb95bc0b2e679c992c6928b0e0e3fe3"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is required to open a communications channel to the port listed by Channel.  <a href="#gaccb95bc0b2e679c992c6928b0e0e3fe3">More...</a><br /></td></tr>
<tr class="separator:gaccb95bc0b2e679c992c6928b0e0e3fe3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga372175bc1cb70ee90dc2f77ddf6275c3"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#ga372175bc1cb70ee90dc2f77ddf6275c3">IFDHCloseChannel</a> (DWORD Lun)</td></tr>
<tr class="memdesc:ga372175bc1cb70ee90dc2f77ddf6275c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function should close the reader communication channel for the particular reader.  <a href="#ga372175bc1cb70ee90dc2f77ddf6275c3">More...</a><br /></td></tr>
<tr class="separator:ga372175bc1cb70ee90dc2f77ddf6275c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga799aa26945bbd3f61aaa57107f63ae0b"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#ga799aa26945bbd3f61aaa57107f63ae0b">IFDHGetCapabilities</a> (DWORD Lun, DWORD Tag, PDWORD Length, PUCHAR Value)</td></tr>
<tr class="memdesc:ga799aa26945bbd3f61aaa57107f63ae0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function should get the slot/card capabilities for a particular slot/card specified by Lun.  <a href="#ga799aa26945bbd3f61aaa57107f63ae0b">More...</a><br /></td></tr>
<tr class="separator:ga799aa26945bbd3f61aaa57107f63ae0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab0ae04abb9850ccff194112bacd18fcb"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gab0ae04abb9850ccff194112bacd18fcb">IFDHSetCapabilities</a> (DWORD Lun, DWORD Tag, DWORD Length, PUCHAR Value)</td></tr>
<tr class="memdesc:gab0ae04abb9850ccff194112bacd18fcb"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function should set the slot/card capabilities for a particular slot/card specified by <code>Lun</code>.  <a href="#gab0ae04abb9850ccff194112bacd18fcb">More...</a><br /></td></tr>
<tr class="separator:gab0ae04abb9850ccff194112bacd18fcb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa6fc195cb450a147550f4671492257ad"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gaa6fc195cb450a147550f4671492257ad">IFDHSetProtocolParameters</a> (DWORD Lun, DWORD Protocol, UCHAR Flags, UCHAR PTS1, UCHAR PTS2, UCHAR PTS3)</td></tr>
<tr class="memdesc:gaa6fc195cb450a147550f4671492257ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function should set the Protocol Type Selection (PTS) of a particular card/slot using the three PTS parameters sent.  <a href="#gaa6fc195cb450a147550f4671492257ad">More...</a><br /></td></tr>
<tr class="separator:gaa6fc195cb450a147550f4671492257ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae6e70f53c76e9dab59164b2af8e9edfc"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gae6e70f53c76e9dab59164b2af8e9edfc">IFDHPowerICC</a> (DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD AtrLength)</td></tr>
<tr class="memdesc:gae6e70f53c76e9dab59164b2af8e9edfc"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function controls the power and reset signals of the smart card reader at the particular reader/slot specified by <code>Lun</code>.  <a href="#gae6e70f53c76e9dab59164b2af8e9edfc">More...</a><br /></td></tr>
<tr class="separator:gae6e70f53c76e9dab59164b2af8e9edfc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac86e07f01d11accda93fb80d3935eeed"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gac86e07f01d11accda93fb80d3935eeed">IFDHTransmitToICC</a> (DWORD Lun, <a class="el" href="ifdhandler_8h.html#a43943c1504e1306b4381181d5026986e">SCARD_IO_HEADER</a> SendPci, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, PDWORD RxLength, <a class="el" href="struct__SCARD__IO__HEADER.html">PSCARD_IO_HEADER</a> RecvPci)</td></tr>
<tr class="memdesc:gac86e07f01d11accda93fb80d3935eeed"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function performs an APDU exchange with the card/slot specified by Lun.  <a href="#gac86e07f01d11accda93fb80d3935eeed">More...</a><br /></td></tr>
<tr class="separator:gac86e07f01d11accda93fb80d3935eeed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac0ef46f09df179c44a82259468bea174"><td class="memItemLeft" align="right" valign="top">RESPONSECODE&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__IFDHandler.html#gac0ef46f09df179c44a82259468bea174">IFDHICCPresence</a> (DWORD Lun)</td></tr>
<tr class="memdesc:gac0ef46f09df179c44a82259468bea174"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function returns the status of the card inserted in the reader/slot specified by <code>Lun</code>.  <a href="#gac0ef46f09df179c44a82259468bea174">More...</a><br /></td></tr>
<tr class="separator:gac0ef46f09df179c44a82259468bea174"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This provides reader specific low-level calls. </p>
<p>The routines specified hereafter will allow you to write an IFD handler for the PC/SC Lite resource manager. Please use the complement developer's kit complete with headers and Makefile at: <a href="http://www.musclecard.com/drivers.html">http://www.musclecard.com/drivers.html</a></p>
<p>This gives a common API for communication to most readers in a homogeneous fashion. This document assumes that the driver developer is experienced with standards such as ISO-7816-(1, 2, 3, 4), EMV and MCT specifications. For listings of these specifications please access the above web site.</p>
<h1><a class="anchor" id="UsbReaders"></a>
USB readers</h1>
<p>USB readers use the bundle approach so that the reader can be loaded and unloaded upon automatic detection of the device. The bundle approach is simple: the actual library is just embedded in a directory so additional information can be gathered about the device.</p>
<p>A bundle looks like the following:</p>
<pre class="fragment">GenericReader.bundle/
  Contents/
    Info.plist  - XML file describing the reader
    MacOS/      - Driver directory for OS X
    Solaris/    - Driver directory for Solaris
    Linux/      - Driver directory for Linux
    HPUX/       - Driver directory for HPUX
</pre><p>The <code>Info.plist</code> file describes the driver and gives the loader all the necessary information. The following must be contained in the <code>Info.plist</code> file:</p>
<h2><a class="anchor" id="ifdVendorID"></a>
ifdVendorID</h2>
<p>The vendor ID of the USB device.</p>
<p>Example:</p>
<pre class="fragment">    &lt;key&gt;ifdVendorID&lt;/key&gt;
    &lt;string&gt;0x04E6&lt;/string&gt;
</pre><p>You may have an OEM of this reader in which an additional <code></code> &lt;string&gt; can be used like in the below example:</p>
<pre class="fragment">    &lt;key&gt;ifdVendorID&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;0x04E6&lt;/string&gt;
      &lt;string&gt;0x0973&lt;/string&gt;
    &lt;/array&gt;
</pre><p>If multiples exist all the other parameters must have a second value also. You may chose not to support this feature but it is useful when reader vendors OEM products so you only distribute one driver.</p>
<p>The CCID driver from Ludovic Rousseau <a href="http://pcsclite.alioth.debian.org/ccid.html">http://pcsclite.alioth.debian.org/ccid.html</a> uses this feature since the same driver supports many different readers.</p>
<h2><a class="anchor" id="ifdProductID"></a>
ifdProductID</h2>
<p>The product id of the USB device.</p>
<pre class="fragment">   &lt;key&gt;ifdProductID&lt;/key&gt;
   &lt;string&gt;0x3437&lt;/string&gt;
</pre><h2><a class="anchor" id="ifdFriendlyName"></a>
ifdFriendlyName</h2>
<p>Example:</p>
<pre class="fragment">   &lt;key&gt;ifdFriendlyName&lt;/key&gt;
   &lt;string&gt;SCM Microsystems USB Reader&lt;/string&gt;
</pre><h2><a class="anchor" id="CFBundleExecutable"></a>
CFBundleExecutable</h2>
<p>The executable name which exists in the particular platform's directory.</p>
<p>Example:</p>
<pre class="fragment">   &lt;key&gt;CFBundleExecutable&lt;/key&gt;
   &lt;string&gt;libccid.so.0.4.2&lt;/string&gt;
</pre><h2><a class="anchor" id="ifdCapabilities"></a>
ifdCapabilities</h2>
<p>List of capabilities supported by the driver. This is a bit field. Possible values are:</p>
<ul>
<li>0 No special capabilities</li>
<li>1 IFD_GENERATE_HOTPLUG The driver supports the hot plug feature.</li>
</ul>
<p>Complete sample file:</p>
<pre class="fragment">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt;
    &lt;string&gt;English&lt;/string&gt;
    &lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt;
    &lt;string&gt;6.0&lt;/string&gt;
    &lt;key&gt;CFBundlePackageType&lt;/key&gt;
    &lt;string&gt;BNDL&lt;/string&gt;
    &lt;key&gt;CFBundleSignature&lt;/key&gt;
    &lt;string&gt;????&lt;/string&gt;
    &lt;key&gt;CFBundleVersion&lt;/key&gt;
    &lt;string&gt;0.0.1d1&lt;/string&gt;
    &lt;key&gt;ifdCapabilities&lt;/key&gt;
    &lt;string&gt;0x00000000&lt;/string&gt;
    &lt;key&gt;ifdProtocolSupport&lt;/key&gt;
    &lt;string&gt;0x00000001&lt;/string&gt;
    &lt;key&gt;ifdVersionNumber&lt;/key&gt;
    &lt;string&gt;0x00000001&lt;/string&gt;

    &lt;key&gt;CFBundleExecutable&lt;/key&gt;
    &lt;string&gt;libfoobar.so.x.y&lt;/string&gt;

    &lt;key&gt;ifdManufacturerString&lt;/key&gt;
    &lt;string&gt;Foo bar inc.&lt;/string&gt;

    &lt;key&gt;ifdProductString&lt;/key&gt;
    &lt;string&gt;Driver for Foobar reader, version x.y&lt;/string&gt;

    &lt;key&gt;ifdVendorID&lt;/key&gt;
    &lt;string&gt;0x1234&lt;/string&gt;

    &lt;key&gt;ifdProductID&lt;/key&gt;
    &lt;string&gt;0x5678&lt;/string&gt;

    &lt;key&gt;ifdFriendlyName&lt;/key&gt;
    &lt;string&gt;Foobar USB reader&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre><p>As indicated in the XML file the DTD is available at <a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd">http://www.apple.com/DTDs/PropertyList-1.0.dtd</a>.</p>
<h1><a class="anchor" id="SerialReaders"></a>
Serial readers</h1>
<p>Serial drivers must be configured to operate on a particular port and respond to a particular name. The <code>reader.conf</code> file is used for this purpose.</p>
<p>It has the following syntax:</p>
<pre class="fragment"># Configuration file for pcsc-lite
# David Corcoran &lt;corcoran@musclecard.com&gt;

FRIENDLYNAME  Generic Reader
DEVICENAME    /dev/ttyS0
LIBPATH       /usr/lib/pcsc/drivers/libgen_ifd.so
CHANNELID     1
</pre><p>The pound sign # denotes a comment.</p>
<h2><a class="anchor" id="FRIENDLYNAME"></a>
FRIENDLYNAME</h2>
<p>The FRIENDLYNAME field is an arbitrary text used to identify the reader. This text is displayed by commands like <code>pcsc_scan</code> <a href="http://ludovic.rousseau.free.fr/softwares/pcsc-tools/">http://ludovic.rousseau.free.fr/softwares/pcsc-tools/</a> that prints the names of all the connected and detected readers.</p>
<h2><a class="anchor" id="DEVICENAME"></a>
DEVICENAME</h2>
<p>The DEVICENAME field was not used for old drivers (using the IFD handler version 2.0 or previous). It is now (IFD handler version 3.0) used to identify the physical port on which the reader is connected. This is the device name of this port. It is dependent of the OS kernel. For example the first serial port device is called <code>/dev/ttyS0</code> under Linux and <code>/dev/cuaa0</code> under FreeBSD.</p>
<p>If you want to use <a class="el" href="group__IFDHandler.html#gaccb95bc0b2e679c992c6928b0e0e3fe3" title="This function is required to open a communications channel to the port listed by Channel. ">IFDHCreateChannel()</a> instead of <a class="el" href="group__IFDHandler.html#gabb9fe35a68fa080ce9397f0b830b1e7e" title="This function is required to open a communications channel to the port listed by DeviceName. ">IFDHCreateChannelByName()</a> then do not use any DEVICENAME line in the configuration file. <a class="el" href="group__IFDHandler.html#gaccb95bc0b2e679c992c6928b0e0e3fe3" title="This function is required to open a communications channel to the port listed by Channel. ">IFDHCreateChannel()</a> will then be called with the CHANNELID parameter.</p>
<h2><a class="anchor" id="LIBPATH"></a>
LIBPATH</h2>
<p>The LIBPATH field is the filename of the driver code. The driver is a dynamically loaded piece of code (generally a <code>drivername.so*</code> file).</p>
<h2><a class="anchor" id="CHANNELID"></a>
CHANNELID</h2>
<p>The CHANNELID is no more used for recent drivers (IFD handler 3.0) and has been superseded by DEVICENAME.</p>
<p>If you have an old driver this field is used to indicate the port to use. You should read your driver documentation to know what information is needed here. It should be the serial port number for a serial reader.</p>
<p>CHANNELID was the numeric version of the port in which the reader will be located. This may be done by a symbolic link where <code>/dev/pcsc/1</code> is the first device which may be a symbolic link to <code>/dev/ttyS0</code> or whichever location your reader resides. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga372175bc1cb70ee90dc2f77ddf6275c3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHCloseChannel </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function should close the reader communication channel for the particular reader. </p>
<p>Prior to closing the communication channel the reader should make sure the card is powered down and the terminal is also powered down.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00168">IFDCloseIFD()</a>.</p>

</div>
</div>
<a class="anchor" id="gabc775e84456eab0bac55df678a147dc9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHControl </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>dwControlCode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>TxBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>TxLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>RxBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>RxLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPDWORD&#160;</td>
          <td class="paramname"><em>pdwBytesReturned</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function performs a data exchange with the reader (not the card) specified by Lun. </p>
<p>It is responsible for abstracting functionality such as PIN pads, biometrics, LCD panels, etc. You should follow the MCT and CTBCS specifications for a list of accepted commands to implement. This function is fully voluntary and does not have to be implemented unless you want extended functionality.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">dwControlCode</td><td>Control code for the operation<br />
 This value identifies the specific operation to be performed. This value is driver specific. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">TxBuffer</td><td>Transmit data </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">TxLength</td><td>Length of this buffer </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">RxBuffer</td><td>Receive data </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">RxLength</td><td>Length of the response buffer </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">pdwBytesReturned</td><td>Length of response<br />
 This function will be passed the length of the buffer RxBuffer in RxLength and it must set the length of the received data in pdwBytesReturned.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd><code>*pdwBytesReturned</code> should be set to zero on error.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_RESPONSE_TIMEOUT</td><td>The response timed out (<a class="el" href="ifdhandler_8h.html#a7dbdd1a8970ac18080eb01d891915d38">IFD_RESPONSE_TIMEOUT</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00452">IFDControl()</a>.</p>

</div>
</div>
<a class="anchor" id="gaccb95bc0b2e679c992c6928b0e0e3fe3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHCreateChannel </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Channel</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is required to open a communications channel to the port listed by Channel. </p>
<p>For example, the first serial reader on COM1 would link to <code>/dev/pcsc/1</code> which would be a symbolic link to <code>/dev/ttyS0</code> on some machines This is used to help with inter-machine independence.</p>
<p>On machines with no /dev directory the driver writer may choose to map their Channel to whatever they feel is appropriate.</p>
<p>Once the channel is opened the reader must be in a state in which it is possible to query <a class="el" href="group__IFDHandler.html#gac0ef46f09df179c44a82259468bea174" title="This function returns the status of the card inserted in the reader/slot specified by Lun...">IFDHICCPresence()</a> for card status.</p>
<p>USB readers can ignore the <code>Channel</code> parameter and query the USB bus for the particular reader by manufacturer and product id.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number<br />
 Use this for multiple card slots or multiple readers. 0xXXXXYYYY - XXXX multiple readers, YYYY multiple slots. The resource manager will set these automatically. By default the resource manager loads a new instance of the driver so if your reader does not have more than one smart card slot then ignore the Lun in all the functions.<br />
 <br />
 PC/SC supports the loading of multiple readers through one instance of the driver in which XXXX is important. XXXX identifies the unique reader in which the driver communicates to. The driver should set up an array of structures that associate this XXXX with the underlying details of the particular reader. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">Channel</td><td>Channel ID This is denoted by the following:<ul>
<li>0x000001 <code>/dev/pcsc/1</code> </li>
<li>0x000002 <code>/dev/pcsc/2</code> </li>
<li>0x000003 <code>/dev/pcsc/3</code> </li>
<li>0x000004 <code>/dev/pcsc/4</code> </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00110">IFDOpenIFD()</a>.</p>

</div>
</div>
<a class="anchor" id="gabb9fe35a68fa080ce9397f0b830b1e7e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHCreateChannelByName </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">LPSTR&#160;</td>
          <td class="paramname"><em>DeviceName</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is required to open a communications channel to the port listed by <code>DeviceName</code>. </p>
<p>Once the channel is opened the reader must be in a state in which it is possible to query <a class="el" href="group__IFDHandler.html#gac0ef46f09df179c44a82259468bea174" title="This function returns the status of the card inserted in the reader/slot specified by Lun...">IFDHICCPresence()</a> for card status.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number<br />
 Use this for multiple card slots or multiple readers. 0xXXXXYYYY - XXXX multiple readers, YYYY multiple slots. The resource manager will set these automatically. By default the resource manager loads a new instance of the driver so if your reader does not have more than one smart card slot then ignore the Lun in all the functions.<br />
 <br />
 PC/SC supports the loading of multiple readers through one instance of the driver in which XXXX is important. XXXX identifies the unique reader in which the driver communicates to. The driver should set up an array of structures that asociate this XXXX with the underlying details of the particular reader.</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">DeviceName</td><td>Filename to use by the driver.<br />
 For drivers configured by <code>/etc/reader</code>.conf this is the value of the field <a class="el" href="group__IFDHandler.html#DEVICENAME">DEVICENAME</a>. <br />
 For USB drivers the <code>DeviceName</code> must start with <code>usb:VID/PID</code>. VID is the Vendor ID and PID is the Product ID. Both are a 4-digits hex number.</td></tr>
  </table>
  </dd>
</dl>
<p>Typically the string is generated by:</p>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;printf(&quot;usb:%04x/%04x&quot;, idVendor, idProduct);</div>
</div><!-- fragment --><p>The <code>DeviceName</code> string may also contain a more specialised identification string. This additional information is used to differentiate between two identical readers connected at the same time. In this case the driver can't differentiate the two readers using VID and PID and must use some additional information identifying the USB port used by each reader.</p>
<ul>
<li><p class="startli">libusb</p>
<p class="startli">For USB drivers using libusb-1.0 <a href="http://libusb.sourceforge.net/">http://libusb.sourceforge.net/</a> for USB abstraction the <code>DeviceName</code> the string may be generated by:</p>
</li>
</ul>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;printf(&quot;usb:%04x/%04x:libusb-1.0:%d:%d:%d&quot;,</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;  idVendor, idProduct, bus_number, device_address, interface)</div>
</div><!-- fragment --><p>So it is something like: <code>usb:08e6/3437:libusb-1.0:7:99:0</code> under GNU/Linux.</p>
<ul>
<li><p class="startli">libudev</p>
<p class="startli">If pcscd is compiled with libudev support instead of libusb (default since pcsc-lite 1.6.8) the string will look like:</p>
</li>
</ul>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;printf(&quot;usb:%04x/%04x:libudev:%d:%s&quot;, idVendor, idProduct,</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;      bInterfaceNumber, devpath);</div>
</div><!-- fragment --><p>bInterfaceNumber is the number of the interface on the device. It is only usefull for devices with more than one CCID interface.</p>
<p>devpath is the filename of the device on the file system.</p>
<p>So it is something like: <code>usb:08e6/3437:libudev:0:/dev/bus/usb/008/047</code> under GNU/Linux.</p>
<ul>
<li><p class="startli">other</p>
<p class="startli">If the driver does not understand the <code>:libusb:</code> or <code>:libudev:</code> scheme or if a new scheme is used, the driver should ignore the part it does not understand instead of failing.</p>
<p class="startli">The driver shall recognize the <code>usb:VID/PID</code> part and, only if possible, the remaining of the DeviceName field.</p>
<p class="startli">It is the responsibility of the driver to correctly identify the reader.</p>
</li>
</ul>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00110">IFDOpenIFD()</a>.</p>

</div>
</div>
<a class="anchor" id="ga799aa26945bbd3f61aaa57107f63ae0b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHGetCapabilities </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Tag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PDWORD&#160;</td>
          <td class="paramname"><em>Length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>Value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function should get the slot/card capabilities for a particular slot/card specified by Lun. </p>
<p>Again, if you have only 1 card slot and don't mind loading a new driver for each reader then ignore Lun.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">Tag</td><td>Tag of the desired data value<ul>
<li><a class="el" href="ifdhandler_8h.html#ae4cc2d502b6cfec5843c116f1ebb552c">TAG_IFD_ATR</a> Return the ATR and its size (implementation is mandatory).</li>
<li><a class="el" href="ifdhandler_8h.html#a3c90855349c36c1c6235c43c44fccca9">TAG_IFD_SLOTNUM</a> Unused/deprecated</li>
<li><a class="el" href="reader_8h.html#ae450bada1fa917057610dd0446983784">SCARD_ATTR_ATR_STRING</a> Same as <a class="el" href="ifdhandler_8h.html#ae4cc2d502b6cfec5843c116f1ebb552c">TAG_IFD_ATR</a> but this one is not mandatory. It is defined in Microsoft PC/SC <a class="el" href="group__API.html#gaacfec51917255b7a25b94c5104961602" title="Get an attribute from the IFD Handler (reader driver). ">SCardGetAttrib()</a>.</li>
<li><a class="el" href="ifdhandler_8h.html#a0bcde8044065d9932267cc2144e56fe4">TAG_IFD_SIMULTANEOUS_ACCESS</a> Return the number of sessions (readers) the driver can handle in <code>Value[0]</code>. This is used for multiple readers sharing the same driver.</li>
<li><a class="el" href="ifdhandler_8h.html#a2bdd375902612f9aa3288bd1b8850c4c">TAG_IFD_THREAD_SAFE</a> If the driver supports more than one reader (see <a class="el" href="ifdhandler_8h.html#a0bcde8044065d9932267cc2144e56fe4">TAG_IFD_SIMULTANEOUS_ACCESS</a> above) this tag indicates if the driver supports access to multiple readers at the same time.<br />
 <code>Value[0] = 1</code> indicates the driver supports simultaneous accesses.</li>
<li><a class="el" href="ifdhandler_8h.html#a5f8efe163602bafbc3d2b165c5c8aec5">TAG_IFD_SLOTS_NUMBER</a> Return the number of slots in this reader in <code>Value[0]</code>.</li>
<li><a class="el" href="ifdhandler_8h.html#ac7f75f65ca08c10293f81835496241c4">TAG_IFD_SLOT_THREAD_SAFE</a> If the reader has more than one slot (see <a class="el" href="ifdhandler_8h.html#a5f8efe163602bafbc3d2b165c5c8aec5">TAG_IFD_SLOTS_NUMBER</a> above) this tag indicates if the driver supports access to multiple slots of the same reader at the same time.<br />
 <code>Value[0] = 1</code> indicates the driver supports simultaneous slot accesses.</li>
<li><a class="el" href="ifdhandler_8h.html#a77f6ca5905856cd9f8c176e722f105dd">TAG_IFD_POLLING_THREAD</a> Unused/deprecated</li>
<li><a class="el" href="ifdhandler_8h.html#aad5f8bb68abbed2d322558d6c853f2a7">TAG_IFD_POLLING_THREAD_WITH_TIMEOUT</a> If the driver provides a polling thread then <code>Value</code> is a pointer to this function. The function prototype is: <pre class="fragment">  RESPONSECODE foo(DWORD Lun, int timeout);
</pre></li>
<li><a class="el" href="ifdhandler_8h.html#ab110837652c9e2ad902199148fe6193f">TAG_IFD_POLLING_THREAD_KILLABLE</a> Tell if the polling thread can be killed (pthread_kill()) by pcscd</li>
<li><a class="el" href="ifdhandler_8h.html#a2b2dca31df9201bebdf61697cec1df2f">TAG_IFD_STOP_POLLING_THREAD</a> Returns a pointer in <code>Value</code> to the function used to stop the polling thread returned by <a class="el" href="ifdhandler_8h.html#aad5f8bb68abbed2d322558d6c853f2a7">TAG_IFD_POLLING_THREAD_WITH_TIMEOUT</a>. The function prototype is: <pre class="fragment">  RESPONSECODE foo(DWORD Lun);
</pre> </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">Length</td><td>Length of the desired data value </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">Value</td><td>Value of the desired data</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_ERROR_TAG</td><td>Invalid tag given (<a class="el" href="ifdhandler_8h.html#a1e29ead07807cd3c5f62844af4f3f6f7">IFD_ERROR_TAG</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00240">IFDGetCapabilities()</a>.</p>

</div>
</div>
<a class="anchor" id="gac0ef46f09df179c44a82259468bea174"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHICCPresence </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function returns the status of the card inserted in the reader/slot specified by <code>Lun</code>. </p>
<p>In cases where the device supports asynchronous card insertion/removal detection, it is advised that the driver manages this through a thread so the driver does not have to send and receive a command each time this function is called.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_ICC_NOT_PRESENT</td><td>ICC is not present (<a class="el" href="ifdhandler_8h.html#ad17dec712379cf6032b6d9cf172ab9c8">IFD_ICC_NOT_PRESENT</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00344">IFDStatusICC()</a>.</p>

</div>
</div>
<a class="anchor" id="gae6e70f53c76e9dab59164b2af8e9edfc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHPowerICC </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Action</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>Atr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PDWORD&#160;</td>
          <td class="paramname"><em>AtrLength</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function controls the power and reset signals of the smart card reader at the particular reader/slot specified by <code>Lun</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">Action</td><td>Action to be taken on the card<ul>
<li><a class="el" href="ifdhandler_8h.html#a103a0059929b2de2a5426ed5dc5fa307">IFD_POWER_UP</a> Power up the card (store and return Atr and AtrLength)</li>
<li><a class="el" href="ifdhandler_8h.html#a57f2b27f291e616cfca666f7b91781c3">IFD_POWER_DOWN</a> Power down the card (Atr and AtrLength should be zeroed)</li>
<li><a class="el" href="ifdhandler_8h.html#a6a85965d96bdaa4a69ff4b751801cd73">IFD_RESET</a> 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) </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">Atr</td><td>Answer to Reset (ATR) of the card<br />
 The driver is responsible for caching this value in case <a class="el" href="group__IFDHandler.html#ga799aa26945bbd3f61aaa57107f63ae0b" title="This function should get the slot/card capabilities for a particular slot/card specified by Lun...">IFDHGetCapabilities()</a> is called requesting the ATR and its length. The ATR length should not exceed <a class="el" href="pcsclite_8h.html#a7ac7915ff6f9baefa66886c98bdbb91e">MAX_ATR_SIZE</a>. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">AtrLength</td><td>Length of the ATR<br />
 This should not exceed <a class="el" href="pcsclite_8h.html#a7ac7915ff6f9baefa66886c98bdbb91e">MAX_ATR_SIZE</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Memory cards without an ATR should return <a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a> on reset but the Atr should be zeroed and the length should be zero Reset errors should return zero for the AtrLength and return <a class="el" href="ifdhandler_8h.html#a1f0732913b055cb62cf09169a5dfc26b">IFD_ERROR_POWER_ACTION</a>.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_ERROR_POWER_ACTION</td><td>Error powering/resetting card (<a class="el" href="ifdhandler_8h.html#a1f0732913b055cb62cf09169a5dfc26b">IFD_ERROR_POWER_ACTION</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_NOT_SUPPORTED</td><td>Action not supported (<a class="el" href="ifdhandler_8h.html#a35aea7275c1fcb4e97d57f6c8fa28918">IFD_NOT_SUPPORTED</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00270">IFDPowerICC()</a>.</p>

</div>
</div>
<a class="anchor" id="gab0ae04abb9850ccff194112bacd18fcb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHSetCapabilities </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Tag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>Value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function should set the slot/card capabilities for a particular slot/card specified by <code>Lun</code>. </p>
<p>Again, if you have only 1 card slot and don't mind loading a new driver for each reader then ignore <code>Lun</code>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">Tag</td><td>Tag of the desired data value </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">Length</td><td>Length of the desired data value </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">Value</td><td>Value of the desired data</td></tr>
  </table>
  </dd>
</dl>
<p>This function is also called when the application uses the PC/SC <a class="el" href="group__API.html#gaacfec51917255b7a25b94c5104961602" title="Get an attribute from the IFD Handler (reader driver). ">SCardGetAttrib()</a> function. The list of supported tags is not limited.</p>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_ERROR_TAG</td><td>Invalid tag given (<a class="el" href="ifdhandler_8h.html#a1e29ead07807cd3c5f62844af4f3f6f7">IFD_ERROR_TAG</a>) </td></tr>
    <tr><td class="paramname">IFD_ERROR_SET_FAILURE</td><td>Could not set value (<a class="el" href="ifdhandler_8h.html#ac592adb8501fc38c61577276b9400054">IFD_ERROR_SET_FAILURE</a>) </td></tr>
    <tr><td class="paramname">IFD_ERROR_VALUE_READ_ONLY</td><td>Trying to set read only value (<a class="el" href="ifdhandler_8h.html#aba154400f746cc9808bd71e88e378520">IFD_ERROR_VALUE_READ_ONLY</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00209">IFDSetCapabilities()</a>.</p>

</div>
</div>
<a class="anchor" id="gaa6fc195cb450a147550f4671492257ad"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHSetProtocolParameters </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Protocol</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UCHAR&#160;</td>
          <td class="paramname"><em>Flags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UCHAR&#160;</td>
          <td class="paramname"><em>PTS1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UCHAR&#160;</td>
          <td class="paramname"><em>PTS2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UCHAR&#160;</td>
          <td class="paramname"><em>PTS3</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function should set the Protocol Type Selection (PTS) of a particular card/slot using the three PTS parameters sent. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">Protocol</td><td>Desired protocol<ul>
<li><a class="el" href="pcsclite_8h.html#a4fe95267c322c3bf35f30fab6b25526c">SCARD_PROTOCOL_T0</a> T=0 protocol</li>
<li><a class="el" href="pcsclite_8h.html#a3c09cd155e07044f857130c183d64f03">SCARD_PROTOCOL_T1</a> T=1 protocol </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">Flags</td><td>Logical OR of possible values to determine which PTS values to negotiate<ul>
<li><a class="el" href="ifdhandler_8h.html#abadff53edfa14ae3dae055a5d873d68c">IFD_NEGOTIATE_PTS1</a></li>
<li><a class="el" href="ifdhandler_8h.html#aca3ae474efbed3bd173649f2b1443776">IFD_NEGOTIATE_PTS2</a></li>
<li><a class="el" href="ifdhandler_8h.html#a0e25223b36a5085bd29389fac1203781">IFD_NEGOTIATE_PTS3</a> </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">PTS1</td><td>1st PTS Value </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">PTS2</td><td>2nd PTS Value </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">PTS3</td><td>3rd PTS Value<br />
 See ISO 7816/EMV documentation.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_ERROR_PTS_FAILURE</td><td>Could not set PTS value (<a class="el" href="ifdhandler_8h.html#a35270664ceffa91b2bffe6114f80e15a">IFD_ERROR_PTS_FAILURE</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_PROTOCOL_NOT_SUPPORTED</td><td>Protocol is not supported (<a class="el" href="ifdhandler_8h.html#a920dd667096ace9714f4cdcbcf687cf3">IFD_PROTOCOL_NOT_SUPPORTED</a>) </td></tr>
    <tr><td class="paramname">IFD_NOT_SUPPORTED</td><td>Action not supported (<a class="el" href="ifdhandler_8h.html#a35aea7275c1fcb4e97d57f6c8fa28918">IFD_NOT_SUPPORTED</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00072">IFDSetPTS()</a>.</p>

</div>
</div>
<a class="anchor" id="gac86e07f01d11accda93fb80d3935eeed"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">RESPONSECODE IFDHTransmitToICC </td>
          <td>(</td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>Lun</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="ifdhandler_8h.html#a43943c1504e1306b4381181d5026986e">SCARD_IO_HEADER</a>&#160;</td>
          <td class="paramname"><em>SendPci</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>TxBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DWORD&#160;</td>
          <td class="paramname"><em>TxLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PUCHAR&#160;</td>
          <td class="paramname"><em>RxBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">PDWORD&#160;</td>
          <td class="paramname"><em>RxLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct__SCARD__IO__HEADER.html">PSCARD_IO_HEADER</a>&#160;</td>
          <td class="paramname"><em>RecvPci</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function performs an APDU exchange with the card/slot specified by Lun. </p>
<p>The driver is responsible for performing any protocol specific exchanges such as T=0, 1, etc. differences. Calling this function will abstract all protocol differences.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">Lun</td><td>Logical Unit Number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">SendPci</td><td>contains two structure members<ul>
<li>Protocol 0, 1, ... 14<br />
 T=0 ... T=14</li>
<li>Length<br />
 Not used. </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">TxBuffer</td><td>Transmit APDU<br />
 Example: "\x00\xA4\x00\x00\x02\x3F\x00" </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">TxLength</td><td>Length of this buffer </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">RxBuffer</td><td>Receive APDU<br />
 Example: "\x61\x14" </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">RxLength</td><td>Length of the received APDU<br />
 This function will be passed the size of the buffer of RxBuffer and this function is responsible for setting this to the length of the received APDU response. This should be ZERO on all errors. The resource manager will take responsibility of zeroing out any temporary APDU buffers for security reasons. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">RecvPci</td><td>contains two structure members<ul>
<li>Protocol - 0, 1, ... 14<br />
 T=0 ... T=14</li>
<li>Length<br />
 Not used.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The driver is responsible for knowing what type of card it has. If the current slot/card contains a memory card then this command should ignore the Protocol and use the MCT style commands for support for these style cards and transmit them appropriately. If your reader does not support memory cards or you don't want to implement this functionality, then ignore this. </dd></dl>
<dl class="section user"><dt></dt><dd>RxLength should be set to zero on error. </dd></dl>
<dl class="section user"><dt></dt><dd>The driver is not responsible for doing an automatic Get Response command for received buffers containing 61 XX.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Error codes </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">IFD_SUCCESS</td><td>Successful (<a class="el" href="ifdhandler_8h.html#ae45ef2a236e5e6f15eb6b24a7bdf2d72">IFD_SUCCESS</a>) </td></tr>
    <tr><td class="paramname">IFD_COMMUNICATION_ERROR</td><td>Error has occurred (<a class="el" href="ifdhandler_8h.html#afb79c344e9ae986a97b4d4b1df2e1830">IFD_COMMUNICATION_ERROR</a>) </td></tr>
    <tr><td class="paramname">IFD_RESPONSE_TIMEOUT</td><td>The response timed out (<a class="el" href="ifdhandler_8h.html#a7dbdd1a8970ac18080eb01d891915d38">IFD_RESPONSE_TIMEOUT</a>) </td></tr>
    <tr><td class="paramname">IFD_ICC_NOT_PRESENT</td><td>ICC is not present (<a class="el" href="ifdhandler_8h.html#ad17dec712379cf6032b6d9cf172ab9c8">IFD_ICC_NOT_PRESENT</a>) </td></tr>
    <tr><td class="paramname">IFD_NOT_SUPPORTED</td><td>Action not supported (<a class="el" href="ifdhandler_8h.html#a35aea7275c1fcb4e97d57f6c8fa28918">IFD_NOT_SUPPORTED</a>) </td></tr>
    <tr><td class="paramname">IFD_NO_SUCH_DEVICE</td><td>The reader is no more present (<a class="el" href="ifdhandler_8h.html#a0a0d086b32b271a2172baebd65d9da9f">IFD_NO_SUCH_DEVICE</a>) </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="ifdwrapper_8c_source.html#l00512">IFDTransmit()</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 15 2014 11:57:56 for pcsc-lite by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>