Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
transmit.c File Reference

Implements the OP_PCSC_TRANSMIT opcode (conditional build). More...

Go to the source code of this file.

Functions

 free_value (vapdu)
 free_value (vh)
map_setm (NULL, 0)
map_setm (-1)
 push_value (vm, m)

Variables

case OP_PCSC_TRANSMIT
Value vh = pop_value(vm)
Value m = make_map_empty()
 break

Detailed Description

Implements the OP_PCSC_TRANSMIT opcode (conditional build).

Transmits an APDU to the connected smart card associated with a given handle. Returns a map with the response bytes and status words. When PCSC support is disabled at build time, consumes its arguments and returns a map with code = -2.

Definition in file transmit.c.

Function Documentation

◆ free_value() [1/2]

free_value(vapdu)

◆ free_value() [2/2]

free_value(vh)

◆ m() [1/2]

map_set & m(-1)

◆ m() [2/2]

map_set & m(NULL,
0 )

◆ push_value()

push_value(vm,
m )

Variable Documentation

◆ break

break

Definition at line 122 of file transmit.c.

◆ m

Definition at line 115 of file transmit.c.

◆ OP_PCSC_TRANSMIT

case OP_PCSC_TRANSMIT

OP_PCSC_TRANSMIT: (handle_id:int, apdu:array<int>) -> map

  • Pops: apdu array, then handle_id.
  • Pushes: map { data: array<int>, sw1:int, sw2:int, code:int }.
    • On success (code == SCARD_S_SUCCESS), data contains response bytes (no status words) and sw1/sw2 are the trailing status bytes.
    • On error, data is [], sw1/sw2 remain -1, and code is the PCSC error.
  • Notes: Negotiates protocol from the connected handle (T0/T1) and uses SCardTransmit. APDU bytes are taken modulo 256 from array ints.

Definition at line 33 of file transmit.c.

◆ vh

Value vh = pop_value(vm)

Definition at line 113 of file transmit.c.