Introduce libsmpputil
As part of preparation for libosmo-netif migration let's move common SMPP code
into separate build-time library and use it for both smpp_mirror and OsmoMSC
renaming the files if necessary.
While at it we also fix id/password legth limits in smpp_mirror and drop unused
fields from ESME struct.
Related: OS#5568
Change-Id: I61910651bc7c188dc2fb67d96189a66a47e7e8fb
diff --git a/tests/db_sms/Makefile.am b/tests/db_sms/Makefile.am
index 140ccbf..946d6a2 100644
--- a/tests/db_sms/Makefile.am
+++ b/tests/db_sms/Makefile.am
@@ -14,7 +14,6 @@
$(LIBOSMOSIGTRAN_CFLAGS) \
$(LIBOSMORANAP_CFLAGS) \
$(LIBOSMONETIF_CFLAGS) \
- $(LIBSMPP34_CFLAGS) \
$(LIBOSMOMGCPCLIENT_CFLAGS) \
$(LIBOSMOGSUPCLIENT_CFLAGS) \
$(LIBSQLITE3_CFLAGS) \
@@ -37,7 +36,6 @@
db_sms_test_LDADD = \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libvlr/libvlr.a \
- $(LIBSMPP34_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
diff --git a/tests/msc_vlr/Makefile.am b/tests/msc_vlr/Makefile.am
index 505b5c7..2ba7180 100644
--- a/tests/msc_vlr/Makefile.am
+++ b/tests/msc_vlr/Makefile.am
@@ -8,7 +8,6 @@
-ggdb3 \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOGSM_CFLAGS) \
- $(LIBSMPP34_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(LIBOSMOSIGTRAN_CFLAGS) \
@@ -32,7 +31,6 @@
LDADD = \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libvlr/libvlr.a \
- $(LIBSMPP34_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
diff --git a/tests/smpp/Makefile.am b/tests/smpp/Makefile.am
index 00090da..fabfd2d 100644
--- a/tests/smpp/Makefile.am
+++ b/tests/smpp/Makefile.am
@@ -11,6 +11,8 @@
$(LIBOSMOGSM_CFLAGS) \
$(LIBOSMOSCCP_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
+ $(LIBOSMOSCCP_CFLAGS) \
+ $(LIBOSMOMGCPCLIENT_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(LIBSMPP34_CFLAGS) \
$(NULL)
@@ -30,10 +32,10 @@
smpp_test_SOURCES = \
smpp_test.c \
- $(top_builddir)/src/libmsc/smpp_utils.c \
$(NULL)
smpp_test_LDADD = \
+ $(top_builddir)/src/libsmpputil/libsmpputil.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(NULL)
diff --git a/tests/smpp/smpp_test.c b/tests/smpp/smpp_test.c
index 4640a5f..9b94c63 100644
--- a/tests/smpp/smpp_test.c
+++ b/tests/smpp/smpp_test.c
@@ -22,12 +22,10 @@
#include <stdio.h>
#include <osmocom/msc/debug.h>
-
+#include <osmocom/smpp/smpp_smsc.h>
#include <osmocom/core/application.h>
#include <osmocom/core/backtrace.h>
-#include "smpp_smsc.h"
-
struct coding_test {
uint8_t dcs;
uint8_t coding;
diff --git a/tests/sms_queue/Makefile.am b/tests/sms_queue/Makefile.am
index c83a946..d50a8d6 100644
--- a/tests/sms_queue/Makefile.am
+++ b/tests/sms_queue/Makefile.am
@@ -36,7 +36,6 @@
sms_queue_test_LDADD = \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libvlr/libvlr.a \
- $(LIBSMPP34_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
diff --git a/tests/stubs.c b/tests/stubs.c
index e6ef548..f29a201 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -43,3 +43,11 @@
void osmo_stream_srv_link_set_port(struct osmo_stream_srv_link *link, uint16_t port) {}
void osmo_stream_srv_link_set_addr(struct osmo_stream_srv_link *link, const char *addr) {}
int sctp_recvmsg(int sd, void *msg, size_t len, void *from, void *fromlen, void *info, int *msg_flags) { return 0; }
+struct gsm_sms;
+struct msc_a;
+struct gsm_trans;
+struct osmo_esme;
+bool smpp_route_smpp_first() { return false; }
+void smpp_esme_put(struct osmo_esme *esme) { return; }
+int smpp_try_deliver(struct gsm_sms *sms, struct msc_a *msc_a) { return 0; }
+int sms_route_mt_sms(struct gsm_trans *trans, struct gsm_sms *gsms) { return 0; }