Change in osmocom-bb[master]: mobile/sms: Make it optional to store the SMS on disk

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Tue Jun 5 20:34:40 UTC 2018


Holger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/9467


Change subject: mobile/sms: Make it optional to store the SMS on disk
......................................................................

mobile/sms: Make it optional to store the SMS on disk

Disable storing the SMS on disk. This is useful when scripting mobile.
Keep the default of attempting to store it to disk.

Change-Id: I6353447343d98ebaa5e12ab63f995750f81c8500
---
M src/host/layer23/include/osmocom/bb/mobile/settings.h
M src/host/layer23/src/mobile/gsm411_sms.c
M src/host/layer23/src/mobile/settings.c
M src/host/layer23/src/mobile/vty_interface.c
4 files changed, 37 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/67/9467/1

diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index a1bce06..4e5d5a1 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -21,6 +21,7 @@
 
 	/* SMS */
 	char			sms_sca[22];
+	bool			store_sms;
 
 	/* test card simulator settings */
 	char 			test_imsi[16];
diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c
index fe13ba1..623ba53 100644
--- a/src/host/layer23/src/mobile/gsm411_sms.c
+++ b/src/host/layer23/src/mobile/gsm411_sms.c
@@ -177,8 +177,8 @@
  * receive SMS
  */
 
-/* now here comes our SMS */
-static int gsm340_rx_sms_deliver(struct osmocom_ms *ms, struct msgb *msg,
+/* store the SMS to disk */
+static int sms_store(struct osmocom_ms *ms, struct msgb *msg,
 	struct gsm_sms *gsms)
 {
 	const char osmocomsms[] = ".osmocom/bb/sms.txt";
@@ -187,8 +187,6 @@
 	char vty_text[sizeof(gsms->text)], *p;
 	FILE *fp;
 
-	mobile_prim_ntfy_sms_new(ms, gsms);
-
 	/* remove linefeeds and show at VTY */
 	strcpy(vty_text, gsms->text);
 	for (p = vty_text; *p; p++) {
@@ -222,6 +220,16 @@
 	return 0;
 }
 
+/* now here comes our SMS */
+static int gsm340_rx_sms_deliver(struct osmocom_ms *ms, struct msgb *msg,
+	struct gsm_sms *gsms)
+{
+	mobile_prim_ntfy_sms_new(ms, gsms);
+	if (!ms->settings.store_sms)
+		return 0;
+	return sms_store(ms, msg, gsms);
+}
+
 /* process an incoming TPDU (called from RP-DATA)
  * return value > 0: RP CAUSE for ERROR; < 0: silent error; 0 = success */
 static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg, uint8_t msg_ref)
diff --git a/src/host/layer23/src/mobile/settings.c b/src/host/layer23/src/mobile/settings.c
index f1c0cfc..7370b0a 100644
--- a/src/host/layer23/src/mobile/settings.c
+++ b/src/host/layer23/src/mobile/settings.c
@@ -92,6 +92,8 @@
 
 	set->any_timeout = MOB_C7_DEFLT_ANY_TIMEOUT;
 
+	set->store_sms = true;
+
 	INIT_LLIST_HEAD(&set->abbrev);
 
 	return 0;
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index f8ecb28..ec1216f 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1766,6 +1766,26 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_ms_no_sms_store, cfg_ms_no_sms_store_cmd, "no sms-store",
+	NO_STR "Store SMS in the home directory")
+{
+	struct osmocom_ms *ms = vty->index;
+	struct gsm_settings *set = &ms->settings;
+
+	set->store_sms = false;
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_sms_store, cfg_ms_sms_store_cmd, "sms-store",
+	"Store SMS in the home directory")
+{
+	struct osmocom_ms *ms = vty->index;
+	struct gsm_settings *set = &ms->settings;
+
+	set->store_sms = true;
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_no_cw, cfg_ms_no_cw_cmd, "no call-waiting",
 	NO_STR "Disallow waiting calls")
 {
@@ -2909,6 +2929,8 @@
 	install_element(MS_NODE, &cfg_ms_neighbour_cmd);
 	install_element(MS_NODE, &cfg_ms_no_neighbour_cmd);
 	install_element(MS_NODE, &cfg_ms_any_timeout_cmd);
+	install_element(MS_NODE, &cfg_ms_sms_store_cmd);
+	install_element(MS_NODE, &cfg_ms_no_sms_store_cmd);
 	install_element(MS_NODE, &cfg_ms_support_cmd);
 	install_node(&support_node, config_write_dummy);
 	install_element(SUPPORT_NODE, &cfg_ms_sup_dtmf_cmd);

-- 
To view, visit https://gerrit.osmocom.org/9467
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6353447343d98ebaa5e12ab63f995750f81c8500
Gerrit-Change-Number: 9467
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <holger at freyther.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180605/37895e6e/attachment.htm>


More information about the gerrit-log mailing list