annotate libcoding/grokdcs.c @ 33:a91fb88a57b2 default tip

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