36 #ifndef OPGP_CONNECTION_H
37 #define OPGP_CONNECTION_H
56 #if !defined __winscard_h__
57 #define MAX_ATR_SIZE 33
60 #define OPGP_TRACE_MODE_ENABLE 1
61 #define OPGP_TRACE_MODE_DISABLE 0
63 #define OPGP_CARD_PROTOCOL_T0 SCARD_PROTOCOL_T0
64 #define OPGP_CARD_PROTOCOL_T1 SCARD_PROTOCOL_T1
82 OPGP_ESTABLISH_CONTEXT_FN establishContext;
83 OPGP_RELEASE_CONTEXT_FN releaseContext;
84 OPGP_CARD_CONNECT_FN cardConnect;
85 OPGP_CARD_DISCONNECT_FN cardDisconnect;
86 OPGP_LIST_READERS_FN listReaders;
87 OPGP_SEND_APDU_FN sendAPDU;
88 OPGP_SUPPORTS_EXTENDED_APDU_FN supportsExtendedAPDU;
OPGP_API OPGP_ERROR_STATUS OPGP_card_connect(OPGP_CARD_CONTEXT cardContext, OPGP_CSTRING readerName, OPGP_CARD_INFO *cardInfo, DWORD protocol)
This function connects to a reader.
Definition: connection.c:266
OPGP_API OPGP_ERROR_STATUS OPGP_release_context(OPGP_CARD_CONTEXT *cardContext)
This function releases the context to the connection layer established by OPGP_establish_context().
Definition: connection.c:203
struct OPGP_CARD_INFO OPGP_CARD_INFO
Definition: connection.h:67
OPGP_API OPGP_ERROR_STATUS OPGP_send_APDU(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE capdu, DWORD capduLength, PBYTE rapdu, PDWORD rapduLength)
This function sends an APDU.
Definition: connection.c:317
OPGP_API OPGP_ERROR_STATUS OPGP_send_chained_APDU(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE capdus[], DWORD capduLengths[], DWORD numCapdus, PBYTE rapdu, PDWORD rapduLength)
This function sends multiple APDUs that belong to one logical command.
Definition: connection.c:403
#define MAX_ATR_SIZE
Maximum ATR size.
Definition: connection.h:57
OPGP_API void OPGP_enable_trace_mode(DWORD enable, FILE *out)
Enables the trace mode.
Definition: connection.c:58
FILE * traceFile
The trace file for trace mode.
Definition: connection.c:43
DWORD traceEnable
Enable trace mode.
Definition: connection.c:42
OPGP_API OPGP_ERROR_STATUS OPGP_card_disconnect(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO *cardInfo)
This function disconnects a reader.
Definition: connection.c:296
OPGP_API OPGP_ERROR_STATUS OPGP_list_readers(OPGP_CARD_CONTEXT cardContext, OPGP_STRING readerNames, PDWORD readerNamesLength, DWORD presentOnly)
This function returns a list of currently available readers.
Definition: connection.c:247
struct OPGP_CARD_CONTEXT OPGP_CARD_CONTEXT
Definition: connection.h:66
OPGP_API OPGP_ERROR_STATUS OPGP_establish_context(OPGP_CARD_CONTEXT *cardContext)
This function establishes a context to connection layer.
Definition: connection.c:71
Definition: security.h:243
Definition: connection.h:95
PVOID librarySpecific
Library specific data.
Definition: connection.h:96
TCHAR libraryVersion[32]
The version of the connection library to use.
Definition: connection.h:98
OPGP_CONNECTION_FUNCTIONS connectionFunctions
Connection functions of the connection library. Is automatically filled in if the connection library ...
Definition: connection.h:100
PVOID libraryHandle
The handle to the library.
Definition: connection.h:99
TCHAR libraryName[64]
The name of the connection library to use.
Definition: connection.h:97
Definition: connection.h:106
DWORD ATRLength
The length of the ATR buffer.
Definition: connection.h:108
BYTE logicalChannel
The current logical channel.
Definition: connection.h:109
BOOL extendedAPDUSupported
TRUE if the connection supports extended APDUs for this card.
Definition: connection.h:111
BYTE specVersion
The specification version, see OP_201 or GP_211.
Definition: connection.h:110
BYTE ATR[MAX_ATR_SIZE]
The Answer To Reset from the card.
Definition: connection.h:107
PVOID librarySpecific
Specific data for the library.
Definition: connection.h:112
Definition: connection.h:81
void * PVOID
Pointer definition.
Definition: types.h:52
unsigned char BYTE
A Microsoft/Muscle BYTE definition.
Definition: types.h:67
unsigned char * PBYTE
A Microsoft/Muscle LPBYTE, pointer to unsigned char.
Definition: types.h:64
unsigned long * PDWORD
A Microsoft LPDWORD/Muscle pointer to a DWORD.
Definition: types.h:66
char * OPGP_STRING
A Microsoft/Muscle LPTSTR.
Definition: types.h:62
unsigned long DWORD
A Microsoft/Muscle DWORD definition.
Definition: types.h:68
const char * OPGP_CSTRING
A Microsoft/Muscle LPCTSTR.
Definition: types.h:63
This handles smartcard reader communications.