FreeCalypso > hg > fc-pcsc-tools
annotate simtool/usersum.c @ 179:efe944a5c4e3
doc/Brute-force-search: update for data directory rename
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 02 Mar 2021 05:20:19 +0000 |
parents | b89bc690dec4 |
children |
rev | line source |
---|---|
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
2 * This module implements the user-sum (summary info) command. |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
8 #include <string.h> |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
9 #include <strings.h> |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "simresp.h" |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "curfile.h" |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "file_id.h" |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
14 #define SST_BYTES_USED 15 |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
15 |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 static |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
17 read_sst(sstbuf) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
18 u_char *sstbuf; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
19 { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
20 int rc; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
21 unsigned rdlen; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
22 |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
23 rc = select_op(DF_GSM); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
24 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
25 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
26 rc = select_op(EF_SST); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
27 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
28 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
29 rc = parse_ef_select_response(); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
30 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
31 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
32 if (curfile_structure != 0x00) { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
33 fprintf(stderr, "error: EF_SST is not transparent\n"); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
34 return(-1); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
35 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
36 if (curfile_total_size < 2) { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
37 fprintf(stderr, |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
38 "error: EF_SST is shorter than spec minimum of 2 bytes\n"); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
39 return(-1); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
40 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
41 rdlen = curfile_total_size; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
42 if (rdlen > SST_BYTES_USED) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
43 rdlen = SST_BYTES_USED; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
44 rc = readbin_op(0, rdlen); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
45 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
46 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
47 bcopy(sim_resp_data, sstbuf, rdlen); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
48 if (rdlen < SST_BYTES_USED) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
49 bzero(sstbuf + rdlen, SST_BYTES_USED - rdlen); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
50 return(0); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
51 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
52 |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
53 static |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
54 do_phonebook_file(file_id, ef_name, book_name, outf) |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 unsigned file_id; |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
56 char *ef_name, *book_name; |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
57 FILE *outf; |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 { |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 int rc; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 rc = select_op(file_id); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
62 if (rc < 0) |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 return(rc); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 rc = parse_ef_select_response(); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
65 if (rc < 0) |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 return(rc); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
67 if (curfile_structure != 0x01 && curfile_structure != 0x03) { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
68 fprintf(stderr, "error: %s is not record-structured\n", |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
69 ef_name); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 return(-1); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 } |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 if (curfile_record_len < 14) { |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 fprintf(stderr, |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
74 "error: %s has record length of %u bytes, less than minimum 14\n", |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
75 ef_name, curfile_record_len); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 return(-1); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
78 fprintf(outf, "%s: %u entries, %u bytes of alpha tag\n", book_name, |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 curfile_record_count, curfile_record_len - 14); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 return(0); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 static |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
84 do_sms_store(outf) |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
85 FILE *outf; |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 { |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 int rc; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 rc = select_op(EF_SMS); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
90 if (rc < 0) |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 return(rc); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 rc = parse_ef_select_response(); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
93 if (rc < 0) |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 return(rc); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 if (curfile_structure != 0x01 || curfile_record_len != 176) { |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 fprintf(stderr, |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 "error: EF_SMS is not linear fixed with 176-byte records\n"); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 return(-1); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 } |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
100 fprintf(outf, "SMS store: %u entries\n", curfile_record_count); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 return(0); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 } |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
104 static |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
105 do_smsp_store(outf) |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
106 FILE *outf; |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 { |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 int rc; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
110 rc = select_op(EF_SMSP); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
111 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
112 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
113 rc = parse_ef_select_response(); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
114 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
115 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
116 if (curfile_structure != 0x01) { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
117 fprintf(stderr, "error: EF_SMSP is not linear fixed\n"); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
118 return(-1); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
119 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
120 if (curfile_record_len < 28) { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
121 fprintf(stderr, |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
122 "error: EF_SMSP has record length of %u bytes, less than minimum 14\n", |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
123 curfile_record_len); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
124 return(-1); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
125 } |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
126 fprintf(outf, |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
127 "SMS parameter store: %u entries, %u bytes of alpha tag\n", |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
128 curfile_record_count, curfile_record_len - 28); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
129 return(0); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
130 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
131 |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
132 cmd_user_sum(argc, argv, outf) |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
133 char **argv; |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
134 FILE *outf; |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
135 { |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
136 int rc; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
137 u_char sst[SST_BYTES_USED]; |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
138 |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
139 rc = read_sst(sst); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
140 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
141 return(rc); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 rc = select_op(DF_TELECOM); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 if (rc < 0) |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 return(rc); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
145 if ((sst[0] & 0x0C) == 0x0C) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
146 rc = do_phonebook_file(EF_ADN, "EF_ADN", "ADN phonebook", outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
147 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
148 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
149 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
150 if ((sst[0] & 0x30) == 0x30) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
151 rc = do_phonebook_file(EF_FDN, "EF_FDN", "FDN phonebook", outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
152 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
153 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
154 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
155 if ((sst[0] & 0xC0) == 0xC0) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
156 rc = do_sms_store(outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
157 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
158 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
159 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
160 if ((sst[1] & 0x03) == 0x03) |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
161 fprintf(outf, "AoC service present\n"); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
162 if ((sst[2] & 0x03) == 0x03) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
163 rc = do_phonebook_file(EF_MSISDN, "EF_MSISDN", "MSISDN record", |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
164 outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
165 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
166 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
167 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
168 if ((sst[2] & 0xC0) == 0xC0) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
169 rc = do_smsp_store(outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
170 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
171 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
172 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
173 if ((sst[3] & 0x03) == 0x03) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
174 rc = do_phonebook_file(EF_LND, "EF_LND", "LND cyclic store", |
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
175 outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
176 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
177 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
178 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
179 if ((sst[4] & 0x0C) == 0x0C) { |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
180 rc = do_phonebook_file(EF_SDN, "EF_SDN", "SDN phonebook", outf); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
181 if (rc < 0) |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
182 return(rc); |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
183 } |
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
184 if ((sst[13] & 0x03) == 0x03) |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
185 fprintf(outf, "MBDN present\n"); |
61
633033af6fb8
fc-simtool user-sum command implemented,
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
186 if ((sst[13] & 0x0C) == 0x0C) |
117
b89bc690dec4
fc-simtool user-sum: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
187 fprintf(outf, "MWIS present\n"); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 return(0); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 } |