annotate libcoding/alpha_addr.c @ 31:19476164c54d

doc/SMS-PDU-decoding: document imported utilities
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 Jun 2024 18:48:58 +0000
parents c8cb05b69118
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
26
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2 * This library module contains some bits that help working with
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
3 * alphabetic addresses.
15
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 u_char alpha_septets_to_digits[12] = {0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20};
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
26
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
10 alpha_addr_valid(ndigits, sepp)
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
11 unsigned ndigits, *sepp;
15
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
26
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
13 unsigned n;
15
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
26
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
15 for (n = 1; n <= 11; n++)
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
16 if (alpha_septets_to_digits[n] == ndigits) {
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
17 *sepp = n;
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
18 return(1);
c8cb05b69118 libcoding alpha addr: support both encoding and decoding
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
19 }
15
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return(0);
5854e48d0ef7 sms-gen-tpdu: add support for alphanumeric user-addr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }