diff gen-pdu/main.c @ 9:003660a57f99

new program sms-gen-tpdu
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 07:43:45 +0000
parents
children d9d722033ff1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gen-pdu/main.c	Sat Aug 05 07:43:45 2023 +0000
@@ -0,0 +1,58 @@
+/*
+ * This C file is the main module for sms-gen-tpdu utility.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+int dir_mo, include_sca;
+u_char sc_addr[12], user_addr[12];
+u_char mr_byte, pid_byte, dcs_byte;
+u_char scts_buf[7];
+int is_septet, scts_is_set;
+
+char input_line[512];
+int input_lineno;
+
+static void
+init_defaults()
+{
+	sc_addr[0] = 0;
+	user_addr[0] = 0;
+	user_addr[1] = 0x80;
+	mr_byte = 0xFF;
+	pid_byte = 0;
+	dcs_byte = 0;
+	is_septet = 1;
+}
+
+main(argc, argv)
+	char **argv;
+{
+	if (argc != 2) {
+usage:		fprintf(stderr, "usage: %s mo|mt|sc-mo|sc-mt\n", argv[0]);
+		exit(1);
+	}
+	if (!strcmp(argv[1], "mo")) {
+		dir_mo = 1;
+		include_sca = 0;
+	} else if (!strcmp(argv[1], "mt")) {
+		dir_mo = 0;
+		include_sca = 0;
+	} else if (!strcmp(argv[1], "sc-mo")) {
+		dir_mo = 1;
+		include_sca = 1;
+	} else if (!strcmp(argv[1], "sc-mt")) {
+		dir_mo = 0;
+		include_sca = 1;
+	} else
+		goto usage;
+	init_defaults();
+	for (input_lineno = 1; fgets(input_line, sizeof input_line, stdin);
+	     input_lineno++)
+		process_input_line();
+	exit(0);
+}