FreeCalypso > hg > sms-coding-utils
annotate libcoding/scaddr.c @ 28:6e925aa54727
libcoding: more sensible naming of GSM time
encoding and decoding modules
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Jun 2024 02:32:11 +0000 |
parents | 7418ca2e9949 |
children |
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 contains the code that figures out how many digits |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * are there in a PDU-encoded Service Centre address. |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 sc_addr_ndigits(sca) |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 u_char *sca; |
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 unsigned nb, nd; |
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 nb = sca[0]; |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 nd = (nb - 1) * 2; |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 if ((sca[nb] & 0xF0) == 0xF0) |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 nd--; |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 return nd; |
7418ca2e9949
libcoding: add functions from freecalypso-tools/uptools/libcoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 } |