pcsc-lite 2.5.2
atrhandler.c File Reference

This keeps track of smart card protocols, timing issues and ATR (Answer-to-Reset) handling. More...

#include "config.h"
#include <string.h>
#include "misc.h"
#include "pcsclite.h"
#include "debuglog.h"
#include "atrhandler.h"

Go to the source code of this file.

Macros

#define READ_IF_PRESENT(mask, out)

Functions

short ATRDecodeAtr (int *availableProtocols, int *currentProtocol, PUCHAR pucAtr, DWORD dwLength)
 parse an ATR

Detailed Description

This keeps track of smart card protocols, timing issues and ATR (Answer-to-Reset) handling.

Note
use ./configure –enable-debugatr to enable debug messages to be logged.

Definition in file atrhandler.c.

Macro Definition Documentation

◆ READ_IF_PRESENT

#define READ_IF_PRESENT ( mask,
out )
Value:
do { \
if (p >= dwLength || p >= MAX_ATR_SIZE) \
return -5; \
(out) = (Y1i & (mask)) ? pucAtr[p++] : -1; \
} while (0)
#define MAX_ATR_SIZE
Maximum ATR size.
Definition pcsclite.h:59

Function Documentation

◆ ATRDecodeAtr()

short ATRDecodeAtr ( int * availableProtocols,
int * currentProtocol,
PUCHAR pucAtr,
DWORD dwLength )

parse an ATR

Parameters
[out]availableProtocolsavailable protocols
[out]currentProtocolcurrent protocol
[in]pucAtrATR
[in]dwLengthATR length
Returns
Return values
-1Atr must have TS and T0
-2Unable to decode TS byte
-3Unable to decode LNS
-4Unable do decode T protocol
0Success

Definition at line 66 of file atrhandler.c.