![]() |
Fun 0.41.5
The programming language that makes you have fun!
|
Implements the OP_PCSC_TRANSMIT opcode (conditional build). More...
Go to the source code of this file.
Functions | |
| free_value (vh) | |
| map_set & | m (NULL, 0) |
| map_set & | m (-1) |
| if (!ce||vapdu.type !=VAL_ARRAY) | |
| if (n< 0) n=0 | |
| if (i< n,(int) sizeof(sbuf)) | |
| free_value (vapdu) | |
| if (ce->proto==SCARD_PROTOCOL_T0) pio = *SCARD_PCI_T1 | |
| if (rv==SCARD_S_SUCCESS &&rlen >=2) | |
| map_set & | m (sw1) |
| map_set & | m (sw2) |
| map_set & | m ((int) rv) |
| if (datalen > 0) | |
| push_value (vm, m) | |
Variables | |
| case | OP_PCSC_TRANSMIT |
| Value | vh = pop_value(vm) |
| int | hid = (int)vh.i |
| pcsc_card_entry * | ce = pcsc_get_card(hid) |
| Value | m = make_map_empty() |
| int | n = array_length(&vapdu) |
| unsigned char | sbuf [4096] |
| SCARD_IO_REQUEST | pio |
| else | |
| unsigned char | rbuf [4096] |
| DWORD | rlen = sizeof(rbuf) |
| LONG | rv = SCardTransmit(ce->h, &pio, sbuf, (DWORD)n, NULL, rbuf, &rlen) |
| int | sw1 = -1 |
| int | sw2 = -1 |
| int | datalen = 0 |
| break | |
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.
OP_PCSC_TRANSMIT: (handle_id:int, apdu:array<int>) -> map
Definition in file transmit.c.
| free_value | ( | vapdu | ) |
| free_value | ( | vh | ) |
Definition at line 46 of file transmit.c.
| if | ( | datalen | , |
| 0 | ) |
Definition at line 92 of file transmit.c.
| if | ( | i < | n, |
| (int) sizeof(sbuf) | ) |
Definition at line 54 of file transmit.c.
Definition at line 82 of file transmit.c.
| map_set & m | ( | (int) | rv | ) |
| map_set & m | ( | - | 1 | ) |
| map_set & m | ( | NULL | , |
| 0 | ) |
| push_value | ( | vm | , |
| m | ) |
| break |
Definition at line 120 of file transmit.c.
| pcsc_card_entry* ce = pcsc_get_card(hid) |
Definition at line 38 of file transmit.c.
| int datalen = 0 |
Definition at line 81 of file transmit.c.
| else |
Definition at line 72 of file transmit.c.
| int hid = (int)vh.i |
Definition at line 36 of file transmit.c.
| Value m = make_map_empty() |
Definition at line 40 of file transmit.c.
| int n = array_length(&vapdu) |
Definition at line 51 of file transmit.c.
| case OP_PCSC_TRANSMIT |
Definition at line 31 of file transmit.c.
| SCARD_IO_REQUEST pio |
Definition at line 67 of file transmit.c.
| unsigned char rbuf[4096] |
Definition at line 76 of file transmit.c.
| DWORD rlen = sizeof(rbuf) |
Definition at line 77 of file transmit.c.
Definition at line 78 of file transmit.c.
| unsigned char sbuf[4096] |
Definition at line 53 of file transmit.c.
| int sw1 = -1 |
Definition at line 80 of file transmit.c.
| int sw2 = -1 |
Definition at line 80 of file transmit.c.
Definition at line 35 of file transmit.c.