diff 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
line wrap: on
line diff
--- a/gen-pdu/message.c	Sun Aug 27 07:39:14 2023 +0000
+++ b/gen-pdu/message.c	Sun Aug 27 07:55:13 2023 +0000
@@ -15,6 +15,7 @@
 extern u_char sc_addr[12], user_addr[12];
 extern u_char mr_byte, pid_byte, dcs_byte;
 extern u_char scts_buf[7];
+extern u_char vp_format, vp_buf[7];
 extern int is_septet, scts_is_set;
 extern int flag_rp, flag_sr, flag_lp, flag_mms, flag_rd;
 
@@ -25,9 +26,10 @@
 {
 	u_char fo;
 
-	if (dir_mo)
+	if (dir_mo) {
 		fo = flag_rd ? 5 : 1;
-	else {
+		fo |= vp_format;
+	} else {
 		fo = flag_mms ? 0 : 4;
 		if (flag_lp)
 			fo |= 0x08;
@@ -58,7 +60,10 @@
 		if (!scts_is_set)
 			set_auto_scts();
 		emit_hex_out(scts_buf, 7, stdout);
-	}
+	} else if (vp_format == 0x10)
+		printf("%02X", vp_buf[0]);
+	else if (vp_format)
+		emit_hex_out(vp_buf, 7, stdout);
 	printf("%02X", udl);
 	emit_hex_out(ud_buf, ud_octets, stdout);
 	putchar('\n');