VirtualBox

source: vbox/trunk/src/VBox/RDP/client-1.8.4/scard.h@ 79214

Last change on this file since 79214 was 55123, checked in by vboxsync, 10 years ago

rdesktop 1.8.3 modified for VBox

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
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/*
21 * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
22 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
23 * the General Public License version 2 (GPLv2) at this time for any software where
24 * a choice of GPL license versions is made available with the language indicating
25 * that GPLv2 or any later version may be used, or where a choice of which version
26 * of the GPL is applied is otherwise unspecified.
27 */
28
29#include <pthread.h>
30#include "proto.h"
31
32/*************************************************************************/
33/* these are the additional types needed to split out 64-vs-32-bit APIs */
34/* */
35
36/* The point of all of this is to avoid patching the existing smartcard
37 * infrastructure (PC/SC Lite, libmusclecard+libmusclepkcs11 or CoolKey, any
38 * other apps linking against any of these) because the need for patches
39 * spreads without limit. The alternative is to patch the heck out of rdesktop,
40 * which is already being done anyway.
41 *
42 * - [email protected], 2 Aug 2006
43 */
44
45#ifdef HAVE_STDINT_H
46#include <stdint.h>
47#endif
48#ifdef HAVE_INTTYPES_H
49#include <inttypes.h>
50#endif
51
52/* A DWORD when dealing with the smartcard stuff. Could be 32 bits or 64. */
53typedef DWORD MYPCSC_DWORD;
54/* A DWORD when talking to the server. Must be exactly 32 bits all the time.*/
55typedef uint32_t SERVER_DWORD;
56
57typedef SCARDCONTEXT MYPCSC_SCARDCONTEXT;
58typedef SCARDHANDLE MYPCSC_SCARDHANDLE;
59typedef uint32_t SERVER_SCARDCONTEXT;
60typedef uint32_t SERVER_SCARDHANDLE;
61
62typedef SCARD_READERSTATE MYPCSC_SCARD_READERSTATE_A, *MYPCSC_LPSCARD_READERSTATE_A;
63
64typedef struct
65{
66 const char *szReader;
67 void *pvUserData;
68 SERVER_DWORD dwCurrentState;
69 SERVER_DWORD dwEventState;
70 SERVER_DWORD cbAtr;
71 unsigned char rgbAtr[36];
72}
73SERVER_SCARD_READERSTATE_A;
74
75typedef SERVER_SCARD_READERSTATE_A *SERVER_LPSCARD_READERSTATE_A;
76
77#define SERVER_SCARDSTATESIZE (sizeof(SERVER_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *))
78#define MYPCSC_SCARDSTATESIZE (sizeof(MYPCSC_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *))
79
80typedef struct _SERVER_SCARD_IO_REQUEST
81{
82 SERVER_DWORD dwProtocol; /* Protocol identifier */
83 SERVER_DWORD cbPciLength; /* Protocol Control Inf Length */
84}
85SERVER_SCARD_IO_REQUEST, *SERVER_LPSCARD_IO_REQUEST;
86
87typedef SCARD_IO_REQUEST MYPCSC_SCARD_IO_REQUEST;
88typedef LPSCARD_IO_REQUEST MYPCSC_LPSCARD_IO_REQUEST;
89
90
91/* */
92/* */
93/*************************************************************************/
94
95
96#define SC_TRUE 1
97#define SC_FALSE 0
98
99#define SC_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */
100#define SC_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */
101#define SC_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */
102#define SC_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */
103#define SC_LIST_READERS 0x00090028 /* ListReadersA */
104#define SC_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */
105#define SC_FORGET_READER_GROUP 0x00090058 /* ForgetReader */
106#define SC_INTRODUCE_READER 0x00090060 /* IntroduceReader */
107#define SC_FORGET_READER 0x00090068 /* IntroduceReader */
108#define SC_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */
109#define SC_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */
110#define SC_CONNECT 0x000900AC /* ConnectA */
111#define SC_RECONNECT 0x000900B4 /* Reconnect */
112#define SC_DISCONNECT 0x000900B8 /* Disconnect */
113#define SC_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */
114#define SC_CANCEL 0x000900A8 /* Cancel */
115#define SC_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */
116#define SC_END_TRANSACTION 0x000900C0 /* EndTransaction */
117#define SC_STATE 0x000900C4 /* State */
118#define SC_STATUS 0x000900C8 /* StatusA */
119#define SC_TRANSMIT 0x000900D0 /* Transmit */
120#define SC_CONTROL 0x000900D4 /* Control */
121#define SC_GETATTRIB 0x000900D8 /* GetAttrib */
122#define SC_SETATTRIB 0x000900DC /* SetAttrib */
123#define SC_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */
124#define SC_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */
125
126/* #define INPUT_LINKED 0x00020000 */
127#define INPUT_LINKED 0xFFFFFFFF
128
129#define SC_THREAD_FUNCTION(f) void *(*f)(void *)
130
131extern RDPDR_DEVICE g_rdpdr_device[];
132
133typedef struct _MEM_HANDLE
134{
135 struct _MEM_HANDLE *prevHandle;
136 struct _MEM_HANDLE *nextHandle;
137 int dataSize;
138} MEM_HANDLE, *PMEM_HANDLE;
139
140typedef struct _SCARD_ATRMASK_L
141{
142 unsigned int cbAtr;
143 unsigned char rgbAtr[36];
144 unsigned char rgbMask[36];
145} SCARD_ATRMASK_L, *PSCARD_ATRMASK_L, *LPSCARD_ATRMASK_L;
146
147typedef struct _TSCNameMapRec
148{
149 char alias[128];
150 char name[128];
151 char vendor[128];
152} TSCNameMapRec, *PSCNameMapRec;
153
154typedef struct _TSCHCardRec
155{
156 DWORD hCard;
157 char *vendor;
158 struct _TSCHCardRec *next;
159 struct _TSCHCardRec *prev;
160} TSCHCardRec, *PSCHCardRec;
161
162typedef struct _TSCThreadData
163{
164 uint32 device;
165 uint32 id;
166 uint32 epoch;
167 RD_NTHANDLE handle;
168 uint32 request;
169 STREAM in;
170 STREAM out;
171 PMEM_HANDLE memHandle;
172 struct _TSCThreadData *next;
173} TSCThreadData, *PSCThreadData;
174
175typedef struct _TThreadListElement
176{
177 pthread_t thread;
178 pthread_mutex_t busy;
179 pthread_cond_t nodata;
180 PSCThreadData data;
181 struct _TThreadListElement *next;
182} TThreadListElement, *PThreadListElement;
Note: See TracBrowser for help on using the repository browser.

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