1/*
2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26typedef LONG (*FPTR_SCardEstablishContext)(ULONG dwScope,
27                const void *pvReserved1,
28                const void *pvReserved2,
29                LONG *phContext);
30
31typedef LONG (*FPTR_SCardConnect)(LONG hContext,
32                const char *szReader,
33                ULONG dwShareMode,
34                ULONG dwPreferredProtocols,
35                LONG *phCard, ULONG *pdwActiveProtocol);
36
37typedef LONG (*FPTR_SCardDisconnect)(LONG hCard, ULONG dwDisposition);
38
39typedef LONG (*FPTR_SCardStatus)(LONG hCard,
40                char *mszReaderNames,
41                ULONG *pcchReaderLen,
42                ULONG *pdwState,
43                ULONG *pdwProtocol,
44                unsigned char *pbAtr, ULONG *pcbAtrLen);
45
46typedef LONG (*FPTR_SCardGetStatusChange)(LONG hContext,
47                ULONG dwTimeout,
48                LPSCARD_READERSTATE_A rgReaderStates, ULONG cReaders);
49
50typedef LONG (*FPTR_SCardTransmit)(LONG hCard,
51                LPCSCARD_IO_REQUEST pioSendPci,
52                const unsigned char *pbSendBuffer,
53                ULONG cbSendLength,
54                LPSCARD_IO_REQUEST pioRecvPci,
55                unsigned char *pbRecvBuffer, ULONG *pcbRecvLength);
56
57typedef LONG (*FPTR_SCardListReaders)(LONG hContext,
58                const char *mszGroups,
59                char *mszReaders, ULONG *pcchReaders);
60
61typedef LONG (*FPTR_SCardBeginTransaction)(LONG hCard);
62
63typedef LONG (*FPTR_SCardEndTransaction)(LONG hCard, ULONG dwDisposition);
64
65typedef LONG (*FPTR_SCardControl)(LONG hCard, ULONG dwControlCode,
66    const void* pbSendBuffer, ULONG cbSendLength, const void* pbRecvBuffer,
67    ULONG pcbRecvLength, ULONG *lpBytesReturned);
68
69#define CALL_SCardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext) \
70    ((scardEstablishContext)(dwScope, pvReserved1, pvReserved2, phContext))
71
72#define CALL_SCardConnect(hContext, szReader, dwSharedMode, dwPreferredProtocols, phCard, pdwActiveProtocols) \
73    ((scardConnect)(hContext, szReader, dwSharedMode, dwPreferredProtocols, phCard, pdwActiveProtocols))
74
75#define CALL_SCardDisconnect(hCard, dwDisposition) \
76    ((scardDisconnect)(hCard, dwDisposition))
77
78#define CALL_SCardStatus(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen) \
79    ((scardStatus)(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen))
80
81#define CALL_SCardGetStatusChange(hContext, dwTimeout, rgReaderStates, cReaders) \
82    ((scardGetStatusChange)(hContext, dwTimeout, rgReaderStates, cReaders))
83
84#define CALL_SCardTransmit(hCard, pioSendPci, pbSendBuffer, cbSendLength, \
85                            pioRecvPci, pbRecvBuffer, pcbRecvLength) \
86    ((scardTransmit)(hCard, pioSendPci, pbSendBuffer, cbSendLength, \
87                            pioRecvPci, pbRecvBuffer, pcbRecvLength))
88
89#define CALL_SCardListReaders(hContext, mszGroups, mszReaders, pcchReaders) \
90    ((scardListReaders)(hContext, mszGroups, mszReaders, pcchReaders))
91
92#define CALL_SCardBeginTransaction(hCard) \
93    ((scardBeginTransaction)(hCard))
94
95#define CALL_SCardEndTransaction(hCard, dwDisposition) \
96    ((scardEndTransaction)(hCard, dwDisposition))
97
98#define CALL_SCardControl(hCard, dwControlCode, pbSendBuffer, cbSendLength, \
99            pbRecvBuffer, pcbRecvLength, lpBytesReturned) \
100    ((scardControl)(hCard, dwControlCode, pbSendBuffer, cbSendLength, \
101            pbRecvBuffer, pcbRecvLength, lpBytesReturned))
102
103extern FPTR_SCardEstablishContext scardEstablishContext;
104extern FPTR_SCardConnect scardConnect;
105extern FPTR_SCardDisconnect scardDisconnect;
106extern FPTR_SCardStatus scardStatus;
107extern FPTR_SCardGetStatusChange scardGetStatusChange;
108extern FPTR_SCardTransmit scardTransmit;
109extern FPTR_SCardListReaders scardListReaders;
110extern FPTR_SCardBeginTransaction scardBeginTransaction;
111extern FPTR_SCardEndTransaction scardEndTransaction;
112extern FPTR_SCardControl scardControl;
113