annotate simtool/names.c @ 137:c331560c15a4

fc-uicc-tool: dir command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 04 Feb 2021 04:27:09 +0000
parents ddff76088d12
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
87
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the table of user-friendly file names
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * and a function for searching this table.
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <string.h>
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <strings.h>
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdlib.h>
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "file_id.h"
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 static struct nametab {
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 char *name;
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 int file_id;
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 } name_table[] = {
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {"MF", FILEID_MF},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {"DF_GSM", DF_GSM},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {"DF_DCS1800", DF_DCS1800},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {"DF_TELECOM", DF_TELECOM},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {"gsm", DF_GSM},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 {"telecom", DF_TELECOM},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 /* EFs under MF */
125
ddff76088d12 fc-simtool: add EF_DIR symbolic name
Mychaela Falconia <falcon@freecalypso.org>
parents: 113
diff changeset
23 {"EF_DIR", EF_DIR},
87
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 {"EF_ICCID", EF_ICCID},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 /* EFs under DF_GSM */
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {"EF_LP", EF_LP},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 {"EF_IMSI", EF_IMSI},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 {"EF_Kc", EF_Kc},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {"EF_PLMNsel", EF_PLMNsel},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 {"EF_HPLMN", EF_HPLMN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {"EF_ACMmax", EF_ACMmax},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {"EF_SST", EF_SST},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {"EF_ACM", EF_ACM},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 {"EF_GID1", EF_GID1},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 {"EF_GID2", EF_GID2},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 {"EF_PUCT", EF_PUCT},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 {"EF_CBMI", EF_CBMI},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 {"EF_SPN", EF_SPN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 {"EF_CBMID", EF_CBMID},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 {"EF_CBMIR", EF_CBMIR},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 {"EF_BCCH", EF_BCCH},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 {"EF_ACC", EF_ACC},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 {"EF_FPLMN", EF_FPLMN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 {"EF_LOCI", EF_LOCI},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 {"EF_AD", EF_AD},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 {"EF_PHASE", EF_PHASE},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 {"EF_ECC", EF_ECC},
113
7e7eab9ea7c5 fc-simtool: add EF_PNN and EF_OPL symbolic names
Mychaela Falconia <falcon@freecalypso.org>
parents: 87
diff changeset
48 {"EF_PNN", EF_PNN},
7e7eab9ea7c5 fc-simtool: add EF_PNN and EF_OPL symbolic names
Mychaela Falconia <falcon@freecalypso.org>
parents: 87
diff changeset
49 {"EF_OPL", EF_OPL},
87
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 /* EFs under DF_TELECOM */
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 {"EF_ADN", EF_ADN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 {"EF_FDN", EF_FDN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 {"EF_SMS", EF_SMS},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 {"EF_CCP", EF_CCP},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 {"EF_MSISDN", EF_MSISDN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 {"EF_SMSP", EF_SMSP},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 {"EF_SMSS", EF_SMSS},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 {"EF_LND", EF_LND},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 {"EF_SDN", EF_SDN},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 {"EF_EXT1", EF_EXT1},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {"EF_EXT2", EF_EXT2},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 {"EF_EXT3", EF_EXT3},
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 /* table search terminator */
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 {0, -1}
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 };
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 find_symbolic_file_name(soughtname)
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 char *soughtname;
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 {
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 struct nametab *tp;
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 for (tp = name_table; tp->name; tp++)
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 if (!strcmp(tp->name, soughtname))
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 break;
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 return tp->file_id;
2a0d1d5b9313 fc-simtool: symbolic file names implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 }