annotate simtool/alpha_valid.c @ 112:87d459d9797a

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