annotate uptools/libcoding/grokdcs.c @ 342:c6165837d141

uptools/Makefile: atinterf added
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 04 Feb 2018 07:57:06 +0000
parents 097ce8431d11
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
335
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This library module implements the function that distills the complex
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * set of possible SMS DCS octet values to just one of 4 possibilities:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * 7-bit text (7), 8-bit data octets (8), UCS-2 text (16) or compressed
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * data (9).
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 *
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * The decoding is based on the 3GPP TS 23.038 V11.0.0 spec;
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 * reserved encodings are treated as 7-bit text as the spec instructs.
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 */
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 sms_dcs_classify(dcs)
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 if (!(dcs & 0x80)) {
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 if (dcs & 0x20)
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 return(9);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 switch (dcs & 0xC) {
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 case 0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 return(7);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 case 4:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return(8);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 case 8:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 return(16);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 default:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /* reserved, treating as 7-bit per the spec */
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 return(7);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 switch (dcs & 0xF0) {
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 case 0x80:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 case 0x90:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 case 0xA0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 case 0xB0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 /* reserved, treating as 7-bit per the spec */
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 return(7);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 case 0xC0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 case 0xD0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 return(7);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 case 0xE0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 return(16);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 case 0xF0:
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 if (dcs & 4)
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 return(8);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 else
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 return(7);
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }
097ce8431d11 uptools/libcoding: SMS DCS decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }