Here is another higher level API for the Resource Manager above what I showed
the other day.  It is turning out OK and works with multiple readers on the
same machine.  I will release the full source code in the next week once I test
it out.

Thanks
Dave

#ifndef ResourceManager_h
#define ResourceManager_h

#ifdef __cplusplus
extern "C" {
#endif

/*
 * NAME:
 *      ResourceManager.h - Copyright (C) 1998 David Corcoran
 *             [EMAIL PROTECTED]
 *
 * DESCRIPTION:
 *      This handles requests and library loading - basically the
 *      core of the resource manager
 *
 * AUTHOR:
 *      David Corcoran, 9/22/98
 *
 * LICENSE: See file LICENSE.
 *
 */

#include "defines.h"

/* Dynamically loads the specified CT-API library */


  int Request_IFD_Handler( 
                          int *handle,
                          int iTerm, 
                          char *id 
                         );

  int Unlock_IFD_Handler(
                         int handle
                        );

  int Close_IFD_Handler(
                        int handle
                       );

  int Get_IFD_Status(
                     void
                    );


/* Resets the CT */

  int IFD_ResetCT ( 
                    int iTerminal,                   // Terminal Number.
                    unsigned char cUnit,             // Slot Number.
                    unsigned int *lr,                // Length Atr.
                    unsigned char *Atr               // Atr.
                  );

/* Powers the ICC and returns the Atr */

  int IFD_RequestICC ( 
                       int iTerminal,                // Terminal Number.
                       unsigned char cUnit,          // Slot Number.
                       unsigned int *lr,             // Length Atr.
                       unsigned char *Atr            // Returned Atr.
                     ); 

/* Gets CT status such as Card in/out */

  int IFD_GetStatus ( 
                      int iTerminal,                 // Terminal Number.
                      int *iStatus                   // Status.
                    );

/* Powers off the ICC and ejects if available */

  int IFD_EjectICC ( 
                     int iTerminal                   // Terminal Number.
                   );

/* The heart of the CT-API */

  int IFD_Data ( 
                 unsigned int ctn,                   // Terminal Number.
                 unsigned char *dad,                 // Destination.
                 unsigned char *sad,                 // Source.
                 unsigned int lc,                    // Length of Command.
                 unsigned char *cmd,                 // Command.
                 unsigned int *lr,                   // Length of Response.
                 unsigned char *rsp                  // Response.
               );                


/************ Some defines *****************************/


#ifndef MAX_RDRID_SIZE
 #define MAX_RDRID_SIZE     (int)20       // Max reader id size.
#endif

#ifndef MAX_RDRID_SIZE
 #define MAX_RDRNAME_SIZE   (int)50       // Max reader name size.
#endif

#ifndef MAX_RDRID_SIZE
 #define MAX_RDRLIB_SIZE    (int)50       // Max reader libname size.
#endif

#define IFD_OK                 0          // Everything is OK.
#define IFD_NOT_FOUND       -201          // Reader Library not Found.
#define IFD_FILE_ERROR      -202          // Config File not Found.
#define IFD_ERROR           -203          // General Error.

#define IFD_LOCK            -204          // Library Lock.
#define IFD_UNLOCK          -205          // Library Available.

#define IFD_NOT_INITIALIZED -206          // Library Lock.
#define IFD_INITIALIZED     -207          // Library Available.

#define IFD_CARD_IN         -210          // Card Inserted.
#define IFD_CARD_OUT        -211          // Card Removed.
#define IFD_CARD_NOPOWER    -213          // Card Not Powered.

#ifdef __cplusplus
}
#endif

#endif


 --
******************************************************************
David Corcoran                   Internet Security/Smartcards

Work:                            School:
205 Industrial Blvd              2252 US Highway 52 West Apt C4
Sugar Land, TX 77478             West Lafayette, IN 47906

Suggestion: Use Linux, it is for IQ's higher than 95.

Quote:
  If you can't make it work, at least make it look good.
    ~ Bill Gates
******************************************************************
***************************************************************
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***************************************************************

Reply via email to