Use libsmpputil functions in smpp_mirror tool
Related: OS#5568 Change-Id: Icb046570803acb3eff89e2a4eb979c4899d485f7
This commit is contained in:
parent
445c6558ab
commit
867cb3274f
|
@ -47,5 +47,7 @@ struct esme {
|
|||
(resp)->sequence_number = (req)->sequence_number; }
|
||||
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -41,9 +41,19 @@ smpp_mirror_CFLAGS = \
|
|||
|
||||
smpp_mirror_LDADD = \
|
||||
$(top_builddir)/src/libsmpputil/libsmpputil.a \
|
||||
$(LIBOSMOCORE_LIBS) \
|
||||
$(top_builddir)/src/libmsc/libmsc.a \
|
||||
$(top_builddir)/src/libvlr/libvlr.a \
|
||||
$(LIBOSMOGSM_LIBS) \
|
||||
$(LIBOSMOVTY_LIBS) \
|
||||
$(LIBOSMOCORE_LIBS) \
|
||||
$(LIBOSMONETIF_LIBS) \
|
||||
$(LIBSMPP34_LIBS) \
|
||||
$(LIBOSMORANAP_LIBS) \
|
||||
$(LIBASN1C_LIBS) \
|
||||
$(LIBOSMOSIGTRAN_LIBS) \
|
||||
$(LIBOSMOMGCPCLIENT_LIBS) \
|
||||
$(LIBOSMOGSUPCLIENT_LIBS) \
|
||||
$(LIBSQLITE3_LIBS) \
|
||||
-lsctp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
|
|
@ -22,37 +22,6 @@
|
|||
#include <osmocom/smpp/smpp.h>
|
||||
|
||||
|
||||
/* 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)
|
||||
|
|
Loading…
Reference in New Issue