comparison uptools/sms-pdu-decode/pdu-common.c @ 800:8dc93aac9a9c

pcm-sms-decode & sms-pdu-decode: use new function for alphanumeric From/To addresses
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 25 Mar 2021 01:29:05 +0000
parents 18bfc10ba20e
children 1c599681fd60
comparison
equal deleted inserted replaced
799:f023a1c187a9 800:8dc93aac9a9c
66 handle_user_addr(direction) 66 handle_user_addr(direction)
67 char *direction; 67 char *direction;
68 { 68 {
69 unsigned addr_field_len, alpha_nsep; 69 unsigned addr_field_len, alpha_nsep;
70 char digits[21]; 70 char digits[21];
71 u_char alpha_gsm7[11], alpha_decoded[23]; 71 u_char alpha_gsm7[11];
72 72
73 if (pdu_ptr >= pdu_length) { 73 if (pdu_ptr >= pdu_length) {
74 printf("Decode-Error: end of PDU before %s address\n", 74 printf("Decode-Error: end of PDU before %s address\n",
75 direction); 75 direction);
76 return(-1); 76 return(-1);
89 printf("%s: empty-addr (type 0x%02X)\n", direction, 89 printf("%s: empty-addr (type 0x%02X)\n", direction,
90 pdu[pdu_ptr+1]); 90 pdu[pdu_ptr+1]);
91 else if ((pdu[pdu_ptr+1] & 0x70) == 0x50 && 91 else if ((pdu[pdu_ptr+1] & 0x70) == 0x50 &&
92 alpha_addr_valid(pdu[pdu_ptr], &alpha_nsep)) { 92 alpha_addr_valid(pdu[pdu_ptr], &alpha_nsep)) {
93 gsm7_unpack(pdu + pdu_ptr + 2, alpha_gsm7, alpha_nsep); 93 gsm7_unpack(pdu + pdu_ptr + 2, alpha_gsm7, alpha_nsep);
94 gsm7_to_ascii_or_ext(alpha_gsm7, alpha_nsep, alpha_decoded, 94 printf("%s: ", direction);
95 (unsigned *) 0, ascii_ext_mode, 0, 95 print_gsm7_string_to_file(alpha_gsm7, alpha_nsep, stdout);
96 (unsigned *) 0); 96 printf(" (type 0x%02X)\n", pdu[pdu_ptr+1]);
97 printf("%s: \"%s\" (type 0x%02X)\n", direction, alpha_decoded,
98 pdu[pdu_ptr+1]);
99 } else { 97 } else {
100 decode_address_digits(pdu + pdu_ptr + 2, digits, pdu[pdu_ptr]); 98 decode_address_digits(pdu + pdu_ptr + 2, digits, pdu[pdu_ptr]);
101 printf("%s: %s%s (type 0x%02X)\n", direction, 99 printf("%s: %s%s (type 0x%02X)\n", direction,
102 pdu[pdu_ptr+1] == 0x91 ? "+" : "", digits, 100 pdu[pdu_ptr+1] == 0x91 ? "+" : "", digits,
103 pdu[pdu_ptr+1]); 101 pdu[pdu_ptr+1]);