comparison libcoding/alpha_addr_enc.c @ 26:c8cb05b69118

libcoding alpha addr: support both encoding and decoding
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Jun 2024 01:55:19 +0000
parents libcoding/alpha_addr.c@5854e48d0ef7
children
comparison
equal deleted inserted replaced
25:2a19b44c272e 26:c8cb05b69118
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 extern u_char alpha_septets_to_digits[12];
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 }