diff --git a/include/osmocom/smpp/smpp.h b/include/osmocom/smpp/smpp.h index d84c9b9ed..0e0173842 100644 --- a/include/osmocom/smpp/smpp.h +++ b/include/osmocom/smpp/smpp.h @@ -48,5 +48,7 @@ struct esme { struct esme *esme_init(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 086e07e67..40d104d61 100644 --- a/src/libsmpputil/smpp_smsc.c +++ b/src/libsmpputil/smpp_smsc.c @@ -250,7 +250,7 @@ static void esme_destroy(struct osmo_esme *esme) 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 @@ int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struc } /*! \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 260503f5c..3562a4e88 100644 --- a/src/utils/smpp_mirror.c +++ b/src/utils/smpp_mirror.c @@ -22,37 +22,6 @@ #include -/* 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)