1/*
2    pps.h
3    Protocol Parameters Selection
4
5    This file is part of the Unix driver for Towitoko smartcard readers
6    Copyright (C) 2000 2001 Carlos Prados <cprados@yahoo.com>
7
8    This library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public
10    License as published by the Free Software Foundation; either
11    version 2 of the License, or (at your option) any later version.
12
13    This library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Lesser General Public License for more details.
17
18	You should have received a copy of the GNU Lesser General Public License
19	along with this library; if not, write to the Free Software Foundation,
20	Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#ifndef _PPS_
24#define _PPS_
25
26#include "defines.h"
27
28/*
29 * Exported constants definition
30 */
31
32#define PPS_OK			0	/* Negotiation OK */
33#define PPS_ICC_ERROR		1	/* Comunication error */
34#define PPS_HANDSAKE_ERROR	2	/* Agreement not reached */
35#define PPS_PROTOCOL_ERROR	3	/* Error starting protocol */
36#define PPS_MAX_LENGTH		6
37
38#define PPS_HAS_PPS1(block)	((block[1] & 0x10) == 0x10)
39#define PPS_HAS_PPS2(block)	((block[1] & 0x20) == 0x20)
40#define PPS_HAS_PPS3(block)	((block[1] & 0x40) == 0x40)
41
42/*
43 * Exported data types definition
44 */
45
46typedef struct
47{
48  double f;
49  double d;
50  double n;
51  BYTE t;
52}
53PPS_ProtocolParameters;
54
55typedef struct
56{
57  int icc;
58  void *protocol;
59  PPS_ProtocolParameters parameters;
60}
61PPS;
62
63/*
64 * Exported functions declaration
65 */
66
67int PPS_Exchange (int lun, BYTE * params, /*@out@*/ unsigned *length,
68	unsigned char *pps1);
69
70#endif /* _PPS_ */
71
72