Remove local libgsupclient; Use libosmo-gsup-client from osmo-hlr

osmo-hlr has recently (as of Change-Id
Iad227bb477d64da30dd6bfbbe1bd0c0a55be9474) a working shared library
implementation of libosmo-gsup-client.

We can remove the local implementation in osmo-sgsn and use the
system-installed shared library instead.

Change-Id: I6f542945403cf2e3ddac419186b09ec0e2d43b69
diff --git a/tests/sgsn/Makefile.am b/tests/sgsn/Makefile.am
index 0eb2100..956ef8d 100644
--- a/tests/sgsn/Makefile.am
+++ b/tests/sgsn/Makefile.am
@@ -9,6 +9,7 @@
 	$(LIBOSMOCORE_CFLAGS) \
 	$(LIBOSMOABIS_CFLAGS) \
 	$(LIBOSMOGSM_CFLAGS) \
+	$(LIBOSMOGSUPCLIENT_CFLAGS) \
 	$(LIBCARES_CFLAGS) \
 	$(LIBGTP_CFLAGS) \
 	$(NULL)
@@ -37,7 +38,7 @@
 	-Wl,--wrap=sgsn_update_subscriber_data \
 	-Wl,--wrap=gprs_subscr_request_update_location \
 	-Wl,--wrap=gprs_subscr_request_auth_info \
-	-Wl,--wrap=gsup_client_send \
+	-Wl,--wrap=osmo_gsup_client_send \
 	$(NULL)
 
 sgsn_test_LDADD = \
@@ -62,11 +63,11 @@
         $(top_builddir)/src/gprs/gprs_sndcp_pcomp.o \
         $(top_builddir)/src/gprs/v42bis.o \
         $(top_builddir)/src/gprs/gprs_sndcp_dcomp.o \
-        $(top_builddir)/src/gprs/gsup_client.o \
 	$(LIBOSMOABIS_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOGB_LIBS) \
+	$(LIBOSMOGSUPCLIENT_LIBS) \
 	$(LIBCARES_LIBS) \
 	$(LIBGTP_LIBS) \
 	-lrt \
diff --git a/tests/sgsn/sgsn_test.c b/tests/sgsn/sgsn_test.c
index 214d07b..111515e 100644
--- a/tests/sgsn/sgsn_test.c
+++ b/tests/sgsn/sgsn_test.c
@@ -25,7 +25,7 @@
 #include <osmocom/sgsn/debug.h>
 #include <osmocom/sgsn/gprs_subscriber.h>
 #include <osmocom/gsm/gsup.h>
-#include <osmocom/sgsn/gsup_client.h>
+#include <osmocom/gsupclient/gsup_client.h>
 #include <osmocom/sgsn/gprs_utils.h>
 #include <osmocom/sgsn/gprs_gb_parse.h>
 
@@ -148,13 +148,13 @@
 };
 
 /* override, requires '-Wl,--wrap=gsup_client_send' */
-int __real_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg);
-int (*gsup_client_send_cb)(struct gsup_client *gsupc, struct msgb *msg) =
-	&__real_gsup_client_send;
+int __real_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg);
+int (*osmo_gsup_client_send_cb)(struct osmo_gsup_client *gsupc, struct msgb *msg) =
+	&__real_osmo_gsup_client_send;
 
-int __wrap_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg)
+int __wrap_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg)
 {
-	return (*gsup_client_send_cb)(gsupc, msg);
+	return (*osmo_gsup_client_send_cb)(gsupc, msg);
 };
 
 static int count(struct llist_head *head)
@@ -729,7 +729,7 @@
 	cleanup_test();
 }
 
-int my_gsup_client_send_dummy(struct gsup_client *gsupc, struct msgb *msg)
+int my_gsup_client_send_dummy(struct osmo_gsup_client *gsupc, struct msgb *msg)
 {
 	msgb_free(msg);
 	return 0;
@@ -1032,7 +1032,7 @@
 	return rx_gsup_message(update_location_res, sizeof(update_location_res));
 };
 
-int my_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg)
+int my_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg)
 {
 	struct osmo_gsup_message to_peer = {0};
 	struct osmo_gsup_message from_peer = {0};
@@ -1074,7 +1074,7 @@
 		return 0;
 	}
 
-	reply_msg = gsup_client_msgb_alloc();
+	reply_msg = osmo_gsup_client_msgb_alloc();
 	reply_msg->l2h = reply_msg->data;
 	osmo_gsup_encode(reply_msg, &from_peer);
 	gprs_subscr_rx_gsup_message(reply_msg);
@@ -1451,7 +1451,7 @@
 
 	printf("Testing GGSN selection\n");
 
-	gsup_client_send_cb = my_gsup_client_send_dummy;
+	osmo_gsup_client_send_cb = my_gsup_client_send_dummy;
 
 	/* Check for emptiness */
 	OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL);
@@ -1570,7 +1570,7 @@
 	sgsn_ggsn_ctx_free(ggcs[1]);
 	sgsn_ggsn_ctx_free(ggcs[2]);
 
-	gsup_client_send_cb = __real_gsup_client_send;
+	osmo_gsup_client_send_cb = __real_osmo_gsup_client_send;
 
 	cleanup_test();
 }