[MERGED] osmo-msc[master]: libmsc: use new smpp34 esm_class definitions

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Aug 27 00:34:51 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: libmsc: use new smpp34 esm_class definitions
......................................................................


libmsc: use new smpp34 esm_class definitions

Replace magic numbers by esm_class definitions, which
have been added to latest libsmpp34 in Change-Id
I91afd8b462b8fd3b2c4c5b54f4eeb7ec5b730b65

Change-Id: I6c458690da60c8f3637680efbd718f6e8c6feb4c
---
M src/libmsc/smpp_openbsc.c
1 file changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved



diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 1ffb0cd..abf3b3c 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -158,14 +158,13 @@
 	osmo_strlcpy(sms->src.addr, (char *)submit->source_addr,
 		     sizeof(sms->src.addr));
 
-	/* This is a Delivery Acknowledgment. */
-	if (submit->esm_class == 0x08)
+	if (submit->esm_class == SMPP34_DELIVERY_ACK)
 		sms->is_report = true;
 
-	if (submit->esm_class & 0x40)
+	if (submit->esm_class & SMPP34_UDHI_IND)
 		sms->ud_hdr_ind = 1;
 
-	if (submit->esm_class & 0x80) {
+	if (submit->esm_class & SMPP34_REPLY_PATH) {
 		sms->reply_path_req = 1;
 #warning Implement reply path
 	}
@@ -241,7 +240,7 @@
 	sms->smpp.esme = esme;
 	sms->protocol_id = submit->protocol_id;
 
-	switch (submit->esm_class & 3) {
+	switch (submit->esm_class & SMPP34_MSG_MODE_MASK) {
 	case 0: /* default */
 	case 1: /* datagram */
 	case 3: /* store-and-forward */
@@ -668,16 +667,15 @@
 	memcpy(deliver.destination_addr, sms->dst.addr,
 		sizeof(deliver.destination_addr));
 
-	/* Short message contains a delivery receipt? Sect. 5.2.12. */
 	if (sms->is_report)
-		deliver.esm_class = 0x04;
+		deliver.esm_class = SMPP34_DELIVERY_RECEIPT;
 	else
-		deliver.esm_class = 1;	/* datagram mode */
+		deliver.esm_class = SMPP34_DATAGRAM_MODE;
 
 	if (sms->ud_hdr_ind)
-		deliver.esm_class |= 0x40;
+		deliver.esm_class |= SMPP34_UDHI_IND;
 	if (sms->reply_path_req)
-		deliver.esm_class |= 0x80;
+		deliver.esm_class |= SMPP34_REPLY_PATH;
 
 	deliver.protocol_id 	= sms->protocol_id;
 	deliver.priority_flag	= 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c458690da60c8f3637680efbd718f6e8c6feb4c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>



More information about the gerrit-log mailing list