use a separate directory for ifd-vpcd and pcsclite-vpcd
This commit is contained in:
132
virtualsmartcard/src/pcsclite-vpcd/PCSC/debug.c
Normal file
132
virtualsmartcard/src/pcsclite-vpcd/PCSC/debug.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
||||
*
|
||||
* Copyright (C) 1999-2002
|
||||
* David Corcoran <corcoran@linuxnet.com>
|
||||
* Copyright (C) 2002-2011
|
||||
* Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||
*
|
||||
* $Id: debug.c 6551 2013-03-06 13:44:17Z rousseau $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief This handles debugging for libpcsclite.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "debuglog.h"
|
||||
#include "strlcpycat.h"
|
||||
|
||||
#define DEBUG_BUF_SIZE 2048
|
||||
|
||||
#ifdef NO_LOG
|
||||
|
||||
void log_msg(const int priority, const char *fmt, ...)
|
||||
{
|
||||
(void)priority;
|
||||
(void)fmt;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/** default level is quiet to avoid polluting fd 2 (possibly NOT stderr) */
|
||||
static char LogLevel = PCSC_LOG_CRITICAL+1;
|
||||
|
||||
static signed char LogDoColor = 0; /**< no color by default */
|
||||
|
||||
static void log_init(void)
|
||||
{
|
||||
char *e;
|
||||
|
||||
#ifdef LIBPCSCLITE
|
||||
e = getenv("PCSCLITE_DEBUG");
|
||||
#else
|
||||
e = getenv("MUSCLECARD_DEBUG");
|
||||
#endif
|
||||
if (e)
|
||||
LogLevel = atoi(e);
|
||||
|
||||
/* log to stderr and stderr is a tty? */
|
||||
if (isatty(fileno(stderr)))
|
||||
{
|
||||
char *term;
|
||||
|
||||
term = getenv("TERM");
|
||||
if (term)
|
||||
{
|
||||
const char *terms[] = { "linux", "xterm", "xterm-color", "Eterm", "rxvt", "rxvt-unicode" };
|
||||
unsigned int i;
|
||||
|
||||
/* for each known color terminal */
|
||||
for (i = 0; i < sizeof(terms) / sizeof(terms[0]); i++)
|
||||
{
|
||||
/* we found a supported term? */
|
||||
if (0 == strcmp(terms[i], term))
|
||||
{
|
||||
LogDoColor = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* log_init */
|
||||
|
||||
void log_msg(const int priority, const char *fmt, ...)
|
||||
{
|
||||
char DebugBuffer[DEBUG_BUF_SIZE];
|
||||
va_list argptr;
|
||||
static int is_initialized = 0;
|
||||
|
||||
if (!is_initialized)
|
||||
{
|
||||
log_init();
|
||||
is_initialized = 1;
|
||||
}
|
||||
|
||||
if (priority < LogLevel) /* log priority lower than threshold? */
|
||||
return;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
(void)vsnprintf(DebugBuffer, DEBUG_BUF_SIZE, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
{
|
||||
if (LogDoColor)
|
||||
{
|
||||
const char *color_pfx = "", *color_sfx = "\33[0m";
|
||||
|
||||
switch (priority)
|
||||
{
|
||||
case PCSC_LOG_CRITICAL:
|
||||
color_pfx = "\33[01;31m"; /* bright + Red */
|
||||
break;
|
||||
|
||||
case PCSC_LOG_ERROR:
|
||||
color_pfx = "\33[35m"; /* Magenta */
|
||||
break;
|
||||
|
||||
case PCSC_LOG_INFO:
|
||||
color_pfx = "\33[34m"; /* Blue */
|
||||
break;
|
||||
|
||||
case PCSC_LOG_DEBUG:
|
||||
color_pfx = ""; /* normal (black) */
|
||||
color_sfx = "";
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%s%s%s\n", color_pfx, DebugBuffer, color_sfx);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "%s\n", DebugBuffer);
|
||||
}
|
||||
} /* log_msg */
|
||||
|
||||
#endif
|
||||
|
||||
112
virtualsmartcard/src/pcsclite-vpcd/PCSC/debuglog.h
Normal file
112
virtualsmartcard/src/pcsclite-vpcd/PCSC/debuglog.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
||||
*
|
||||
* Copyright (C) 1999-2004
|
||||
* David Corcoran <corcoran@linuxnet.com>
|
||||
* Copyright (C) 1999-2011
|
||||
* Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||
*
|
||||
* $Id: debuglog.h 5854 2011-07-09 11:10:32Z rousseau $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief This handles debugging.
|
||||
*
|
||||
* @note log message is sent to syslog or stderr depending on --foreground
|
||||
* command line argument
|
||||
*
|
||||
* @code
|
||||
* Log1(priority, "text");
|
||||
* log "text" with priority level priority
|
||||
* Log2(priority, "text: %d", 1234);
|
||||
* log "text: 1234"
|
||||
* the format string can be anything printf() can understand
|
||||
* Log3(priority, "text: %d %d", 1234, 5678);
|
||||
* log "text: 1234 5678"
|
||||
* the format string can be anything printf() can understand
|
||||
* LogXxd(priority, msg, buffer, size);
|
||||
* log "msg" + a hex dump of size bytes of buffer[]
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
#ifndef __debuglog_h__
|
||||
#define __debuglog_h__
|
||||
|
||||
#ifndef PCSC_API
|
||||
#define PCSC_API
|
||||
#endif
|
||||
|
||||
enum {
|
||||
DEBUGLOG_NO_DEBUG = 0,
|
||||
DEBUGLOG_SYSLOG_DEBUG,
|
||||
DEBUGLOG_STDOUT_DEBUG,
|
||||
DEBUGLOG_STDOUT_COLOR_DEBUG
|
||||
};
|
||||
|
||||
#define DEBUG_CATEGORY_NOTHING 0
|
||||
#define DEBUG_CATEGORY_APDU 1
|
||||
#define DEBUG_CATEGORY_SW 2
|
||||
|
||||
enum {
|
||||
PCSC_LOG_DEBUG = 0,
|
||||
PCSC_LOG_INFO,
|
||||
PCSC_LOG_ERROR,
|
||||
PCSC_LOG_CRITICAL
|
||||
};
|
||||
|
||||
/* You can't do #ifndef __FUNCTION__ */
|
||||
#if !defined(__GNUC__) && !defined(__IBMC__)
|
||||
#define __FUNCTION__ ""
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
#ifdef NO_LOG
|
||||
|
||||
#define Log0(priority) do { } while(0)
|
||||
#define Log1(priority, fmt) do { } while(0)
|
||||
#define Log2(priority, fmt, data) do { } while(0)
|
||||
#define Log3(priority, fmt, data1, data2) do { } while(0)
|
||||
#define Log4(priority, fmt, data1, data2, data3) do { } while(0)
|
||||
#define Log5(priority, fmt, data1, data2, data3, data4) do { } while(0)
|
||||
#define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) do { } while(0)
|
||||
#define LogXxd(priority, msg, buffer, size) do { } while(0)
|
||||
|
||||
#define DebugLogA(a)
|
||||
#define DebugLogB(a, b)
|
||||
#define DebugLogC(a, b,c)
|
||||
|
||||
#else
|
||||
|
||||
#define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
|
||||
#define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)
|
||||
#define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)
|
||||
#define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
|
||||
#define Log4(priority, fmt, data1, data2, data3) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
|
||||
#define Log5(priority, fmt, data1, data2, data3, data4) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4)
|
||||
#define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4, data5, data6, data7, data8)
|
||||
#define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size)
|
||||
|
||||
#define DebugLogA(a) Log1(PCSC_LOG_INFO, a)
|
||||
#define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b)
|
||||
#define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c)
|
||||
|
||||
#endif /* NO_LOG */
|
||||
|
||||
PCSC_API void log_msg(const int priority, const char *fmt, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
|
||||
PCSC_API void log_xxd(const int priority, const char *msg,
|
||||
const unsigned char *buffer, const int size);
|
||||
|
||||
void DebugLogSuppress(const int);
|
||||
void DebugLogSetLogType(const int);
|
||||
int DebugLogSetCategory(const int);
|
||||
void DebugLogCategory(const int, const unsigned char *, const int);
|
||||
PCSC_API void DebugLogSetLevel(const int level);
|
||||
|
||||
#endif /* __debuglog_h__ */
|
||||
|
||||
797
virtualsmartcard/src/pcsclite-vpcd/PCSC/ifdhandler.h
Normal file
797
virtualsmartcard/src/pcsclite-vpcd/PCSC/ifdhandler.h
Normal file
@@ -0,0 +1,797 @@
|
||||
/*
|
||||
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
||||
*
|
||||
* Copyright (C) 1999-2004
|
||||
* David Corcoran <corcoran@linuxnet.com>
|
||||
* Copyright (C) 2003-2004
|
||||
* Damien Sauveron <damien.sauveron@labri.fr>
|
||||
* Copyright (C) 2002-2011
|
||||
* Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||
*
|
||||
* $Id: ifdhandler.h 6413 2012-08-08 09:35:18Z rousseau $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @defgroup IFDHandler IFDHandler
|
||||
* @brief This provides reader specific low-level calls.
|
||||
|
||||
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:
|
||||
http://www.musclecard.com/drivers.html
|
||||
|
||||
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.
|
||||
|
||||
@section UsbReaders USB readers
|
||||
|
||||
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.
|
||||
|
||||
A bundle looks like the following:
|
||||
|
||||
@verbatim
|
||||
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
|
||||
@endverbatim
|
||||
|
||||
The @c Info.plist file describes the driver and gives the loader
|
||||
all the necessary information. The following must be contained in the
|
||||
@c Info.plist file:
|
||||
|
||||
@subsection ifdVendorID
|
||||
|
||||
The vendor ID of the USB device.
|
||||
|
||||
Example:
|
||||
|
||||
@verbatim
|
||||
<key>ifdVendorID</key>
|
||||
<string>0x04E6</string>
|
||||
@endverbatim
|
||||
|
||||
You may have an OEM of this reader in which an additional @c <string>
|
||||
can be used like in the below example:
|
||||
|
||||
@verbatim
|
||||
<key>ifdVendorID</key>
|
||||
<array>
|
||||
<string>0x04E6</string>
|
||||
<string>0x0973</string>
|
||||
</array>
|
||||
@endverbatim
|
||||
|
||||
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.
|
||||
|
||||
|
||||
The CCID driver from Ludovic Rousseau
|
||||
http://pcsclite.alioth.debian.org/ccid.html uses this feature since the
|
||||
same driver supports many different readers.
|
||||
|
||||
@subsection ifdProductID
|
||||
|
||||
The product id of the USB device.
|
||||
|
||||
@verbatim
|
||||
<key>ifdProductID</key>
|
||||
<string>0x3437</string>
|
||||
@endverbatim
|
||||
|
||||
@subsection ifdFriendlyName
|
||||
|
||||
Example:
|
||||
|
||||
@verbatim
|
||||
<key>ifdFriendlyName</key>
|
||||
<string>SCM Microsystems USB Reader</string>
|
||||
@endverbatim
|
||||
|
||||
@subsection CFBundleExecutable
|
||||
|
||||
The executable name which exists in the particular platform's directory.
|
||||
|
||||
Example:
|
||||
|
||||
@verbatim
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>libccid.so.0.4.2</string>
|
||||
@endverbatim
|
||||
|
||||
@subsection ifdCapabilities
|
||||
|
||||
List of capabilities supported by the driver. This is a bit field. Possible values are:
|
||||
|
||||
- 0
|
||||
No special capabilities
|
||||
- 1 IFD_GENERATE_HOTPLUG
|
||||
The driver supports the hot plug feature.
|
||||
|
||||
Complete sample file:
|
||||
|
||||
@verbatim
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1d1</string>
|
||||
<key>ifdCapabilities</key>
|
||||
<string>0x00000000</string>
|
||||
<key>ifdProtocolSupport</key>
|
||||
<string>0x00000001</string>
|
||||
<key>ifdVersionNumber</key>
|
||||
<string>0x00000001</string>
|
||||
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>libfoobar.so.x.y</string>
|
||||
|
||||
<key>ifdManufacturerString</key>
|
||||
<string>Foo bar inc.</string>
|
||||
|
||||
<key>ifdProductString</key>
|
||||
<string>Driver for Foobar reader, version x.y</string>
|
||||
|
||||
<key>ifdVendorID</key>
|
||||
<string>0x1234</string>
|
||||
|
||||
<key>ifdProductID</key>
|
||||
<string>0x5678</string>
|
||||
|
||||
<key>ifdFriendlyName</key>
|
||||
<string>Foobar USB reader</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@endverbatim
|
||||
|
||||
As indicated in the XML file the DTD is available at
|
||||
http://www.apple.com/DTDs/PropertyList-1.0.dtd.
|
||||
|
||||
@section SerialReaders Serial readers
|
||||
|
||||
Serial drivers must be configured to operate on a particular port and
|
||||
respond to a particular name. The @c reader.conf file is used for this
|
||||
purpose.
|
||||
|
||||
It has the following syntax:
|
||||
|
||||
@verbatim
|
||||
# Configuration file for pcsc-lite
|
||||
# David Corcoran <corcoran@musclecard.com>
|
||||
|
||||
FRIENDLYNAME Generic Reader
|
||||
DEVICENAME /dev/ttyS0
|
||||
LIBPATH /usr/lib/pcsc/drivers/libgen_ifd.so
|
||||
CHANNELID 1
|
||||
@endverbatim
|
||||
|
||||
The pound sign # denotes a comment.
|
||||
|
||||
@subsection FRIENDLYNAME
|
||||
The FRIENDLYNAME field is an arbitrary text used to identify the reader.
|
||||
This text is displayed by commands like @c pcsc_scan
|
||||
http://ludovic.rousseau.free.fr/softwares/pcsc-tools/ that prints the
|
||||
names of all the connected and detected readers.
|
||||
|
||||
@subsection DEVICENAME
|
||||
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 @c /dev/ttyS0 under Linux
|
||||
and @c /dev/cuaa0 under FreeBSD.
|
||||
|
||||
If you want to use IFDHCreateChannel() instead of
|
||||
IFDHCreateChannelByName() then do not use any DEVICENAME line in the
|
||||
configuration file. IFDHCreateChannel() will then be called with the
|
||||
CHANNELID parameter.
|
||||
|
||||
@subsection LIBPATH
|
||||
The LIBPATH field is the filename of the driver code. The driver is a
|
||||
dynamically loaded piece of code (generally a @c drivername.so* file).
|
||||
|
||||
@subsection CHANNELID
|
||||
The CHANNELID is no more used for recent drivers (IFD handler 3.0) and
|
||||
has been superseded by DEVICENAME.
|
||||
|
||||
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.
|
||||
|
||||
CHANNELID was the numeric version of the port in which the reader will
|
||||
be located. This may be done by a symbolic link where @c /dev/pcsc/1 is
|
||||
the first device which may be a symbolic link to @c /dev/ttyS0 or
|
||||
whichever location your reader resides.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _ifd_handler_h_
|
||||
#define _ifd_handler_h_
|
||||
|
||||
#include <pcsclite.h>
|
||||
|
||||
/*
|
||||
* List of data structures available to ifdhandler
|
||||
*/
|
||||
typedef struct _DEVICE_CAPABILITIES
|
||||
{
|
||||
LPSTR Vendor_Name; /**< Tag 0x0100 */
|
||||
LPSTR IFD_Type; /**< Tag 0x0101 */
|
||||
DWORD IFD_Version; /**< Tag 0x0102 */
|
||||
LPSTR IFD_Serial; /**< Tag 0x0103 */
|
||||
DWORD IFD_Channel_ID; /**< Tag 0x0110 */
|
||||
|
||||
DWORD Asynch_Supported; /**< Tag 0x0120 */
|
||||
DWORD Default_Clock; /**< Tag 0x0121 */
|
||||
DWORD Max_Clock; /**< Tag 0x0122 */
|
||||
DWORD Default_Data_Rate; /**< Tag 0x0123 */
|
||||
DWORD Max_Data_Rate; /**< Tag 0x0124 */
|
||||
DWORD Max_IFSD; /**< Tag 0x0125 */
|
||||
DWORD Synch_Supported; /**< Tag 0x0126 */
|
||||
DWORD Power_Mgmt; /**< Tag 0x0131 */
|
||||
DWORD Card_Auth_Devices; /**< Tag 0x0140 */
|
||||
DWORD User_Auth_Device; /**< Tag 0x0142 */
|
||||
DWORD Mechanics_Supported; /**< Tag 0x0150 */
|
||||
DWORD Vendor_Features; /**< Tag 0x0180 - 0x01F0 User Defined. */
|
||||
}
|
||||
DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
|
||||
|
||||
typedef struct _ICC_STATE
|
||||
{
|
||||
UCHAR ICC_Presence; /**< Tag 0x0300 */
|
||||
UCHAR ICC_Interface_Status; /**< Tag 0x0301 */
|
||||
UCHAR ATR[MAX_ATR_SIZE]; /**< Tag 0x0303 */
|
||||
UCHAR ICC_Type; /**< Tag 0x0304 */
|
||||
}
|
||||
ICC_STATE, *PICC_STATE;
|
||||
|
||||
typedef struct _PROTOCOL_OPTIONS
|
||||
{
|
||||
DWORD Protocol_Type; /**< Tag 0x0201 */
|
||||
DWORD Current_Clock; /**< Tag 0x0202 */
|
||||
DWORD Current_F; /**< Tag 0x0203 */
|
||||
DWORD Current_D; /**< Tag 0x0204 */
|
||||
DWORD Current_N; /**< Tag 0x0205 */
|
||||
DWORD Current_W; /**< Tag 0x0206 */
|
||||
DWORD Current_IFSC; /**< Tag 0x0207 */
|
||||
DWORD Current_IFSD; /**< Tag 0x0208 */
|
||||
DWORD Current_BWT; /**< Tag 0x0209 */
|
||||
DWORD Current_CWT; /**< Tag 0x020A */
|
||||
DWORD Current_EBC; /**< Tag 0x020B */
|
||||
}
|
||||
PROTOCOL_OPTIONS, *PPROTOCOL_OPTIONS;
|
||||
|
||||
/**
|
||||
* Use by SCardTransmit()
|
||||
*/
|
||||
typedef struct _SCARD_IO_HEADER
|
||||
{
|
||||
DWORD Protocol;
|
||||
DWORD Length;
|
||||
}
|
||||
SCARD_IO_HEADER, *PSCARD_IO_HEADER;
|
||||
|
||||
/*
|
||||
* The list of tags should be alot more but this is all I use in the
|
||||
* meantime
|
||||
*/
|
||||
#define TAG_IFD_ATR 0x0303 /**< ATR */
|
||||
#define TAG_IFD_SLOTNUM 0x0180 /**< select a slot */
|
||||
#define TAG_IFD_SLOT_THREAD_SAFE 0x0FAC /**< support access to different slots of the reader */
|
||||
#define TAG_IFD_THREAD_SAFE 0x0FAD /**< driver is thread safe */
|
||||
#define TAG_IFD_SLOTS_NUMBER 0x0FAE /**< number of slots of the reader */
|
||||
#define TAG_IFD_SIMULTANEOUS_ACCESS 0x0FAF /**< number of reader the driver can manage */
|
||||
#define TAG_IFD_POLLING_THREAD 0x0FB0 /**< not used. See TAG_IFD_POLLING_THREAD_WITH_TIMEOUT */
|
||||
#define TAG_IFD_POLLING_THREAD_KILLABLE 0x0FB1 /**< the polling thread can be killed */
|
||||
#define TAG_IFD_STOP_POLLING_THREAD 0x0FB2 /**< method used to stop the polling thread (instead of just pthread_kill()) */
|
||||
#define TAG_IFD_POLLING_THREAD_WITH_TIMEOUT 0x0FB3 /**< driver uses a polling thread with a timeout parameter */
|
||||
|
||||
/*
|
||||
* IFD Handler version number enummerations
|
||||
*/
|
||||
#define IFD_HVERSION_1_0 0x00010000
|
||||
#define IFD_HVERSION_2_0 0x00020000
|
||||
#define IFD_HVERSION_3_0 0x00030000
|
||||
|
||||
/*
|
||||
* List of defines available to ifdhandler
|
||||
*/
|
||||
#define IFD_POWER_UP 500 /**< power up the card */
|
||||
#define IFD_POWER_DOWN 501 /**< power down the card */
|
||||
#define IFD_RESET 502 /**< warm reset */
|
||||
|
||||
#define IFD_NEGOTIATE_PTS1 1 /**< negotiate PTS1 */
|
||||
#define IFD_NEGOTIATE_PTS2 2 /**< negotiate PTS2 */
|
||||
#define IFD_NEGOTIATE_PTS3 4 /**< negotiate PTS3 */
|
||||
|
||||
#define IFD_SUCCESS 0 /**< no error */
|
||||
#define IFD_ERROR_TAG 600 /**< tag unknown */
|
||||
#define IFD_ERROR_SET_FAILURE 601 /**< set failed */
|
||||
#define IFD_ERROR_VALUE_READ_ONLY 602 /**< value is read only */
|
||||
#define IFD_ERROR_PTS_FAILURE 605 /**< failed to negotiate PTS */
|
||||
#define IFD_ERROR_NOT_SUPPORTED 606
|
||||
#define IFD_PROTOCOL_NOT_SUPPORTED 607 /**< requested protocol not supported */
|
||||
#define IFD_ERROR_POWER_ACTION 608 /**< power up failed */
|
||||
#define IFD_ERROR_SWALLOW 609
|
||||
#define IFD_ERROR_EJECT 610
|
||||
#define IFD_ERROR_CONFISCATE 611
|
||||
#define IFD_COMMUNICATION_ERROR 612 /**< generic error */
|
||||
#define IFD_RESPONSE_TIMEOUT 613 /**< timeout */
|
||||
#define IFD_NOT_SUPPORTED 614 /**< request is not supported */
|
||||
#define IFD_ICC_PRESENT 615 /**< card is present */
|
||||
#define IFD_ICC_NOT_PRESENT 616 /**< card is absent */
|
||||
/**
|
||||
* The \ref IFD_NO_SUCH_DEVICE error must be returned by the driver when
|
||||
* it detects the reader is no more present. This will tell pcscd to
|
||||
* remove the reader from the list of available readers.
|
||||
*/
|
||||
#define IFD_NO_SUCH_DEVICE 617
|
||||
#define IFD_ERROR_INSUFFICIENT_BUFFER 618 /**< buffer is too small */
|
||||
|
||||
#ifndef RESPONSECODE_DEFINED_IN_WINTYPES_H
|
||||
typedef long RESPONSECODE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If you want to compile a V2.0 IFDHandler, define IFDHANDLERv2
|
||||
* before you include this file.
|
||||
*
|
||||
* By default it is setup for for most recent version of the API (V3.0)
|
||||
*/
|
||||
|
||||
#ifndef IFDHANDLERv2
|
||||
|
||||
/*
|
||||
* List of Defined Functions Available to IFD_Handler 3.0
|
||||
*
|
||||
* All the functions of IFD_Handler 2.0 are available
|
||||
* IFDHCreateChannelByName() is new
|
||||
* IFDHControl() API changed
|
||||
*/
|
||||
|
||||
/**
|
||||
This function is required to open a communications channel to the port
|
||||
listed by @p DeviceName.
|
||||
|
||||
Once the channel is opened the reader must be in a state in which it is
|
||||
possible to query IFDHICCPresence() for card status.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number\n
|
||||
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.\n
|
||||
\n
|
||||
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.
|
||||
|
||||
@param[in] DeviceName Filename to use by the driver.\n
|
||||
For drivers configured by @p /etc/reader.conf this is the value of the
|
||||
field \ref DEVICENAME.
|
||||
\n
|
||||
For USB drivers the @p DeviceName must start with @p usb:VID/PID. VID
|
||||
is the Vendor ID and PID is the Product ID. Both are a 4-digits hex
|
||||
number.
|
||||
|
||||
Typically the string is generated by:
|
||||
|
||||
@code
|
||||
printf("usb:%04x/%04x", idVendor, idProduct);
|
||||
@endcode
|
||||
|
||||
The @p DeviceName 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.
|
||||
|
||||
- libusb
|
||||
|
||||
For USB drivers using libusb-1.0 http://libusb.sourceforge.net/ for USB
|
||||
abstraction the @p DeviceName the string may be generated by:
|
||||
|
||||
@code
|
||||
printf("usb:%04x/%04x:libusb-1.0:%d:%d:%d",
|
||||
idVendor, idProduct, bus_number, device_address, interface)
|
||||
@endcode
|
||||
|
||||
So it is something like: <tt>usb:08e6/3437:libusb-1.0:7:99:0</tt> under
|
||||
GNU/Linux.
|
||||
|
||||
- libudev
|
||||
|
||||
If pcscd is compiled with libudev support instead of libusb (default
|
||||
since pcsc-lite 1.6.8) the string will look like:
|
||||
|
||||
@code
|
||||
printf("usb:%04x/%04x:libudev:%d:%s", idVendor, idProduct,
|
||||
bInterfaceNumber, devpath);
|
||||
@endcode
|
||||
|
||||
bInterfaceNumber is the number of the interface on the device. It is
|
||||
only usefull for devices with more than one CCID interface.
|
||||
|
||||
devpath is the filename of the device on the file system.
|
||||
|
||||
So it is something like:
|
||||
<tt>usb:08e6/3437:libudev:0:/dev/bus/usb/008/047</tt>
|
||||
under GNU/Linux.
|
||||
|
||||
- other
|
||||
|
||||
If the driver does not understand the <tt>:libusb:</tt> or
|
||||
<tt>:libudev:</tt> scheme or if a new scheme is used, the driver should
|
||||
ignore the part it does not understand instead of failing.
|
||||
|
||||
The driver shall recognize the <tt>usb:VID/PID</tt> part and, only if
|
||||
possible, the remaining of the DeviceName field.
|
||||
|
||||
It is the responsibility of the driver to correctly identify the reader.
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR DeviceName);
|
||||
|
||||
/**
|
||||
This function performs a data exchange with the reader (not the card)
|
||||
specified by Lun. 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.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
@param[in] dwControlCode Control code for the operation\n
|
||||
This value identifies the specific operation to be performed. This
|
||||
value is driver specific.
|
||||
@param[in] TxBuffer Transmit data
|
||||
@param[in] TxLength Length of this buffer
|
||||
@param[out] RxBuffer Receive data
|
||||
@param[in] RxLength Length of the response buffer
|
||||
@param[out] pdwBytesReturned Length of response\n
|
||||
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.
|
||||
|
||||
@note
|
||||
@p *pdwBytesReturned should be set to zero on error.
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_RESPONSE_TIMEOUT The response timed out (\ref IFD_RESPONSE_TIMEOUT)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, PUCHAR
|
||||
TxBuffer, DWORD TxLength, PUCHAR RxBuffer, DWORD RxLength,
|
||||
LPDWORD pdwBytesReturned);
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* Available in IFD_Handler 2.0
|
||||
*
|
||||
* @deprecated
|
||||
* You should use the new form of IFDHControl()
|
||||
*/
|
||||
RESPONSECODE IFDHControl(DWORD Lun, PUCHAR TxBuffer, DWORD TxLength,
|
||||
PUCHAR RxBuffer, PDWORD RxLength);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* common functions in IFD_Handler 2.0 and 3.0
|
||||
*/
|
||||
/**
|
||||
This function is required to open a communications channel to the port
|
||||
listed by Channel. For example, the first serial reader on COM1 would
|
||||
link to @p /dev/pcsc/1 which would be a symbolic link to @p /dev/ttyS0
|
||||
on some machines This is used to help with inter-machine independence.
|
||||
|
||||
On machines with no /dev directory the driver writer may choose to map
|
||||
their Channel to whatever they feel is appropriate.
|
||||
|
||||
Once the channel is opened the reader must be in a state in which it is
|
||||
possible to query IFDHICCPresence() for card status.
|
||||
|
||||
USB readers can ignore the @p Channel parameter and query the USB bus
|
||||
for the particular reader by manufacturer and product id.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number\n
|
||||
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.\n
|
||||
\n
|
||||
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.
|
||||
@param[in] Channel Channel ID
|
||||
This is denoted by the following:
|
||||
- 0x000001 @p /dev/pcsc/1
|
||||
- 0x000002 @p /dev/pcsc/2
|
||||
- 0x000003 @p /dev/pcsc/3
|
||||
- 0x000004 @p /dev/pcsc/4
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
|
||||
*/
|
||||
RESPONSECODE IFDHCreateChannel(DWORD Lun, DWORD Channel);
|
||||
|
||||
/**
|
||||
This function should close the reader communication channel for the
|
||||
particular reader. Prior to closing the communication channel the reader
|
||||
should make sure the card is powered down and the terminal is also
|
||||
powered down.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHCloseChannel(DWORD Lun);
|
||||
|
||||
/**
|
||||
This function should get the slot/card capabilities for a particular
|
||||
slot/card specified by Lun. Again, if you have only 1 card slot and
|
||||
don't mind loading a new driver for each reader then ignore Lun.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
@param[in] Tag Tag of the desired data value
|
||||
- \ref TAG_IFD_ATR
|
||||
Return the ATR and its size (implementation is mandatory).
|
||||
- \ref TAG_IFD_SLOTNUM
|
||||
Unused/deprecated
|
||||
- \ref SCARD_ATTR_ATR_STRING
|
||||
Same as \ref TAG_IFD_ATR but this one is not mandatory. It is defined
|
||||
in Microsoft PC/SC SCardGetAttrib().
|
||||
- \ref TAG_IFD_SIMULTANEOUS_ACCESS
|
||||
Return the number of sessions (readers) the driver can handle in
|
||||
<tt>Value[0]</tt>.
|
||||
This is used for multiple readers sharing the same driver.
|
||||
- \ref TAG_IFD_THREAD_SAFE
|
||||
If the driver supports more than one reader (see
|
||||
\ref TAG_IFD_SIMULTANEOUS_ACCESS above) this tag indicates if the
|
||||
driver supports access to multiple readers at the same time.\n
|
||||
<tt>Value[0] = 1</tt> indicates the driver supports simultaneous accesses.
|
||||
- \ref TAG_IFD_SLOTS_NUMBER
|
||||
Return the number of slots in this reader in <tt>Value[0]</tt>.
|
||||
- \ref TAG_IFD_SLOT_THREAD_SAFE
|
||||
If the reader has more than one slot (see \ref TAG_IFD_SLOTS_NUMBER
|
||||
above) this tag indicates if the driver supports access to multiple
|
||||
slots of the same reader at the same time.\n
|
||||
<tt>Value[0] = 1</tt> indicates the driver supports simultaneous slot
|
||||
accesses.
|
||||
- \ref TAG_IFD_POLLING_THREAD
|
||||
Unused/deprecated
|
||||
- \ref TAG_IFD_POLLING_THREAD_WITH_TIMEOUT
|
||||
If the driver provides a polling thread then @p Value is a pointer to
|
||||
this function. The function prototype is:
|
||||
@verbatim
|
||||
RESPONSECODE foo(DWORD Lun, int timeout);
|
||||
@endverbatim
|
||||
- \ref TAG_IFD_POLLING_THREAD_KILLABLE
|
||||
Tell if the polling thread can be killed (pthread_kill()) by pcscd
|
||||
- \ref TAG_IFD_STOP_POLLING_THREAD
|
||||
Returns a pointer in @p Value to the function used to stop the polling
|
||||
thread returned by \ref TAG_IFD_POLLING_THREAD_WITH_TIMEOUT. The
|
||||
function prototype is:
|
||||
@verbatim
|
||||
RESPONSECODE foo(DWORD Lun);
|
||||
@endverbatim
|
||||
@param[in,out] Length Length of the desired data value
|
||||
@param[out] Value Value of the desired data
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_ERROR_TAG Invalid tag given (\ref IFD_ERROR_TAG)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHGetCapabilities(DWORD Lun, DWORD Tag, PDWORD Length,
|
||||
PUCHAR Value);
|
||||
|
||||
/**
|
||||
This function should set the slot/card capabilities for a particular
|
||||
slot/card specified by @p Lun. Again, if you have only 1 card slot and
|
||||
don't mind loading a new driver for each reader then ignore @p Lun.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
@param[in] Tag Tag of the desired data value
|
||||
@param[in,out] Length Length of the desired data value
|
||||
@param[out] Value Value of the desired data
|
||||
|
||||
This function is also called when the application uses the PC/SC
|
||||
SCardGetAttrib() function. The list of supported tags is not limited.
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_ERROR_TAG Invalid tag given (\ref IFD_ERROR_TAG)
|
||||
@retval IFD_ERROR_SET_FAILURE Could not set value (\ref IFD_ERROR_SET_FAILURE)
|
||||
@retval IFD_ERROR_VALUE_READ_ONLY Trying to set read only value (\ref IFD_ERROR_VALUE_READ_ONLY)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHSetCapabilities(DWORD Lun, DWORD Tag, DWORD Length, PUCHAR Value);
|
||||
|
||||
/**
|
||||
This function should set the Protocol Type Selection (PTS) of a
|
||||
particular card/slot using the three PTS parameters sent
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
@param[in] Protocol Desired protocol
|
||||
- \ref SCARD_PROTOCOL_T0
|
||||
T=0 protocol
|
||||
- \ref SCARD_PROTOCOL_T1
|
||||
T=1 protocol
|
||||
@param[in] Flags Logical OR of possible values to determine which PTS values
|
||||
to negotiate
|
||||
- \ref IFD_NEGOTIATE_PTS1
|
||||
- \ref IFD_NEGOTIATE_PTS2
|
||||
- \ref IFD_NEGOTIATE_PTS3
|
||||
@param[in] PTS1 1st PTS Value
|
||||
@param[in] PTS2 2nd PTS Value
|
||||
@param[in] PTS3 3rd PTS Value\n
|
||||
See ISO 7816/EMV documentation.
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_ERROR_PTS_FAILURE Could not set PTS value (\ref IFD_ERROR_PTS_FAILURE)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_PROTOCOL_NOT_SUPPORTED Protocol is not supported (\ref IFD_PROTOCOL_NOT_SUPPORTED)
|
||||
@retval IFD_NOT_SUPPORTED Action not supported (\ref IFD_NOT_SUPPORTED)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHSetProtocolParameters(DWORD Lun, DWORD Protocol, UCHAR Flags,
|
||||
UCHAR PTS1, UCHAR PTS2, UCHAR PTS3);
|
||||
/**
|
||||
This function controls the power and reset signals of the smart card
|
||||
reader at the particular reader/slot specified by @p Lun.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
@param[in] Action Action to be taken on the card
|
||||
- \ref IFD_POWER_UP
|
||||
Power up the card (store and return Atr and AtrLength)
|
||||
- \ref IFD_POWER_DOWN
|
||||
Power down the card (Atr and AtrLength should be zeroed)
|
||||
- \ref IFD_RESET
|
||||
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)
|
||||
@param[out] Atr Answer to Reset (ATR) of the card\n
|
||||
The driver is responsible for caching this value in case
|
||||
IFDHGetCapabilities() is called requesting the ATR and its length. The
|
||||
ATR length should not exceed \ref MAX_ATR_SIZE.
|
||||
@param[in,out] AtrLength Length of the ATR\n
|
||||
This should not exceed \ref MAX_ATR_SIZE.
|
||||
|
||||
@note
|
||||
Memory cards without an ATR should return \ref IFD_SUCCESS on reset but the
|
||||
Atr should be zeroed and the length should be zero Reset errors should
|
||||
return zero for the AtrLength and return \ref IFD_ERROR_POWER_ACTION.
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_ERROR_POWER_ACTION Error powering/resetting card (\ref IFD_ERROR_POWER_ACTION)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_NOT_SUPPORTED Action not supported (\ref IFD_NOT_SUPPORTED)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHPowerICC(DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD
|
||||
AtrLength);
|
||||
|
||||
/**
|
||||
This function performs an APDU exchange with the card/slot specified by
|
||||
Lun. 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.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
@param[in] SendPci contains two structure members
|
||||
- Protocol 0, 1, ... 14\n
|
||||
T=0 ... T=14
|
||||
- Length\n
|
||||
Not used.
|
||||
@param[in] TxBuffer Transmit APDU\n
|
||||
Example: "\x00\xA4\x00\x00\x02\x3F\x00"
|
||||
@param[in] TxLength Length of this buffer
|
||||
@param[out] RxBuffer Receive APDU\n
|
||||
Example: "\x61\x14"
|
||||
@param[in,out] RxLength Length of the received APDU\n
|
||||
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.
|
||||
@param[out] RecvPci contains two structure members
|
||||
- Protocol - 0, 1, ... 14\n
|
||||
T=0 ... T=14
|
||||
- Length\n
|
||||
Not used.
|
||||
|
||||
@note
|
||||
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.
|
||||
@par
|
||||
RxLength should be set to zero on error.
|
||||
@par
|
||||
The driver is not responsible for doing an automatic Get Response
|
||||
command for received buffers containing 61 XX.
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_RESPONSE_TIMEOUT The response timed out (\ref IFD_RESPONSE_TIMEOUT)
|
||||
@retval IFD_ICC_NOT_PRESENT ICC is not present (\ref IFD_ICC_NOT_PRESENT)
|
||||
@retval IFD_NOT_SUPPORTED Action not supported (\ref IFD_NOT_SUPPORTED)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHTransmitToICC(DWORD Lun, SCARD_IO_HEADER SendPci,
|
||||
PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, PDWORD
|
||||
RxLength, PSCARD_IO_HEADER RecvPci);
|
||||
|
||||
/**
|
||||
This function returns the status of the card inserted in the reader/slot
|
||||
specified by @p Lun. 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.
|
||||
|
||||
@ingroup IFDHandler
|
||||
@param[in] Lun Logical Unit Number
|
||||
|
||||
@return Error codes
|
||||
@retval IFD_SUCCESS Successful (\ref IFD_SUCCESS)
|
||||
@retval IFD_COMMUNICATION_ERROR Error has occurred (\ref IFD_COMMUNICATION_ERROR)
|
||||
@retval IFD_ICC_NOT_PRESENT ICC is not present (\ref IFD_ICC_NOT_PRESENT)
|
||||
@retval IFD_NO_SUCH_DEVICE The reader is no more present (\ref IFD_NO_SUCH_DEVICE)
|
||||
*/
|
||||
RESPONSECODE IFDHICCPresence(DWORD Lun);
|
||||
|
||||
#endif
|
||||
1
virtualsmartcard/src/pcsclite-vpcd/PCSC/pcsclite.h
Symbolic link
1
virtualsmartcard/src/pcsclite-vpcd/PCSC/pcsclite.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../pcsclite.h
|
||||
220
virtualsmartcard/src/pcsclite-vpcd/PCSC/pcsclite.h.in
Normal file
220
virtualsmartcard/src/pcsclite-vpcd/PCSC/pcsclite.h.in
Normal file
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
||||
*
|
||||
* Copyright (C) 1999-2004
|
||||
* David Corcoran <corcoran@linuxnet.com>
|
||||
* Copyright (C) 2002-2011
|
||||
* Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||
* Copyright (C) 2005
|
||||
* Martin Paljak <martin@paljak.pri.ee>
|
||||
*
|
||||
* $Id: pcsclite.h.in 6355 2012-06-25 13:22:27Z rousseau $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief This keeps a list of defines for pcsc-lite.
|
||||
*
|
||||
* Error codes from http://msdn.microsoft.com/en-us/library/aa924526.aspx
|
||||
*/
|
||||
|
||||
#ifndef __pcsclite_h__
|
||||
#define __pcsclite_h__
|
||||
|
||||
#include <wintypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef LONG SCARDCONTEXT; /**< \p hContext returned by SCardEstablishContext() */
|
||||
typedef SCARDCONTEXT *PSCARDCONTEXT;
|
||||
typedef SCARDCONTEXT *LPSCARDCONTEXT;
|
||||
typedef LONG SCARDHANDLE; /**< \p hCard returned by SCardConnect() */
|
||||
typedef SCARDHANDLE *PSCARDHANDLE;
|
||||
typedef SCARDHANDLE *LPSCARDHANDLE;
|
||||
|
||||
#define MAX_ATR_SIZE 33 /**< Maximum ATR size */
|
||||
|
||||
/* Set structure elements aligment on bytes
|
||||
* http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html */
|
||||
#ifdef __APPLE__
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *szReader;
|
||||
void *pvUserData;
|
||||
DWORD dwCurrentState;
|
||||
DWORD dwEventState;
|
||||
DWORD cbAtr;
|
||||
unsigned char rgbAtr[MAX_ATR_SIZE];
|
||||
}
|
||||
SCARD_READERSTATE, *LPSCARD_READERSTATE;
|
||||
|
||||
/** Protocol Control Information (PCI) */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long dwProtocol; /**< Protocol identifier */
|
||||
unsigned long cbPciLength; /**< Protocol Control Inf Length */
|
||||
}
|
||||
SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
|
||||
|
||||
typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
|
||||
|
||||
extern const SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, g_rgSCardRawPci;
|
||||
|
||||
/* restore default structure elements alignment */
|
||||
#ifdef __APPLE__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#define SCARD_PCI_T0 (&g_rgSCardT0Pci) /**< protocol control information (PCI) for T=0 */
|
||||
#define SCARD_PCI_T1 (&g_rgSCardT1Pci) /**< protocol control information (PCI) for T=1 */
|
||||
#define SCARD_PCI_RAW (&g_rgSCardRawPci) /**< protocol control information (PCI) for RAW protocol */
|
||||
|
||||
/** error codes from http://msdn.microsoft.com/en-us/library/aa924526.aspx
|
||||
*/
|
||||
#define SCARD_S_SUCCESS ((LONG)0x00000000) /**< No error was encountered. */
|
||||
#define SCARD_F_INTERNAL_ERROR ((LONG)0x80100001) /**< An internal consistency check failed. */
|
||||
#define SCARD_E_CANCELLED ((LONG)0x80100002) /**< The action was cancelled by an SCardCancel request. */
|
||||
#define SCARD_E_INVALID_HANDLE ((LONG)0x80100003) /**< The supplied handle was invalid. */
|
||||
#define SCARD_E_INVALID_PARAMETER ((LONG)0x80100004) /**< One or more of the supplied parameters could not be properly interpreted. */
|
||||
#define SCARD_E_INVALID_TARGET ((LONG)0x80100005) /**< Registry startup information is missing or invalid. */
|
||||
#define SCARD_E_NO_MEMORY ((LONG)0x80100006) /**< Not enough memory available to complete this command. */
|
||||
#define SCARD_F_WAITED_TOO_LONG ((LONG)0x80100007) /**< An internal consistency timer has expired. */
|
||||
#define SCARD_E_INSUFFICIENT_BUFFER ((LONG)0x80100008) /**< The data buffer to receive returned data is too small for the returned data. */
|
||||
#define SCARD_E_UNKNOWN_READER ((LONG)0x80100009) /**< The specified reader name is not recognized. */
|
||||
#define SCARD_E_TIMEOUT ((LONG)0x8010000A) /**< The user-specified timeout value has expired. */
|
||||
#define SCARD_E_SHARING_VIOLATION ((LONG)0x8010000B) /**< The smart card cannot be accessed because of other connections outstanding. */
|
||||
#define SCARD_E_NO_SMARTCARD ((LONG)0x8010000C) /**< The operation requires a Smart Card, but no Smart Card is currently in the device. */
|
||||
#define SCARD_E_UNKNOWN_CARD ((LONG)0x8010000D) /**< The specified smart card name is not recognized. */
|
||||
#define SCARD_E_CANT_DISPOSE ((LONG)0x8010000E) /**< The system could not dispose of the media in the requested manner. */
|
||||
#define SCARD_E_PROTO_MISMATCH ((LONG)0x8010000F) /**< The requested protocols are incompatible with the protocol currently in use with the smart card. */
|
||||
#define SCARD_E_NOT_READY ((LONG)0x80100010) /**< The reader or smart card is not ready to accept commands. */
|
||||
#define SCARD_E_INVALID_VALUE ((LONG)0x80100011) /**< One or more of the supplied parameters values could not be properly interpreted. */
|
||||
#define SCARD_E_SYSTEM_CANCELLED ((LONG)0x80100012) /**< The action was cancelled by the system, presumably to log off or shut down. */
|
||||
#define SCARD_F_COMM_ERROR ((LONG)0x80100013) /**< An internal communications error has been detected. */
|
||||
#define SCARD_F_UNKNOWN_ERROR ((LONG)0x80100014) /**< An internal error has been detected, but the source is unknown. */
|
||||
#define SCARD_E_INVALID_ATR ((LONG)0x80100015) /**< An ATR obtained from the registry is not a valid ATR string. */
|
||||
#define SCARD_E_NOT_TRANSACTED ((LONG)0x80100016) /**< An attempt was made to end a non-existent transaction. */
|
||||
#define SCARD_E_READER_UNAVAILABLE ((LONG)0x80100017) /**< The specified reader is not currently available for use. */
|
||||
#define SCARD_P_SHUTDOWN ((LONG)0x80100018) /**< The operation has been aborted to allow the server application to exit. */
|
||||
#define SCARD_E_PCI_TOO_SMALL ((LONG)0x80100019) /**< The PCI Receive buffer was too small. */
|
||||
#define SCARD_E_READER_UNSUPPORTED ((LONG)0x8010001A) /**< The reader driver does not meet minimal requirements for support. */
|
||||
#define SCARD_E_DUPLICATE_READER ((LONG)0x8010001B) /**< The reader driver did not produce a unique reader name. */
|
||||
#define SCARD_E_CARD_UNSUPPORTED ((LONG)0x8010001C) /**< The smart card does not meet minimal requirements for support. */
|
||||
#define SCARD_E_NO_SERVICE ((LONG)0x8010001D) /**< The Smart card resource manager is not running. */
|
||||
#define SCARD_E_SERVICE_STOPPED ((LONG)0x8010001E) /**< The Smart card resource manager has shut down. */
|
||||
#define SCARD_E_UNEXPECTED ((LONG)0x8010001F) /**< An unexpected card error has occurred. */
|
||||
#define SCARD_E_UNSUPPORTED_FEATURE ((LONG)0x8010001F) /**< This smart card does not support the requested feature. */
|
||||
#define SCARD_E_ICC_INSTALLATION ((LONG)0x80100020) /**< No primary provider can be found for the smart card. */
|
||||
#define SCARD_E_ICC_CREATEORDER ((LONG)0x80100021) /**< The requested order of object creation is not supported. */
|
||||
/* #define SCARD_E_UNSUPPORTED_FEATURE ((LONG)0x80100022) / **< This smart card does not support the requested feature. */
|
||||
#define SCARD_E_DIR_NOT_FOUND ((LONG)0x80100023) /**< The identified directory does not exist in the smart card. */
|
||||
#define SCARD_E_FILE_NOT_FOUND ((LONG)0x80100024) /**< The identified file does not exist in the smart card. */
|
||||
#define SCARD_E_NO_DIR ((LONG)0x80100025) /**< The supplied path does not represent a smart card directory. */
|
||||
#define SCARD_E_NO_FILE ((LONG)0x80100026) /**< The supplied path does not represent a smart card file. */
|
||||
#define SCARD_E_NO_ACCESS ((LONG)0x80100027) /**< Access is denied to this file. */
|
||||
#define SCARD_E_WRITE_TOO_MANY ((LONG)0x80100028) /**< The smart card does not have enough memory to store the information. */
|
||||
#define SCARD_E_BAD_SEEK ((LONG)0x80100029) /**< There was an error trying to set the smart card file object pointer. */
|
||||
#define SCARD_E_INVALID_CHV ((LONG)0x8010002A) /**< The supplied PIN is incorrect. */
|
||||
#define SCARD_E_UNKNOWN_RES_MNG ((LONG)0x8010002B) /**< An unrecognized error code was returned from a layered component. */
|
||||
#define SCARD_E_NO_SUCH_CERTIFICATE ((LONG)0x8010002C) /**< The requested certificate does not exist. */
|
||||
#define SCARD_E_CERTIFICATE_UNAVAILABLE ((LONG)0x8010002D) /**< The requested certificate could not be obtained. */
|
||||
#define SCARD_E_NO_READERS_AVAILABLE ((LONG)0x8010002E) /**< Cannot find a smart card reader. */
|
||||
#define SCARD_E_COMM_DATA_LOST ((LONG)0x8010002F) /**< A communications error with the smart card has been detected. Retry the operation. */
|
||||
#define SCARD_E_NO_KEY_CONTAINER ((LONG)0x80100030) /**< The requested key container does not exist on the smart card. */
|
||||
#define SCARD_E_SERVER_TOO_BUSY ((LONG)0x80100031) /**< The Smart Card Resource Manager is too busy to complete this operation. */
|
||||
|
||||
#define SCARD_W_UNSUPPORTED_CARD ((LONG)0x80100065) /**< The reader cannot communicate with the card, due to ATR string configuration conflicts. */
|
||||
#define SCARD_W_UNRESPONSIVE_CARD ((LONG)0x80100066) /**< The smart card is not responding to a reset. */
|
||||
#define SCARD_W_UNPOWERED_CARD ((LONG)0x80100067) /**< Power has been removed from the smart card, so that further communication is not possible. */
|
||||
#define SCARD_W_RESET_CARD ((LONG)0x80100068) /**< The smart card has been reset, so any shared state information is invalid. */
|
||||
#define SCARD_W_REMOVED_CARD ((LONG)0x80100069) /**< The smart card has been removed, so further communication is not possible. */
|
||||
|
||||
#define SCARD_W_SECURITY_VIOLATION ((LONG)0x8010006A) /**< Access was denied because of a security violation. */
|
||||
#define SCARD_W_WRONG_CHV ((LONG)0x8010006B) /**< The card cannot be accessed because the wrong PIN was presented. */
|
||||
#define SCARD_W_CHV_BLOCKED ((LONG)0x8010006C) /**< The card cannot be accessed because the maximum number of PIN entry attempts has been reached. */
|
||||
#define SCARD_W_EOF ((LONG)0x8010006D) /**< The end of the smart card file has been reached. */
|
||||
#define SCARD_W_CANCELLED_BY_USER ((LONG)0x8010006E) /**< The user pressed "Cancel" on a Smart Card Selection Dialog. */
|
||||
#define SCARD_W_CARD_NOT_AUTHENTICATED ((LONG)0x8010006F) /**< No PIN was presented to the smart card. */
|
||||
|
||||
#define SCARD_AUTOALLOCATE (DWORD)(-1) /**< see SCardFreeMemory() */
|
||||
#define SCARD_SCOPE_USER 0x0000 /**< Scope in user space */
|
||||
#define SCARD_SCOPE_TERMINAL 0x0001 /**< Scope in terminal */
|
||||
#define SCARD_SCOPE_SYSTEM 0x0002 /**< Scope in system */
|
||||
|
||||
#define SCARD_PROTOCOL_UNDEFINED 0x0000 /**< protocol not set */
|
||||
#define SCARD_PROTOCOL_UNSET SCARD_PROTOCOL_UNDEFINED /* backward compat */
|
||||
#define SCARD_PROTOCOL_T0 0x0001 /**< T=0 active protocol. */
|
||||
#define SCARD_PROTOCOL_T1 0x0002 /**< T=1 active protocol. */
|
||||
#define SCARD_PROTOCOL_RAW 0x0004 /**< Raw active protocol. */
|
||||
#define SCARD_PROTOCOL_T15 0x0008 /**< T=15 protocol. */
|
||||
|
||||
#define SCARD_PROTOCOL_ANY (SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1) /**< IFD determines prot. */
|
||||
|
||||
#define SCARD_SHARE_EXCLUSIVE 0x0001 /**< Exclusive mode only */
|
||||
#define SCARD_SHARE_SHARED 0x0002 /**< Shared mode only */
|
||||
#define SCARD_SHARE_DIRECT 0x0003 /**< Raw mode only */
|
||||
|
||||
#define SCARD_LEAVE_CARD 0x0000 /**< Do nothing on close */
|
||||
#define SCARD_RESET_CARD 0x0001 /**< Reset on close */
|
||||
#define SCARD_UNPOWER_CARD 0x0002 /**< Power down on close */
|
||||
#define SCARD_EJECT_CARD 0x0003 /**< Eject on close */
|
||||
|
||||
#define SCARD_UNKNOWN 0x0001 /**< Unknown state */
|
||||
#define SCARD_ABSENT 0x0002 /**< Card is absent */
|
||||
#define SCARD_PRESENT 0x0004 /**< Card is present */
|
||||
#define SCARD_SWALLOWED 0x0008 /**< Card not powered */
|
||||
#define SCARD_POWERED 0x0010 /**< Card is powered */
|
||||
#define SCARD_NEGOTIABLE 0x0020 /**< Ready for PTS */
|
||||
#define SCARD_SPECIFIC 0x0040 /**< PTS has been set */
|
||||
|
||||
#define SCARD_STATE_UNAWARE 0x0000 /**< App wants status */
|
||||
#define SCARD_STATE_IGNORE 0x0001 /**< Ignore this reader */
|
||||
#define SCARD_STATE_CHANGED 0x0002 /**< State has changed */
|
||||
#define SCARD_STATE_UNKNOWN 0x0004 /**< Reader unknown */
|
||||
#define SCARD_STATE_UNAVAILABLE 0x0008 /**< Status unavailable */
|
||||
#define SCARD_STATE_EMPTY 0x0010 /**< Card removed */
|
||||
#define SCARD_STATE_PRESENT 0x0020 /**< Card inserted */
|
||||
#define SCARD_STATE_ATRMATCH 0x0040 /**< ATR matches card */
|
||||
#define SCARD_STATE_EXCLUSIVE 0x0080 /**< Exclusive Mode */
|
||||
#define SCARD_STATE_INUSE 0x0100 /**< Shared Mode */
|
||||
#define SCARD_STATE_MUTE 0x0200 /**< Unresponsive card */
|
||||
#define SCARD_STATE_UNPOWERED 0x0400 /**< Unpowered card */
|
||||
|
||||
#ifndef INFINITE
|
||||
#define INFINITE 0xFFFFFFFF /**< Infinite timeout */
|
||||
#endif
|
||||
|
||||
#define PCSCLITE_VERSION_NUMBER "@VERSION@" /**< Current version */
|
||||
/** Maximum readers context (a slot is count as a reader) */
|
||||
#define PCSCLITE_MAX_READERS_CONTEXTS 16
|
||||
|
||||
#define MAX_READERNAME 128
|
||||
|
||||
#ifndef SCARD_ATR_LENGTH
|
||||
#define SCARD_ATR_LENGTH MAX_ATR_SIZE /**< Maximum ATR size */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The message and buffer sizes must be multiples of 16.
|
||||
* The max message size must be at least large enough
|
||||
* to accomodate the transmit_struct
|
||||
*/
|
||||
#define MAX_BUFFER_SIZE 264 /**< Maximum Tx/Rx Buffer for short APDU */
|
||||
#define MAX_BUFFER_SIZE_EXTENDED (4 + 3 + (1<<16) + 3 + 2) /**< enhanced (64K + APDU + Lc + Le + SW) Tx/Rx Buffer */
|
||||
|
||||
/*
|
||||
* Gets a stringified error response
|
||||
*/
|
||||
char *pcsc_stringify_error(const LONG);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
102
virtualsmartcard/src/pcsclite-vpcd/PCSC/winscard.h
Normal file
102
virtualsmartcard/src/pcsclite-vpcd/PCSC/winscard.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
||||
*
|
||||
* Copyright (C) 1999-2003
|
||||
* David Corcoran <corcoran@linuxnet.com>
|
||||
* Copyright (C) 2002-2009
|
||||
* Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||
*
|
||||
* $Id: winscard.h 5962 2011-09-24 08:24:34Z rousseau $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief This handles smart card reader communications.
|
||||
*/
|
||||
|
||||
#ifndef __winscard_h__
|
||||
#define __winscard_h__
|
||||
|
||||
#include <pcsclite.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef PCSC_API
|
||||
#define PCSC_API
|
||||
#endif
|
||||
|
||||
PCSC_API LONG SCardEstablishContext(DWORD dwScope,
|
||||
/*@null@*/ LPCVOID pvReserved1, /*@null@*/ LPCVOID pvReserved2,
|
||||
/*@out@*/ LPSCARDCONTEXT phContext);
|
||||
|
||||
PCSC_API LONG SCardReleaseContext(SCARDCONTEXT hContext);
|
||||
|
||||
PCSC_API LONG SCardIsValidContext(SCARDCONTEXT hContext);
|
||||
|
||||
PCSC_API LONG SCardConnect(SCARDCONTEXT hContext,
|
||||
LPCSTR szReader,
|
||||
DWORD dwShareMode,
|
||||
DWORD dwPreferredProtocols,
|
||||
/*@out@*/ LPSCARDHANDLE phCard, /*@out@*/ LPDWORD pdwActiveProtocol);
|
||||
|
||||
PCSC_API LONG SCardReconnect(SCARDHANDLE hCard,
|
||||
DWORD dwShareMode,
|
||||
DWORD dwPreferredProtocols,
|
||||
DWORD dwInitialization, /*@out@*/ LPDWORD pdwActiveProtocol);
|
||||
|
||||
PCSC_API LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
|
||||
|
||||
PCSC_API LONG SCardBeginTransaction(SCARDHANDLE hCard);
|
||||
|
||||
PCSC_API LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
|
||||
|
||||
PCSC_API LONG SCardStatus(SCARDHANDLE hCard,
|
||||
/*@null@*/ /*@out@*/ LPSTR mszReaderName,
|
||||
/*@null@*/ /*@out@*/ LPDWORD pcchReaderLen,
|
||||
/*@null@*/ /*@out@*/ LPDWORD pdwState,
|
||||
/*@null@*/ /*@out@*/ LPDWORD pdwProtocol,
|
||||
/*@null@*/ /*@out@*/ LPBYTE pbAtr,
|
||||
/*@null@*/ /*@out@*/ LPDWORD pcbAtrLen);
|
||||
|
||||
PCSC_API LONG SCardGetStatusChange(SCARDCONTEXT hContext,
|
||||
DWORD dwTimeout,
|
||||
LPSCARD_READERSTATE rgReaderStates, DWORD cReaders);
|
||||
|
||||
PCSC_API LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode,
|
||||
LPCVOID pbSendBuffer, DWORD cbSendLength,
|
||||
/*@out@*/ LPVOID pbRecvBuffer, DWORD cbRecvLength,
|
||||
LPDWORD lpBytesReturned);
|
||||
|
||||
PCSC_API LONG SCardTransmit(SCARDHANDLE hCard,
|
||||
const SCARD_IO_REQUEST *pioSendPci,
|
||||
LPCBYTE pbSendBuffer, DWORD cbSendLength,
|
||||
/*@out@*/ SCARD_IO_REQUEST *pioRecvPci,
|
||||
/*@out@*/ LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
|
||||
|
||||
PCSC_API LONG SCardListReaderGroups(SCARDCONTEXT hContext,
|
||||
/*@out@*/ LPSTR mszGroups, LPDWORD pcchGroups);
|
||||
|
||||
PCSC_API LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/*@null@*/ /*@out@*/ LPCSTR mszGroups,
|
||||
/*@null@*/ /*@out@*/ LPSTR mszReaders,
|
||||
/*@out@*/ LPDWORD pcchReaders);
|
||||
|
||||
PCSC_API LONG SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem);
|
||||
|
||||
PCSC_API LONG SCardCancel(SCARDCONTEXT hContext);
|
||||
|
||||
PCSC_API LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,
|
||||
/*@out@*/ LPBYTE pbAttr, LPDWORD pcbAttrLen);
|
||||
|
||||
PCSC_API LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,
|
||||
LPCBYTE pbAttr, DWORD cbAttrLen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
94
virtualsmartcard/src/pcsclite-vpcd/PCSC/wintypes.h
Normal file
94
virtualsmartcard/src/pcsclite-vpcd/PCSC/wintypes.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
||||
*
|
||||
* Copyright (C) 1999
|
||||
* David Corcoran <corcoran@linuxnet.com>
|
||||
* Copyright (C) 2002-2011
|
||||
* Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||
*
|
||||
* $Id: wintypes.h 5869 2011-07-09 12:04:18Z rousseau $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief This keeps a list of Windows(R) types.
|
||||
*/
|
||||
|
||||
#ifndef __wintypes_h__
|
||||
#define __wintypes_h__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef BYTE
|
||||
typedef uint8_t BYTE;
|
||||
#endif
|
||||
typedef uint8_t UCHAR;
|
||||
typedef UCHAR *PUCHAR;
|
||||
typedef uint16_t USHORT;
|
||||
|
||||
#ifndef __COREFOUNDATION_CFPLUGINCOM__
|
||||
typedef uint32_t ULONG;
|
||||
typedef void *LPVOID;
|
||||
typedef int16_t BOOL;
|
||||
#endif
|
||||
|
||||
typedef ULONG *PULONG;
|
||||
typedef const void *LPCVOID;
|
||||
typedef uint32_t DWORD;
|
||||
typedef DWORD *PDWORD;
|
||||
typedef uint16_t WORD;
|
||||
typedef int32_t LONG;
|
||||
typedef const char *LPCSTR;
|
||||
typedef const BYTE *LPCBYTE;
|
||||
typedef BYTE *LPBYTE;
|
||||
typedef DWORD *LPDWORD;
|
||||
typedef char *LPSTR;
|
||||
|
||||
#else
|
||||
|
||||
#ifndef BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
typedef unsigned char UCHAR;
|
||||
typedef UCHAR *PUCHAR;
|
||||
typedef unsigned short USHORT;
|
||||
|
||||
#ifndef __COREFOUNDATION_CFPLUGINCOM__
|
||||
typedef unsigned long ULONG;
|
||||
typedef void *LPVOID;
|
||||
#endif
|
||||
|
||||
typedef const void *LPCVOID;
|
||||
typedef unsigned long DWORD;
|
||||
typedef DWORD *PDWORD;
|
||||
typedef long LONG;
|
||||
typedef const char *LPCSTR;
|
||||
typedef const BYTE *LPCBYTE;
|
||||
typedef BYTE *LPBYTE;
|
||||
typedef DWORD *LPDWORD;
|
||||
typedef char *LPSTR;
|
||||
|
||||
/* these types were deprecated but still used by old drivers and
|
||||
* applications. So just declare and use them. */
|
||||
typedef LPSTR LPTSTR;
|
||||
typedef LPCSTR LPCTSTR;
|
||||
|
||||
/* types unused by pcsc-lite */
|
||||
typedef short BOOL;
|
||||
typedef unsigned short WORD;
|
||||
typedef ULONG *PULONG;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user