[PATCH] openbsc[master]: utils: smpp_mirror: reflect message reference TLV

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/.

Pablo Neira Ayuso gerrit-no-reply at lists.osmocom.org
Tue Aug 8 08:59:39 UTC 2017


Review at  https://gerrit.osmocom.org/3433

utils: smpp_mirror: reflect message reference TLV

Useful to test the delivery receipt support. This TLV contains the
GSM03.40 message reference.

Change-Id: I1b0abaa7e06ffe1bd2242c70813d8b70e9fa954f
---
M openbsc/src/utils/smpp_mirror.c
1 file changed, 23 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/33/3433/1

diff --git a/openbsc/src/utils/smpp_mirror.c b/openbsc/src/utils/smpp_mirror.c
index edb40b5..88545de 100644
--- a/openbsc/src/utils/smpp_mirror.c
+++ b/openbsc/src/utils/smpp_mirror.c
@@ -95,12 +95,23 @@
 }
 /* FIXME: merge with smpp_smsc.c */
 
+static struct tlv_t *find_tlv(struct tlv_t *head, uint16_t tag)
+{
+	struct tlv_t *t;
+
+	for (t = head; t != NULL; t = t->next) {
+		if (t->tag == tag)
+			return t;
+	}
+	return NULL;
+}
 
 static int smpp_handle_deliver(struct esme *esme, struct msgb *msg)
 {
 	struct deliver_sm_t deliver;
 	struct deliver_sm_resp_t deliver_r;
 	struct submit_sm_t submit;
+	tlv_t *t;
 	int rc;
 
 	memset(&deliver, 0, sizeof(deliver));
@@ -155,7 +166,18 @@
 	memcpy(submit.short_message, deliver.short_message,
 		OSMO_MIN(sizeof(submit.short_message),
 			 sizeof(deliver.short_message)));
-	/* FIXME: TLV? */
+
+	/* FIXME: More TLV? */
+	t = find_tlv(deliver.tlv, TLVID_user_message_reference);
+	if (t) {
+		tlv_t tlv;
+
+		memset(&tlv, 0, sizeof(tlv));
+		tlv.tag = TLVID_user_message_reference;
+		tlv.length = 2;
+		tlv.value.val16 = t->value.val16;
+		build_tlv(&submit.tlv, &tlv);
+	}
 
 	return PACK_AND_SEND(esme, &submit);
 }

-- 
To view, visit https://gerrit.osmocom.org/3433
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b0abaa7e06ffe1bd2242c70813d8b70e9fa954f
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pablo Neira Ayuso <pablo at gnumonks.org>



More information about the gerrit-log mailing list