Fun 0.41.5
The programming language that makes you have fun!
Loading...
Searching...
No Matches
pcsc.c File Reference

PC/SC smartcard helper registries and lookup utilities. More...

#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>
#include <string.h>
Include dependency graph for pcsc.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcsc_ctx_entry
struct  pcsc_card_entry

Functions

static int pcsc_alloc_ctx_slot (void)
 Allocate a free context slot in the PC/SC registry.
static int pcsc_alloc_card_slot (void)
 Allocate a free card slot in the PC/SC registry.
static pcsc_ctx_entrypcsc_get_ctx (int id)
 Lookup a context slot by id.
static pcsc_card_entrypcsc_get_card (int id)
 Lookup a card slot by id.

Variables

static pcsc_ctx_entry g_pcsc_ctx [8]
static pcsc_card_entry g_pcsc_card [32]

Detailed Description

PC/SC smartcard helper registries and lookup utilities.

Provides small fixed-size registries for PC/SC contexts and card handles, plus allocation and lookup helpers used by VM opcodes when FUN_WITH_PCSC is enabled.

Definition in file pcsc.c.

Function Documentation

◆ pcsc_alloc_card_slot()

int pcsc_alloc_card_slot ( void )
static

Allocate a free card slot in the PC/SC registry.

Returns
A 1-based slot id on success, or 0 if no free slot is available.

Definition at line 70 of file pcsc.c.

◆ pcsc_alloc_ctx_slot()

int pcsc_alloc_ctx_slot ( void )
static

Allocate a free context slot in the PC/SC registry.

Returns
A 1-based slot id on success, or 0 if no free slot is available.

Definition at line 54 of file pcsc.c.

◆ pcsc_get_card()

pcsc_card_entry * pcsc_get_card ( int id)
static

Lookup a card slot by id.

Parameters
id1-based card id previously returned by pcsc_alloc_card_slot().
Returns
Pointer to the registry entry if valid and in use; NULL otherwise.

Definition at line 102 of file pcsc.c.

◆ pcsc_get_ctx()

pcsc_ctx_entry * pcsc_get_ctx ( int id)
static

Lookup a context slot by id.

Parameters
id1-based context id previously returned by pcsc_alloc_ctx_slot().
Returns
Pointer to the registry entry if valid and in use; NULL otherwise.

Definition at line 88 of file pcsc.c.

Variable Documentation

◆ g_pcsc_card

pcsc_card_entry g_pcsc_card[32]
static

Definition at line 47 of file pcsc.c.

◆ g_pcsc_ctx

pcsc_ctx_entry g_pcsc_ctx[8]
static

Definition at line 46 of file pcsc.c.