FreeCalypso > hg > freecalypso-tools
annotate uptools/libcoding/scaddr.c @ 661:fd7b447b99e3
libserial rename
The version that was previously named libserial-newlnx is now libserial-linux,
and the version that was previosly named libserial-orig is now libserial-posix.
This new naming is more in line with the objective reality of the difference,
moving away from naming based on our project history.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Mar 2020 19:54:31 +0000 |
parents | ea41b6001848 |
children |
rev | line source |
---|---|
332
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This library module contains the code that figures out how many digits |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * are there in a PDU-encoded Service Centre address. |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 sc_addr_ndigits(sca) |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 u_char *sca; |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 { |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 unsigned nb, nd; |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 nb = sca[0]; |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 nd = (nb - 1) * 2; |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 if ((sca[nb] & 0xF0) == 0xF0) |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 nd--; |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 return nd; |
ea41b6001848
uptools/libcoding: SC address decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 } |