[MERGED] openbsc[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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Aug 13 22:36:01 UTC 2017


Harald Welte 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 openbsc/src/libmsc/smpp_openbsc.c
1 file changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index 7e23abd..ddb24b5 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -157,14 +157,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
 	}
@@ -240,7 +239,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 */
@@ -664,16 +663,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/3474
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c458690da60c8f3637680efbd718f6e8c6feb4c
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pablo Neira Ayuso <pablo at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>



More information about the gerrit-log mailing list