On Mon, Sep 21, 1998 at 10:16:49AM -0500, David Corcoran wrote:
> Ok, I need some opinions here. Basically I have run into a small problem with
> the resource manager. Ok, BIG problem. When I load multiple ctapi libraries
> into memory ( such as two Reflex 60's on different ports ), it only references
> the first. I know of no way around this. Alternatively, we could thread each
> and every process but that involves some nasty interprocess communication.
> Here are the possibilities and their drawbacks:
>
> Threaded process: Gives support to multiple readers on the same machine either
> same manufacturer or not. BAD - Makes control alot harder and opens up area for
> major security holes.
>
> Each CT-API IO function call returns unique handle: This would allow you to
> have multiple readers of the same type on your machine. BAD - Other
> manufacturers wouldn't work.
CTAPI function does not return error code ?
>
> Let me know what you think. The third one is very easy to implement. The
> first the hardest.
>
> Thanks
> Dave
>
What do you think about something like this:
NOTE: you can open the same library more than once; they
(dlopen/dlclose) maintain a reference count .
#define MAX_CARD_TERMINAL 32
struct ct_handle {
void *libp;
int (*CT_init) (unsigned int ctn, int pn);
int (*CT_data) (...) /* The right prototype for CT_data */
int (*CT_close) (unsigned int ctn);
};
struct ct_handle cts[MAX_CARD_TERMINAL];
int CTB_LoadCTLibrary (unsigned int ctn, const char *cfg, const char *rdr)
{
...
cts[ctn].libp = dlopen ("The right library");
cts[ctn].CT_init = dlsym (cts[ctn].libp, "CT_init");
...
}
int CT_CloseCTLibrary (unsigned int ctn)
{
...
dlclose (cts[ctn].libp);
...
}
int CTB_Data (unsigned int ctn, ...)
{
...
cts[ctn].CT_data (...);
...
}
--
Ciao Walter
***************************************************************
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
***************************************************************