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 version is modified by doz21 to work in a special manner ;)
|
---|
9 |
|
---|
10 | This library is free software; you can redistribute it and/or
|
---|
11 | modify it under the terms of the GNU Lesser General Public
|
---|
12 | License as published by the Free Software Foundation; either
|
---|
13 | version 2 of the License, or (at your option) any later version.
|
---|
14 |
|
---|
15 | This library is distributed in the hope that it will be useful,
|
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | Lesser General Public License for more details.
|
---|
19 |
|
---|
20 | You should have received a copy of the GNU Lesser General Public
|
---|
21 | License along with this library; if not, write to the Free Software
|
---|
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _PPS_
|
---|
26 | #define _PPS_
|
---|
27 |
|
---|
28 | #include "defines.h"
|
---|
29 | #include "icc_async.h"
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * Exported constants definition
|
---|
33 | */
|
---|
34 |
|
---|
35 | #define PPS_OK 0 /* Negotiation OK */
|
---|
36 | #define PPS_ICC_ERROR 1 /* Comunication error */
|
---|
37 | #define PPS_HANDSAKE_ERROR 2 /* Agreement not reached */
|
---|
38 | #define PPS_PROTOCOL_ERROR 3 /* Error starting protocol */
|
---|
39 | #define PPS_MAX_LENGTH 6
|
---|
40 | /*
|
---|
41 | * Exported data types definition
|
---|
42 | */
|
---|
43 |
|
---|
44 | typedef struct
|
---|
45 | {
|
---|
46 | double f;
|
---|
47 | double d;
|
---|
48 | double n;
|
---|
49 | BYTE t;
|
---|
50 | }
|
---|
51 | PPS_ProtocolParameters;
|
---|
52 |
|
---|
53 | typedef struct
|
---|
54 | {
|
---|
55 | ICC_Async *icc;
|
---|
56 | void *protocol;
|
---|
57 | PPS_ProtocolParameters parameters;
|
---|
58 | }
|
---|
59 | PPS;
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Exported functions declaration
|
---|
63 | */
|
---|
64 |
|
---|
65 | /* Create PPS context */
|
---|
66 | extern PPS *PPS_New (ICC_Async * icc);
|
---|
67 |
|
---|
68 | /* Perform protcol type selection and return confirm */
|
---|
69 | extern int PPS_Perform (PPS * pps, BYTE * params, unsigned *length);
|
---|
70 |
|
---|
71 | /* Get protocol handler */
|
---|
72 | extern void *PPS_GetProtocol (PPS * pps);
|
---|
73 |
|
---|
74 | /* Get protocol parameters */
|
---|
75 | extern PPS_ProtocolParameters *PPS_GetProtocolParameters (PPS * pps);
|
---|
76 |
|
---|
77 | /* Delete PPS context */
|
---|
78 | extern void PPS_Delete (PPS * pps);
|
---|
79 |
|
---|
80 | #endif /* _PPS_ */
|
---|