FreeCalypso > hg > freecalypso-hwlab
annotate uicc/alpha_valid.c @ 169:17ffa6c66951
ee2232/README: update deprecation notice,
point at the current version in fc-usbser-tools
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 11 Sep 2023 04:17:09 +0000 |
parents | a21d348e01db |
children |
rev | line source |
---|---|
136
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains functions for validating alpha fields |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * that exist in various SIM files. |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 static |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 validate_classic_gsm(data, nbytes, textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 u_char *data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 unsigned nbytes, *textlenp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 u_char *dp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 unsigned n; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 dp = data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 for (n = 0; n < nbytes; n++) { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (*dp == 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 break; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 if (*dp & 0x80) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 dp++; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 if (textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 *textlenp = n; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 for (; n < nbytes; n++) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 if (*dp++ != 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 return(0); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 static |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 validate_ucs2_80(data, nbytes, textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 u_char *data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 unsigned nbytes, *textlenp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 u_char *dp, *endp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 if (nbytes < 3) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 dp = data + 1; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 endp = data + nbytes; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 while (dp < endp) { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 if (dp + 1 == endp) { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 if (*dp != 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 if (textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 *textlenp = dp - data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 return(0); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 if (dp[0] == 0xFF && dp[1] == 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 break; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 dp += 2; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 if (textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 *textlenp = dp - data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 while (dp < endp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 if (*dp++ != 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 return(0); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 static |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 validate_ucs2_81(data, nbytes, textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 u_char *data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 unsigned nbytes, *textlenp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 u_char *dp, *endp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 unsigned textlen; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 if (nbytes < 4) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 if (!data[1]) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 textlen = data[1] + 3; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 if (textlen > nbytes) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 if (textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 *textlenp = textlen; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 dp = data + textlen; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 endp = data + nbytes; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 while (dp < endp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 if (*dp++ != 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 return(0); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 static |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 validate_ucs2_82(data, nbytes, textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 u_char *data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 unsigned nbytes, *textlenp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 u_char *dp, *endp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 unsigned textlen; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 if (nbytes < 5) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 if (!data[1]) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 textlen = data[1] + 4; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 if (textlen > nbytes) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 if (textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 *textlenp = textlen; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 dp = data + textlen; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 endp = data + nbytes; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 while (dp < endp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 if (*dp++ != 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 return(0); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 static |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 validate_empty(data, nbytes, textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 u_char *data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 unsigned nbytes, *textlenp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 u_char *dp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 unsigned n; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 dp = data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 for (n = 0; n < nbytes; n++) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 if (*dp++ != 0xFF) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 return(-1); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 if (textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 *textlenp = 0; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 return(0); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 validate_alpha_field(data, nbytes, textlenp) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 u_char *data; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 unsigned nbytes, *textlenp; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 if (data[0] < 0x80) |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 return validate_classic_gsm(data, nbytes, textlenp); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 switch (data[0]) { |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 case 0x80: |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 return validate_ucs2_80(data, nbytes, textlenp); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 case 0x81: |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 return validate_ucs2_81(data, nbytes, textlenp); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 case 0x82: |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 return validate_ucs2_82(data, nbytes, textlenp); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 case 0xFF: |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 return validate_empty(data, nbytes, textlenp); |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 default: |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 return -1; |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 } |
a21d348e01db
fc-uicc-tool: pb-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |