comparison gen-pdu/message.c @ 18:590b0b5bcbbb

sms-gen-tpdu: support setting VP for MO
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Aug 2023 07:55:13 +0000
parents d9d722033ff1
children
comparison
equal deleted inserted replaced
17:dc1cc851025c 18:590b0b5bcbbb
13 13
14 extern int dir_mo, include_sca; 14 extern int dir_mo, include_sca;
15 extern u_char sc_addr[12], user_addr[12]; 15 extern u_char sc_addr[12], user_addr[12];
16 extern u_char mr_byte, pid_byte, dcs_byte; 16 extern u_char mr_byte, pid_byte, dcs_byte;
17 extern u_char scts_buf[7]; 17 extern u_char scts_buf[7];
18 extern u_char vp_format, vp_buf[7];
18 extern int is_septet, scts_is_set; 19 extern int is_septet, scts_is_set;
19 extern int flag_rp, flag_sr, flag_lp, flag_mms, flag_rd; 20 extern int flag_rp, flag_sr, flag_lp, flag_mms, flag_rd;
20 21
21 extern int input_lineno; 22 extern int input_lineno;
22 23
23 static void 24 static void
24 emit_first_octet(udhi) 25 emit_first_octet(udhi)
25 { 26 {
26 u_char fo; 27 u_char fo;
27 28
28 if (dir_mo) 29 if (dir_mo) {
29 fo = flag_rd ? 5 : 1; 30 fo = flag_rd ? 5 : 1;
30 else { 31 fo |= vp_format;
32 } else {
31 fo = flag_mms ? 0 : 4; 33 fo = flag_mms ? 0 : 4;
32 if (flag_lp) 34 if (flag_lp)
33 fo |= 0x08; 35 fo |= 0x08;
34 } 36 }
35 if (flag_sr) 37 if (flag_sr)
56 printf("%02X", dcs_byte); 58 printf("%02X", dcs_byte);
57 if (!dir_mo) { 59 if (!dir_mo) {
58 if (!scts_is_set) 60 if (!scts_is_set)
59 set_auto_scts(); 61 set_auto_scts();
60 emit_hex_out(scts_buf, 7, stdout); 62 emit_hex_out(scts_buf, 7, stdout);
61 } 63 } else if (vp_format == 0x10)
64 printf("%02X", vp_buf[0]);
65 else if (vp_format)
66 emit_hex_out(vp_buf, 7, stdout);
62 printf("%02X", udl); 67 printf("%02X", udl);
63 emit_hex_out(ud_buf, ud_octets, stdout); 68 emit_hex_out(ud_buf, ud_octets, stdout);
64 putchar('\n'); 69 putchar('\n');
65 } 70 }
66 71