/[pcsclite]/trunk/Drivers/ccid/src/utils.c
ViewVC logotype

Contents of /trunk/Drivers/ccid/src/utils.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1771 - (show annotations) (download)
Tue Nov 29 12:21:00 2005 UTC (7 years, 6 months ago) by rousseau
File MIME type: text/plain
File size: 1696 byte(s)
remove PCSC/ from the pcsc-lite #include header files since the PCSC/
part is already given by `pkg-config --cflags libpcsclite`
1 /*
2 utils.c:
3 Copyright (C) 2003-2004 Ludovic Rousseau
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 /*
21 * $Id$
22 */
23
24 #include <pcsclite.h>
25
26 #include "ccid.h"
27 #include "defs.h"
28 #include "ccid_ifdhandler.h"
29 #include "utils.h"
30 #include "debug.h"
31
32 int ReaderIndex[CCID_DRIVER_MAX_READERS];
33
34 void InitReaderIndex(void)
35 {
36 int i;
37
38 for (i=0; i<CCID_DRIVER_MAX_READERS; i++)
39 ReaderIndex[i] = -1;
40 } /* InitReaderIndex */
41
42 int GetNewReaderIndex(const DWORD Lun)
43 {
44 int i;
45
46 for (i=0; i<CCID_DRIVER_MAX_READERS; i++)
47 if (-1 == ReaderIndex[i])
48 {
49 ReaderIndex[i] = Lun;
50 return i;
51 }
52
53 DEBUG_CRITICAL("ReaderIndex[] is full");
54 return -1;
55 } /* GetReaderIndex */
56
57 int LunToReaderIndex(const DWORD Lun)
58 {
59 int i;
60
61 for (i=0; i<CCID_DRIVER_MAX_READERS; i++)
62 if (Lun == ReaderIndex[i])
63 return i;
64
65 DEBUG_CRITICAL2("Lun: %X not found", Lun);
66 return -1;
67 } /* LunToReaderIndex */
68
69 int ReleaseReaderIndex(const int index)
70 {
71 ReaderIndex[index] = -1;
72
73 return 0;
74 } /* ReleaseReaderIndex */
75

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5