VirtualBox

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

Last change on this file since 47918 was 37224, checked in by vboxsync, 14 years ago

RDP/client: fix OSE

  • 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 <alexi@myrealbox.com> 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 * - jared.jennings@eglin.af.mil, 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_A MYPCSC_SCARD_READERSTATE_A;
63typedef LPSCARD_READERSTATE_A MYPCSC_LPSCARD_READERSTATE_A;
64
65typedef struct
66{
67 const char *szReader;
68 void *pvUserData;
69 SERVER_DWORD dwCurrentState;
70 SERVER_DWORD dwEventState;
71 SERVER_DWORD cbAtr;
72 unsigned char rgbAtr[MAX_ATR_SIZE];
73}
74SERVER_SCARD_READERSTATE_A;
75
76typedef SERVER_SCARD_READERSTATE_A *SERVER_LPSCARD_READERSTATE_A;
77
78#define SERVER_SCARDSTATESIZE (sizeof(SERVER_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *))
79#define MYPCSC_SCARDSTATESIZE (sizeof(MYPCSC_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *))
80
81typedef struct _SERVER_SCARD_IO_REQUEST
82{
83 SERVER_DWORD dwProtocol; /* Protocol identifier */
84 SERVER_DWORD cbPciLength; /* Protocol Control Inf Length */
85}
86SERVER_SCARD_IO_REQUEST, *SERVER_LPSCARD_IO_REQUEST;
87
88typedef SCARD_IO_REQUEST MYPCSC_SCARD_IO_REQUEST;
89typedef LPSCARD_IO_REQUEST MYPCSC_LPSCARD_IO_REQUEST;
90
91
92/* */
93/* */
94/*************************************************************************/
95
96
97#define SC_TRUE 1
98#define SC_FALSE 0
99
100#define SC_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */
101#define SC_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */
102#define SC_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */
103#define SC_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */
104#define SC_LIST_READERS 0x00090028 /* ListReadersA */
105#define SC_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */
106#define SC_FORGET_READER_GROUP 0x00090058 /* ForgetReader */
107#define SC_INTRODUCE_READER 0x00090060 /* IntroduceReader */
108#define SC_FORGET_READER 0x00090068 /* IntroduceReader */
109#define SC_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */
110#define SC_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */
111#define SC_CONNECT 0x000900AC /* ConnectA */
112#define SC_RECONNECT 0x000900B4 /* Reconnect */
113#define SC_DISCONNECT 0x000900B8 /* Disconnect */
114#define SC_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */
115#define SC_CANCEL 0x000900A8 /* Cancel */
116#define SC_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */
117#define SC_END_TRANSACTION 0x000900C0 /* EndTransaction */
118#define SC_STATE 0x000900C4 /* State */
119#define SC_STATUS 0x000900C8 /* StatusA */
120#define SC_TRANSMIT 0x000900D0 /* Transmit */
121#define SC_CONTROL 0x000900D4 /* Control */
122#define SC_GETATTRIB 0x000900D8 /* GetAttrib */
123#define SC_SETATTRIB 0x000900DC /* SetAttrib */
124#define SC_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */
125#define SC_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */
126
127/* #define INPUT_LINKED 0x00020000 */
128#define INPUT_LINKED 0xFFFFFFFF
129
130#define SC_THREAD_FUNCTION(f) void *(*f)(void *)
131
132extern RDPDR_DEVICE g_rdpdr_device[];
133
134typedef struct _MEM_HANDLE
135{
136 struct _MEM_HANDLE *prevHandle;
137 struct _MEM_HANDLE *nextHandle;
138 int dataSize;
139} MEM_HANDLE, *PMEM_HANDLE;
140
141typedef struct _SCARD_ATRMASK_L
142{
143 unsigned int cbAtr;
144 unsigned char rgbAtr[36];
145 unsigned char rgbMask[36];
146} SCARD_ATRMASK_L, *PSCARD_ATRMASK_L, *LPSCARD_ATRMASK_L;
147
148typedef struct _TSCNameMapRec
149{
150 char alias[128];
151 char name[128];
152 char vendor[128];
153} TSCNameMapRec, *PSCNameMapRec;
154
155typedef struct _TSCHCardRec
156{
157 DWORD hCard;
158 char *vendor;
159 struct _TSCHCardRec *next;
160 struct _TSCHCardRec *prev;
161} TSCHCardRec, *PSCHCardRec;
162
163typedef struct _TSCThreadData
164{
165 uint32 device;
166 uint32 id;
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