comparison libcoding/alpha_addr.c @ 15:5854e48d0ef7

sms-gen-tpdu: add support for alphanumeric user-addr
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Aug 2023 06:43:23 +0000
parents
children c8cb05b69118
comparison
equal deleted inserted replaced
14:b014abaf0898 15:5854e48d0ef7
1 /*
2 * This library module implements encoding of alphanumeric From addresses
3 * that are allowed in SMS-DELIVER TPDUs.
4 */
5
6 #include <sys/types.h>
7
8 u_char alpha_septets_to_digits[12] = {0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20};
9
10 encode_alpha_addr(arg, bin)
11 char *arg;
12 u_char *bin;
13 {
14 u_char gsm7[11];
15 int rc;
16
17 rc = qstring_arg_to_gsm7(arg, gsm7, 11);
18 if (rc < 0)
19 return(rc);
20 bin[0] = alpha_septets_to_digits[rc];
21 bin[1] = 0x50;
22 gsm7_pack(gsm7, bin + 2, (bin[0] + 1) >> 1);
23 return(0);
24 }