![]() |
Fun API Documentation 0.42.1
The programming language that makes you have fun!
|
PC/SC smartcard helper registries and lookup utilities for VM opcodes. More...
#include <PCSC/winscard.h>#include <PCSC/wintypes.h>#include <string.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | pcsc_ctx_entry |
| One slot in the PC/SC context registry. More... | |
| struct | pcsc_card_entry |
| One slot in the PC/SC card handle registry. More... | |
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_entry * | pcsc_get_ctx (int id) |
| Lookup a context slot by id. | |
| static pcsc_card_entry * | pcsc_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] |
PC/SC smartcard helper registries and lookup utilities for VM opcodes.
This module centralizes tiny fixed-size registries for PC/SC resources and minimal helper functions used by VM opcodes under src/vm/pcsc/*.c. Keeping the concrete handle management here allows the opcode implementations to focus on VM stack marshalling, mirroring the approach taken by other extensions (PCRE2, SQLite, XML2, JSON, INI, cURL, OpenSSL).
Build-time feature flag:
Registries and ownership model:
Error handling and limits:
Thread-safety:
Definition in file pcsc.c.
|
static |
Allocate a free card slot in the PC/SC registry.
Scans the card registry for an unused entry, sets initial values, and returns a small positive identifier that can be used by opcodes to index the slot later.
|
static |
Allocate a free context slot in the PC/SC registry.
Scans the small fixed-size context registry for an available slot, marks it as in use, clears the stored value, and returns a 1-based identifier.
|
static |
Lookup a card slot by id.
Validates the provided 1-based identifier, ensures the slot is currently in use, and returns a pointer to the internal registry entry, which exposes the SCARDHANDLE and negotiated protocol for subsequent operations (e.g., SCardTransmit()).
| id | int 1-based card id previously returned by pcsc_alloc_card_slot(). |
|
static |
Lookup a context slot by id.
Validates the provided 1-based identifier, ensures the slot is currently in use, and returns a pointer to the internal registry entry.
| id | int 1-based context id previously returned by pcsc_alloc_ctx_slot(). |
|
static |
|
static |