globalplatform
connectionplugin.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2026, Karsten Ohme
3  * This file is part of GlobalPlatform.
4  *
5  * GlobalPlatform is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * GlobalPlatform is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with GlobalPlatform. If not, see <https://www.gnu.org/licenses/>.
17  *
18  * In addition, as a special exception, the copyright holders give
19  * permission to link the code of portions of this program with the
20  * OpenSSL library under certain conditions as described in each
21  * individual source file, and distribute linked combinations
22  * including the two.
23  * You must obey the GNU Lesser General Public License in all respects
24  * for all of the code used other than OpenSSL. If you modify
25  * file(s) with this exception, you may extend this exception to your
26  * version of the file(s), but you are not obligated to do so. If you
27  * do not wish to do so, delete this exception statement from your
28  * version.
29  */
30 
39 #ifndef OPGP_CONNECTION_PLUGIN_H
40 #define OPGP_CONNECTION_PLUGIN_H
41 
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 
47 #include "connection.h"
48 #include "error.h"
49 #include "library.h"
50 
51 #define OPGP_PL_ERROR_PREFIX ((DWORD) 0x80500000)
52 
53 #define OPGP_PL_ERROR_NO_CARD_CONTEXT_INITIALIZED (OPGP_PL_ERROR_PREFIX | (DWORD)0x0001L)
54 #define OPGP_PL_ERROR_NO_CARD_INFO_INITIALIZED (OPGP_PL_ERROR_PREFIX | (DWORD)0x0002L)
55 
56 
58 OPGP_PL_API
60 
62 OPGP_PL_API
64 
66 OPGP_PL_API
67 OPGP_ERROR_STATUS OPGP_PL_list_readers(OPGP_CARD_CONTEXT cardContext, OPGP_STRING readerNames, PDWORD readerNamesLength, DWORD presentOnly);
68 
70 OPGP_PL_API
72 
74 OPGP_PL_API
76 
78 OPGP_PL_API
79 OPGP_ERROR_STATUS OPGP_PL_send_APDU(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, PBYTE capdu, DWORD capduLength, PBYTE rapdu, PDWORD rapduLength);
80 
82 OPGP_PL_API
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 #endif
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_establish_context(OPGP_CARD_CONTEXT *cardContext)
This function establishes a context to connection layer.
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_card_connect(OPGP_CARD_CONTEXT cardContext, OPGP_CSTRING readerName, OPGP_CARD_INFO *cardInfo, DWORD protocol)
This function connects to a reader.
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_card_disconnect(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO *cardInfo)
This function disconnects a reader.
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_send_APDU(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, PBYTE capdu, DWORD capduLength, PBYTE rapdu, PDWORD rapduLength)
This function sends an APDU.
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_supports_extended_APDU(OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, BOOL *supported)
This optional function reports whether the connection supports extended APDUs.
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_release_context(OPGP_CARD_CONTEXT *cardContext)
This function releases the context to the connection layer established by establish_context().
OPGP_PL_API OPGP_ERROR_STATUS OPGP_PL_list_readers(OPGP_CARD_CONTEXT cardContext, OPGP_STRING readerNames, PDWORD readerNamesLength, DWORD presentOnly)
This function returns a list of currently available readers.
Definition: connection.h:95
Definition: connection.h:106
Definition: error.h:58
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