annotate uicc/cmdtab.c @ 45:9eb5460f51a6

main tools: support both pcsc and serial back ends
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Mar 2021 01:56:49 +0000
parents b70d35f5476f
children bccf028921bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the command table for fc-uicc-tool.
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include "cmdtab.h"
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 extern int cmd_apdu();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 extern int cmd_atr();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 extern int cmd_bfsearch_adf();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 extern int cmd_bfsearch_mf();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 extern int cmd_cd();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 extern int cmd_change_pin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 extern int cmd_create_file();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern int cmd_delete_file();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern int cmd_dir();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 extern int cmd_disable_pin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 extern int cmd_enable_pin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 extern int cmd_exec();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 extern int cmd_exit();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 extern int cmd_get_response();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 extern int cmd_iccid();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 extern int cmd_pin_attempt_cnt();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 extern int cmd_puk_attempt_cnt();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 extern int cmd_readbin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 extern int cmd_readef();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 extern int cmd_readrec();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 extern int cmd_select();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 extern int cmd_select_aid();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 extern int cmd_select_isim();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 extern int cmd_select_usim();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 extern int cmd_sim_resp();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 extern int cmd_unblock_pin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 extern int cmd_update_bin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 extern int cmd_update_bin_imm();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 extern int cmd_update_rec();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 extern int cmd_verify_hex();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 extern int cmd_verify_pin();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 struct cmdtab cmdtab[] = {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 {"apdu", 1, 1, 0, cmd_apdu},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 {"atr", 0, 0, 0, cmd_atr},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 {"bfsearch-adf", 0, 0, 1, cmd_bfsearch_adf},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 {"bfsearch-mf", 0, 0, 1, cmd_bfsearch_mf},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 {"cd", 1, 1, 0, cmd_cd},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 {"change-pin", 3, 3, 0, cmd_change_pin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 {"create-file", 1, 1, 0, cmd_create_file},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 {"delete-file", 1, 1, 0, cmd_delete_file},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 {"dir", 0, 0, 1, cmd_dir},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 {"disable-pin", 2, 2, 0, cmd_disable_pin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 {"enable-pin", 2, 2, 0, cmd_enable_pin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 {"exec", 1, 1, 0, cmd_exec},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 {"exit", 0, 1, 0, cmd_exit},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 {"get-response", 1, 1, 1, cmd_get_response},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 {"iccid", 0, 0, 1, cmd_iccid},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 {"pin-attempt-cnt", 1, 1, 0, cmd_pin_attempt_cnt},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 {"puk-attempt-cnt", 1, 1, 0, cmd_puk_attempt_cnt},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 {"quit", 0, 1, 0, cmd_exit},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 {"readbin", 2, 2, 1, cmd_readbin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 {"readef", 1, 1, 1, cmd_readef},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 {"readrec", 1, 2, 1, cmd_readrec},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {"select", 1, 1, 1, cmd_select},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 {"select-aid", 1, 1, 1, cmd_select_aid},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 {"select-isim", 0, 0, 1, cmd_select_isim},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 {"select-usim", 0, 0, 1, cmd_select_usim},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 {"sim-resp", 0, 0, 1, cmd_sim_resp},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 {"unblock-pin", 3, 3, 0, cmd_unblock_pin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 {"update-bin", 2, 2, 0, cmd_update_bin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 {"update-bin-imm", 2, 2, 0, cmd_update_bin_imm},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 {"update-rec", 2, 2, 0, cmd_update_rec},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 {"verify-ext", 2, 2, 0, cmd_verify_pin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 {"verify-hex", 2, 2, 0, cmd_verify_hex},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 {"verify-pin", 2, 2, 0, cmd_verify_pin},
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 {0, 0, 0, 0, 0}
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 };