1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
3 * The contents of this file constitute Original Code as defined in and are
4 * subject to the Apple Public Source License Version 1.2 (the 'License').
5 * You may not use this file except in compliance with the License. Please
6 * obtain a copy of the License at http://www.apple.com/publicsource and
7 * read it before using this file.
8 *
9 * This Original Code and all software distributed under the License are
10 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
11 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
12 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
13 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please
14 * see the License for the specific language governing rights and
15 * limitations under the License.
16 */
17
18/******************************************************************
19
20        MUSCLE SmartCard Development ( http://www.linuxnet.com )
21            Title  : atrhandler.h
22            Author : David Corcoran
23            Date   : 7/27/99
24	    License: Copyright (C) 1999 David Corcoran
25	             <corcoran@linuxnet.com>
26            Purpose: This keeps track of smartcard protocols,
27                     timing issues, and atr handling.
28
29********************************************************************/
30
31/**
32 * @file
33 * @brief This keeps track of smartcard protocols, timing issues
34 * and Answer to Reset ATR handling.
35 */
36
37#ifndef __atrhandler_h__
38#define __atrhandler_h__
39
40#ifdef __cplusplus
41extern "C"
42{
43#endif
44
45#define SCARD_CONVENTION_DIRECT  0x0001
46#define SCARD_CONVENTION_INVERSE 0x0002
47
48	typedef struct _SMARTCARD_EXTENSION
49	{
50
51		struct _ATR
52		{
53			DWORD Length;
54			DWORD HistoryLength;
55			UCHAR Value[MAX_ATR_SIZE];
56			UCHAR HistoryValue[MAX_ATR_SIZE];
57		}
58		ATR;
59
60		struct _CardCapabilities
61		{
62			UCHAR AvailableProtocols;
63			UCHAR CurrentProtocol;
64			UCHAR Convention;
65			}
66		CardCapabilities;
67	}
68	SMARTCARD_EXTENSION, *PSMARTCARD_EXTENSION;
69
70	/*
71	 * Decodes the ATR and fills the structure
72	 */
73
74	short ATRDecodeAtr(PSMARTCARD_EXTENSION psExtension,
75		const unsigned char *pucAtr, DWORD dwLength);
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif							/* __atrhandler_h__ */
82