aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2017-08-11 13:10:48 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:55 +0200
commit57edda7fc5a8e0628bf5d383991019e4e8587daf (patch)
treee4ba3b1de04410d9f552ff4588459e17037e8ce6
parente6ad4c896d5c4c050aa7816fdd187068715b2c58 (diff)
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
-rw-r--r--src/libmsc/smpp_openbsc.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 1ffb0cd8..abf3b3c8 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -158,14 +158,13 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net,
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 @@ int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit,
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 @@ static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
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;