msuraev has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/28847 )

Change subject: Use libsmpputil functions in smpp_mirror tool
......................................................................

Use libsmpputil functions in smpp_mirror tool

Related: OS#5568
Change-Id: Icb046570803acb3eff89e2a4eb979c4899d485f7
---
M include/osmocom/smpp/smpp.h
M src/libsmpputil/smpp_smsc.c
M src/utils/smpp_mirror.c
3 files changed, 4 insertions(+), 33 deletions(-)

Approvals:
  Jenkins Builder: Verified
  neels: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  dexter: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/include/osmocom/smpp/smpp.h b/include/osmocom/smpp/smpp.h
index db4101d..54e5de7 100644
--- a/include/osmocom/smpp/smpp.h
+++ b/include/osmocom/smpp/smpp.h
@@ -49,5 +49,7 @@

 struct esme *esme_alloc(void *ctx);
 uint32_t smpp_msgb_cmdid(struct msgb *msg);
+uint32_t esme_inc_seq_nr(struct esme *esme);
+int pack_and_send(struct esme *esme, uint32_t type, void *ptr);
 int smpp_openbsc_alloc_init(void *ctx);
 int smpp_openbsc_start(struct gsm_network *net);
diff --git a/src/libsmpputil/smpp_smsc.c b/src/libsmpputil/smpp_smsc.c
index bb559cd..a1f2b2f 100644
--- a/src/libsmpputil/smpp_smsc.c
+++ b/src/libsmpputil/smpp_smsc.c
@@ -250,7 +250,7 @@
        talloc_free(esme);
 }

-static uint32_t esme_inc_seq_nr(struct esme *esme)
+uint32_t esme_inc_seq_nr(struct esme *esme)
 {
        esme->own_seq_nr++;
        if (esme->own_seq_nr > 0x7fffffff)
@@ -326,7 +326,7 @@
 }

 /*! \brief pack a libsmpp34 data strcutrure and send it to the ESME */
-static int pack_and_send(struct esme *esme, uint32_t type, void *ptr)
+int pack_and_send(struct esme *esme, uint32_t type, void *ptr)
 {
        struct msgb *msg;
        int rc, rlen;
diff --git a/src/utils/smpp_mirror.c b/src/utils/smpp_mirror.c
index 076b434..48b9ea2 100644
--- a/src/utils/smpp_mirror.c
+++ b/src/utils/smpp_mirror.c
@@ -23,37 +23,6 @@


 /* FIXME: merge with smpp_smsc.c */
-static uint32_t esme_inc_seq_nr(struct esme *esme)
-{
-       esme->own_seq_nr++;
-       if (esme->own_seq_nr > 0x7fffffff)
-               esme->own_seq_nr = 1;
-
-       return esme->own_seq_nr;
-}
-static int pack_and_send(struct esme *esme, uint32_t type, void *ptr)
-{
-       struct msgb *msg = msgb_alloc(4096, "SMPP_Tx");
-       int rc, rlen;
-       if (!msg)
-               return -ENOMEM;
-
-       rc = smpp34_pack(type, msg->tail, msgb_tailroom(msg), &rlen, ptr);
-       if (rc != 0) {
-               LOGPESMERR(esme, "during smpp34_pack()\n");
-               msgb_free(msg);
-               return -EINVAL;
-       }
-       msgb_put(msg, rlen);
-
-       if (osmo_wqueue_enqueue(&esme->wqueue, msg) != 0) {
-               LOGPESME(esme, LOGL_ERROR, "Write queue full. Dropping 
message\n");
-               msgb_free(msg);
-               return -EAGAIN;
-       }
-       return 0;
-}
-/* FIXME: merge with smpp_smsc.c */

 static struct tlv_t *find_tlv(struct tlv_t *head, uint16_t tag)
 {



23 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28847
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Icb046570803acb3eff89e2a4eb979c4899d485f7
Gerrit-Change-Number: 28847
Gerrit-PatchSet: 29
Gerrit-Owner: msuraev <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: msuraev <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to