VirtualBox

source: vbox/trunk/src/VBox/RDP/client-1.8.3/scard.h@ 55121

最後變更 在這個檔案從55121是 55121,由 vboxsync 提交於 10 年 前

rdesktop 1.8.3 unmodified

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.9 KB
 
1/*
2 rdesktop: A Remote Desktop Protocol client.
3 Smart Card support
4 Copyright (C) Alexi Volkov <[email protected]> 2006
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include <pthread.h>
21#include "proto.h"
22
23/*************************************************************************/
24/* these are the additional types needed to split out 64-vs-32-bit APIs */
25/* */
26
27/* The point of all of this is to avoid patching the existing smartcard
28 * infrastructure (PC/SC Lite, libmusclecard+libmusclepkcs11 or CoolKey, any
29 * other apps linking against any of these) because the need for patches
30 * spreads without limit. The alternative is to patch the heck out of rdesktop,
31 * which is already being done anyway.
32 *
33 * - [email protected], 2 Aug 2006
34 */
35
36#ifdef HAVE_STDINT_H
37#include <stdint.h>
38#endif
39#ifdef HAVE_INTTYPES_H
40#include <inttypes.h>
41#endif
42
43/* A DWORD when dealing with the smartcard stuff. Could be 32 bits or 64. */
44typedef DWORD MYPCSC_DWORD;
45/* A DWORD when talking to the server. Must be exactly 32 bits all the time.*/
46typedef uint32_t SERVER_DWORD;
47
48typedef SCARDCONTEXT MYPCSC_SCARDCONTEXT;
49typedef SCARDHANDLE MYPCSC_SCARDHANDLE;
50typedef uint32_t SERVER_SCARDCONTEXT;
51typedef uint32_t SERVER_SCARDHANDLE;
52
53typedef SCARD_READERSTATE MYPCSC_SCARD_READERSTATE_A, *MYPCSC_LPSCARD_READERSTATE_A;
54
55typedef struct
56{
57 const char *szReader;
58 void *pvUserData;
59 SERVER_DWORD dwCurrentState;
60 SERVER_DWORD dwEventState;
61 SERVER_DWORD cbAtr;
62 unsigned char rgbAtr[36];
63}
64SERVER_SCARD_READERSTATE_A;
65
66typedef SERVER_SCARD_READERSTATE_A *SERVER_LPSCARD_READERSTATE_A;
67
68#define SERVER_SCARDSTATESIZE (sizeof(SERVER_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *))
69#define MYPCSC_SCARDSTATESIZE (sizeof(MYPCSC_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *))
70
71typedef struct _SERVER_SCARD_IO_REQUEST
72{
73 SERVER_DWORD dwProtocol; /* Protocol identifier */
74 SERVER_DWORD cbPciLength; /* Protocol Control Inf Length */
75}
76SERVER_SCARD_IO_REQUEST, *SERVER_LPSCARD_IO_REQUEST;
77
78typedef SCARD_IO_REQUEST MYPCSC_SCARD_IO_REQUEST;
79typedef LPSCARD_IO_REQUEST MYPCSC_LPSCARD_IO_REQUEST;
80
81
82/* */
83/* */
84/*************************************************************************/
85
86
87#define SC_TRUE 1
88#define SC_FALSE 0
89
90#define SC_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */
91#define SC_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */
92#define SC_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */
93#define SC_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */
94#define SC_LIST_READERS 0x00090028 /* ListReadersA */
95#define SC_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */
96#define SC_FORGET_READER_GROUP 0x00090058 /* ForgetReader */
97#define SC_INTRODUCE_READER 0x00090060 /* IntroduceReader */
98#define SC_FORGET_READER 0x00090068 /* IntroduceReader */
99#define SC_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */
100#define SC_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */
101#define SC_CONNECT 0x000900AC /* ConnectA */
102#define SC_RECONNECT 0x000900B4 /* Reconnect */
103#define SC_DISCONNECT 0x000900B8 /* Disconnect */
104#define SC_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */
105#define SC_CANCEL 0x000900A8 /* Cancel */
106#define SC_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */
107#define SC_END_TRANSACTION 0x000900C0 /* EndTransaction */
108#define SC_STATE 0x000900C4 /* State */
109#define SC_STATUS 0x000900C8 /* StatusA */
110#define SC_TRANSMIT 0x000900D0 /* Transmit */
111#define SC_CONTROL 0x000900D4 /* Control */
112#define SC_GETATTRIB 0x000900D8 /* GetAttrib */
113#define SC_SETATTRIB 0x000900DC /* SetAttrib */
114#define SC_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */
115#define SC_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */
116
117/* #define INPUT_LINKED 0x00020000 */
118#define INPUT_LINKED 0xFFFFFFFF
119
120#define SC_THREAD_FUNCTION(f) void *(*f)(void *)
121
122extern RDPDR_DEVICE g_rdpdr_device[];
123
124typedef struct _MEM_HANDLE
125{
126 struct _MEM_HANDLE *prevHandle;
127 struct _MEM_HANDLE *nextHandle;
128 int dataSize;
129} MEM_HANDLE, *PMEM_HANDLE;
130
131typedef struct _SCARD_ATRMASK_L
132{
133 unsigned int cbAtr;
134 unsigned char rgbAtr[36];
135 unsigned char rgbMask[36];
136} SCARD_ATRMASK_L, *PSCARD_ATRMASK_L, *LPSCARD_ATRMASK_L;
137
138typedef struct _TSCNameMapRec
139{
140 char alias[128];
141 char name[128];
142 char vendor[128];
143} TSCNameMapRec, *PSCNameMapRec;
144
145typedef struct _TSCHCardRec
146{
147 DWORD hCard;
148 char *vendor;
149 struct _TSCHCardRec *next;
150 struct _TSCHCardRec *prev;
151} TSCHCardRec, *PSCHCardRec;
152
153typedef struct _TSCThreadData
154{
155 uint32 device;
156 uint32 id;
157 uint32 epoch;
158 RD_NTHANDLE handle;
159 uint32 request;
160 STREAM in;
161 STREAM out;
162 PMEM_HANDLE memHandle;
163 struct _TSCThreadData *next;
164} TSCThreadData, *PSCThreadData;
165
166typedef struct _TThreadListElement
167{
168 pthread_t thread;
169 pthread_mutex_t busy;
170 pthread_cond_t nodata;
171 PSCThreadData data;
172 struct _TThreadListElement *next;
173} TThreadListElement, *PThreadListElement;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette