annotate uicc/names.c @ 151:d515cfbb3f39

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