VirtualBox

source: vbox/trunk/src/VBox/RDP/client/scard.h@ 10809

Last change on this file since 10809 was 9902, checked in by vboxsync, 17 years ago

Added rdesktop 1.6.0.

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