diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-07-31 19:40:52 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-08-05 11:20:21 +0200 |
commit | 1ea6baf1ec8927d69c8787b282e07ed2f24c7525 (patch) | |
tree | 198b07f12c88afc814a03b90f020a7281b89574f /src | |
parent | 0622ef5308f1822c023d3d8312b621e3343bc7b9 (diff) |
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-msc and use the
system-installed shared library instead.
Change-Id: I6f542945403cf2e3ddac419186b09ec0e2d43b69
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/libgsupclient/Makefile.am | 38 | ||||
-rw-r--r-- | src/libgsupclient/gsup_client.c | 347 | ||||
-rw-r--r-- | src/libgsupclient/gsup_test_client.c | 321 | ||||
-rw-r--r-- | src/libmsc/Makefile.am | 1 | ||||
-rw-r--r-- | src/libmsc/gsm_09_11.c | 6 | ||||
-rw-r--r-- | src/libvlr/Makefile.am | 1 | ||||
-rw-r--r-- | src/libvlr/vlr.c | 16 | ||||
-rw-r--r-- | src/osmo-msc/Makefile.am | 3 |
9 files changed, 15 insertions, 719 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 2322adea4..4e7cea19b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,6 @@ AM_LDFLAGS = \ # Libraries SUBDIRS = \ - libgsupclient \ libvlr \ libmsc \ $(NULL) diff --git a/src/libgsupclient/Makefile.am b/src/libgsupclient/Makefile.am deleted file mode 100644 index 6381687e4..000000000 --- a/src/libgsupclient/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -AM_CPPFLAGS = \ - $(all_includes) \ - -I$(top_srcdir)/include \ - -I$(top_builddir) \ - $(NULL) - -AM_CFLAGS = \ - -Wall \ - $(LIBOSMOCORE_CFLAGS) \ - $(LIBOSMOGSM_CFLAGS) \ - $(LIBOSMOVTY_CFLAGS) \ - $(LIBOSMOABIS_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(NULL) - -noinst_LIBRARIES = \ - libgsupclient.a \ - $(NULL) - -libgsupclient_a_SOURCES = \ - gsup_client.c \ - $(NULL) - -noinst_PROGRAMS = \ - gsup_test_client \ - $(NULL) - -gsup_test_client_SOURCES = \ - gsup_test_client.c \ - $(NULL) -gsup_test_client_LDADD = \ - libgsupclient.a \ - $(LIBOSMOCORE_LIBS) \ - $(LIBOSMOGSM_LIBS) \ - $(LIBOSMOVTY_LIBS) \ - $(LIBOSMOABIS_LIBS) \ - -lrt \ - $(NULL) diff --git a/src/libgsupclient/gsup_client.c b/src/libgsupclient/gsup_client.c deleted file mode 100644 index 39dc181b4..000000000 --- a/src/libgsupclient/gsup_client.c +++ /dev/null @@ -1,347 +0,0 @@ -/* Generic Subscriber Update Protocol client */ - -/* (C) 2014-2016 by Sysmocom s.f.m.c. GmbH - * All Rights Reserved - * - * Author: Jacob Erlbeck - * Author: Neels Hofmeyr - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#include <osmocom/msc/gsup_client.h> - -#include <osmocom/abis/ipa.h> -#include <osmocom/gsm/protocol/ipaccess.h> -#include <osmocom/gsm/oap_client.h> -#include <osmocom/core/msgb.h> -#include <osmocom/core/logging.h> - -#include <osmocom/msc/debug.h> - -#include <errno.h> -#include <string.h> - -static void start_test_procedure(struct gsup_client *gsupc); - -static void gsup_client_send_ping(struct gsup_client *gsupc) -{ - struct msgb *msg = gsup_client_msgb_alloc(); - - msg->l2h = msgb_put(msg, 1); - msg->l2h[0] = IPAC_MSGT_PING; - ipa_msg_push_header(msg, IPAC_PROTO_IPACCESS); - ipa_client_conn_send(gsupc->link, msg); -} - -static int gsup_client_connect(struct gsup_client *gsupc) -{ - int rc; - - if (gsupc->is_connected) - return 0; - - if (osmo_timer_pending(&gsupc->connect_timer)) { - LOGP(DLGSUP, LOGL_DEBUG, - "GSUP connect: connect timer already running\n"); - osmo_timer_del(&gsupc->connect_timer); - } - - if (osmo_timer_pending(&gsupc->ping_timer)) { - LOGP(DLGSUP, LOGL_DEBUG, - "GSUP connect: ping timer already running\n"); - osmo_timer_del(&gsupc->ping_timer); - } - - if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); - - rc = ipa_client_conn_open(gsupc->link); - - if (rc >= 0) { - LOGP(DLGSUP, LOGL_NOTICE, "GSUP connecting to %s:%d\n", - gsupc->link->addr, gsupc->link->port); - return 0; - } - - LOGP(DLGSUP, LOGL_ERROR, "GSUP failed to connect to %s:%d: %s\n", - gsupc->link->addr, gsupc->link->port, strerror(-rc)); - - if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || - rc == -EINVAL) - return rc; - - osmo_timer_schedule(&gsupc->connect_timer, - GSUP_CLIENT_RECONNECT_INTERVAL, 0); - - LOGP(DLGSUP, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", - gsupc->link->addr, gsupc->link->port); - - return 0; -} - -static void connect_timer_cb(void *gsupc_) -{ - struct gsup_client *gsupc = gsupc_; - - if (gsupc->is_connected) - return; - - gsup_client_connect(gsupc); -} - -static void client_send(struct gsup_client *gsupc, int proto_ext, - struct msgb *msg_tx) -{ - ipa_prepend_header_ext(msg_tx, proto_ext); - ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO); - ipa_client_conn_send(gsupc->link, msg_tx); - /* msg_tx is now queued and will be freed. */ -} - -static void gsup_client_oap_register(struct gsup_client *gsupc) -{ - struct msgb *msg_tx; - int rc; - rc = osmo_oap_client_register(&gsupc->oap_state, &msg_tx); - - if ((rc < 0) || (!msg_tx)) { - LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n"); - return; - } - - client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); -} - -static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) -{ - struct gsup_client *gsupc = link->data; - - LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n", - link->addr, link->port, up ? "UP" : "DOWN"); - - gsupc->is_connected = up; - - if (up) { - start_test_procedure(gsupc); - - if (gsupc->oap_state.state == OSMO_OAP_INITIALIZED) - gsup_client_oap_register(gsupc); - - osmo_timer_del(&gsupc->connect_timer); - } else { - osmo_timer_del(&gsupc->ping_timer); - - osmo_timer_schedule(&gsupc->connect_timer, - GSUP_CLIENT_RECONNECT_INTERVAL, 0); - } -} - -static int gsup_client_oap_handle(struct gsup_client *gsupc, struct msgb *msg_rx) -{ - int rc; - struct msgb *msg_tx; - - /* If the oap_state is disabled, this will reject the messages. */ - rc = osmo_oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx); - msgb_free(msg_rx); - if (rc < 0) - return rc; - - if (msg_tx) - client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx); - - return 0; -} - -static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) -{ - struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; - struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); - struct gsup_client *gsupc = (struct gsup_client *)link->data; - int rc; - struct ipaccess_unit ipa_dev = { - /* see gsup_client_create() on const vs non-const */ - .unit_name = (char*)gsupc->unit_name, - }; - - OSMO_ASSERT(ipa_dev.unit_name); - - msg->l2h = &hh->data[0]; - - rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); - - if (rc < 0) { - LOGP(DLGSUP, LOGL_NOTICE, - "GSUP received an invalid IPA/CCM message from %s:%d\n", - link->addr, link->port); - /* Link has been closed */ - gsupc->is_connected = 0; - msgb_free(msg); - return -1; - } - - if (rc == 1) { - uint8_t msg_type = *(msg->l2h); - /* CCM message */ - if (msg_type == IPAC_MSGT_PONG) { - LOGP(DLGSUP, LOGL_DEBUG, "GSUP receiving PONG\n"); - gsupc->got_ipa_pong = 1; - } - - msgb_free(msg); - return 0; - } - - if (hh->proto != IPAC_PROTO_OSMO) - goto invalid; - - if (!he || msgb_l2len(msg) < sizeof(*he)) - goto invalid; - - msg->l2h = &he->data[0]; - - if (he->proto == IPAC_PROTO_EXT_GSUP) { - OSMO_ASSERT(gsupc->read_cb != NULL); - gsupc->read_cb(gsupc, msg); - /* expecting read_cb() to free msg */ - } else if (he->proto == IPAC_PROTO_EXT_OAP) { - return gsup_client_oap_handle(gsupc, msg); - /* gsup_client_oap_handle frees msg */ - } else - goto invalid; - - return 0; - -invalid: - LOGP(DLGSUP, LOGL_NOTICE, - "GSUP received an invalid IPA message from %s:%d, size = %d\n", - link->addr, link->port, msgb_length(msg)); - - msgb_free(msg); - return -1; -} - -static void ping_timer_cb(void *gsupc_) -{ - struct gsup_client *gsupc = gsupc_; - - LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", - gsupc->is_connected ? "connected" : "not connected", - gsupc->got_ipa_pong ? "got" : "didn't get"); - - if (gsupc->got_ipa_pong) { - start_test_procedure(gsupc); - return; - } - - LOGP(DLGSUP, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); - ipa_client_conn_close(gsupc->link); - gsupc->is_connected = 0; - - gsup_client_connect(gsupc); -} - -static void start_test_procedure(struct gsup_client *gsupc) -{ - osmo_timer_setup(&gsupc->ping_timer, ping_timer_cb, gsupc); - - gsupc->got_ipa_pong = 0; - osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0); - LOGP(DLGSUP, LOGL_DEBUG, "GSUP sending PING\n"); - gsup_client_send_ping(gsupc); -} - -struct gsup_client *gsup_client_create(void *talloc_ctx, - const char *unit_name, - const char *ip_addr, - unsigned int tcp_port, - gsup_client_read_cb_t read_cb, - struct osmo_oap_client_config *oapc_config) -{ - struct gsup_client *gsupc; - int rc; - - gsupc = talloc_zero(talloc_ctx, struct gsup_client); - OSMO_ASSERT(gsupc); - - /* struct ipaccess_unit has a non-const unit_name, so let's copy to be - * able to have a non-const unit_name here as well. To not taint the - * public gsup_client API, let's store it in a const char* anyway. */ - gsupc->unit_name = talloc_strdup(gsupc, unit_name); - OSMO_ASSERT(gsupc->unit_name); - - /* a NULL oapc_config will mark oap_state disabled. */ - rc = osmo_oap_client_init(oapc_config, &gsupc->oap_state); - if (rc != 0) - goto failed; - - gsupc->link = ipa_client_conn_create(gsupc, - /* no e1inp */ NULL, - 0, - ip_addr, tcp_port, - gsup_client_updown_cb, - gsup_client_read_cb, - /* default write_cb */ NULL, - gsupc); - if (!gsupc->link) - goto failed; - - osmo_timer_setup(&gsupc->connect_timer, connect_timer_cb, gsupc); - - rc = gsup_client_connect(gsupc); - - if (rc < 0) - goto failed; - - gsupc->read_cb = read_cb; - - return gsupc; - -failed: - gsup_client_destroy(gsupc); - return NULL; -} - -void gsup_client_destroy(struct gsup_client *gsupc) -{ - osmo_timer_del(&gsupc->connect_timer); - osmo_timer_del(&gsupc->ping_timer); - - if (gsupc->link) { - ipa_client_conn_close(gsupc->link); - ipa_client_conn_destroy(gsupc->link); - gsupc->link = NULL; - } - talloc_free(gsupc); -} - -int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) -{ - if (!gsupc || !gsupc->is_connected) { - LOGP(DLGSUP, LOGL_ERROR, "GSUP not connected, unable to send %s\n", msgb_hexdump(msg)); - msgb_free(msg); - return -ENOTCONN; - } - - client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg); - - return 0; -} - -struct msgb *gsup_client_msgb_alloc(void) -{ - return msgb_alloc_headroom(4000, 64, __func__); -} diff --git a/src/libgsupclient/gsup_test_client.c b/src/libgsupclient/gsup_test_client.c deleted file mode 100644 index 0ebcd4a3c..000000000 --- a/src/libgsupclient/gsup_test_client.c +++ /dev/null @@ -1,321 +0,0 @@ -#include <string.h> -#include <stdio.h> -#include <errno.h> -#include <signal.h> - -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/msgb.h> -#include <osmocom/core/select.h> -#include <osmocom/core/application.h> -#include <osmocom/core/utils.h> -#include <osmocom/core/logging.h> -#include <osmocom/gsm/gsup.h> - -#include <osmocom/msc/gsup_client.h> - -static struct gsup_client *g_gc; - - -/*********************************************************************** - * IMSI Operation - ***********************************************************************/ -static LLIST_HEAD(g_imsi_ops); - -struct imsi_op_stats { - uint32_t num_alloc; - uint32_t num_released; - uint32_t num_rx_success; - uint32_t num_rx_error; - uint32_t num_timeout; -}; - -enum imsi_op_type { - IMSI_OP_SAI, - IMSI_OP_LU, - IMSI_OP_ISD, - _NUM_IMSI_OP -}; - -static const struct value_string imsi_op_names[] = { - { IMSI_OP_SAI, "SAI" }, - { IMSI_OP_LU, "LU" }, - { IMSI_OP_ISD, "ISD" }, - { 0, NULL } -}; - -static struct imsi_op_stats imsi_op_stats[_NUM_IMSI_OP]; - -struct imsi_op { - struct llist_head list; - char imsi[17]; - enum imsi_op_type type; - struct osmo_timer_list timer; -}; - -static struct imsi_op *imsi_op_find(const char *imsi, - enum imsi_op_type type) -{ - struct imsi_op *io; - - llist_for_each_entry(io, &g_imsi_ops, list) { - if (!strcmp(io->imsi, imsi) && io->type == type) - return io; - } - return NULL; -} - -static void imsi_op_timer_cb(void *data); - -static struct imsi_op *imsi_op_alloc(void *ctx, const char *imsi, - enum imsi_op_type type) -{ - struct imsi_op *io; - - if (imsi_op_find(imsi, type)) - return NULL; - - io = talloc_zero(ctx, struct imsi_op); - OSMO_STRLCPY_ARRAY(io->imsi, imsi); - io->type = type; - osmo_timer_setup(&io->timer, imsi_op_timer_cb, io); - llist_add(&io->list, &g_imsi_ops); - imsi_op_stats[type].num_alloc++; - - return io; -} - -static void imsi_op_release(struct imsi_op *io) -{ - osmo_timer_del(&io->timer); - llist_del(&io->list); - imsi_op_stats[io->type].num_released++; - talloc_free(io); -} - -static void imsi_op_timer_cb(void *data) -{ - struct imsi_op *io = data; - printf("%s: Timer expiration\n", io->imsi); - imsi_op_stats[io->type].num_timeout++; - imsi_op_release(io); -} - -/* allocate + generate + send Send-Auth-Info */ -static int req_auth_info(const char *imsi) -{ - struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_SAI); - struct osmo_gsup_message gsup = {0}; - struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); - int rc; - - OSMO_STRLCPY_ARRAY(gsup.imsi, io->imsi); - gsup.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST; - - rc = osmo_gsup_encode(msg, &gsup); - if (rc < 0) { - printf("%s: encoding failure (%s)\n", imsi, strerror(-rc)); - return rc; - } - - return gsup_client_send(g_gc, msg); -} - -/* allocate + generate + send Send-Auth-Info */ -static int req_loc_upd(const char *imsi) -{ - struct imsi_op *io = imsi_op_alloc(g_gc, imsi, IMSI_OP_LU); - struct osmo_gsup_message gsup = {0}; - struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); - int rc; - - OSMO_STRLCPY_ARRAY(gsup.imsi, io->imsi); - gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST; - - rc = osmo_gsup_encode(msg, &gsup); - if (rc < 0) { - printf("%s: encoding failure (%s)\n", imsi, strerror(-rc)); - return rc; - } - - return gsup_client_send(g_gc, msg); -} - -static int resp_isd(struct imsi_op *io) -{ - struct osmo_gsup_message gsup = {0}; - struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); - int rc; - - OSMO_STRLCPY_ARRAY(gsup.imsi, io->imsi); - gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_RESULT; - - rc = osmo_gsup_encode(msg, &gsup); - if (rc < 0) { - printf("%s: encoding failure (%s)\n", io->imsi, strerror(-rc)); - return rc; - } - - imsi_op_release(io); - - return gsup_client_send(g_gc, msg); -} - -/* receive an incoming GSUP message */ -static void imsi_op_rx_gsup(struct imsi_op *io, const struct osmo_gsup_message *gsup) -{ - int is_error = 0, rc; - - if (OSMO_GSUP_IS_MSGT_ERROR(gsup->message_type)) { - imsi_op_stats[io->type].num_rx_error++; - is_error = 1; - } else - imsi_op_stats[io->type].num_rx_success++; - - switch (io->type) { - case IMSI_OP_SAI: - printf("%s; SAI Response%s\n", io->imsi, is_error ? ": ERROR" : ""); - /* now that we have auth tuples, request LU */ - rc = req_loc_upd(io->imsi); - if (rc < 0) - printf("Failed to request Location Update for %s\n", io->imsi); - imsi_op_release(io); - break; - case IMSI_OP_LU: - printf("%s; LU Response%s\n", io->imsi, is_error ? ": ERROR" : ""); - imsi_op_release(io); - break; - case IMSI_OP_ISD: - printf("%s; ISD Request%s\n", io->imsi, is_error ? ": ERROR" : ""); - rc = resp_isd(io); - if (rc < 0) - printf("Failed to insert subscriber data for %s\n", io->imsi); - break; - default: - printf("%s: Unknown\n", io->imsi); - imsi_op_release(io); - break; - } -} - -static int op_type_by_gsup_msgt(enum osmo_gsup_message_type msg_type) -{ - switch (msg_type) { - case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT: - case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR: - return IMSI_OP_SAI; - case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT: - case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR: - return IMSI_OP_LU; - case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST: - return IMSI_OP_ISD; - default: - printf("Unknown GSUP msg_type %u\n", msg_type); - return -1; - } -} - -static int gsupc_read_cb(struct gsup_client *gsupc, struct msgb *msg) -{ - struct osmo_gsup_message gsup_msg = {0}; - struct imsi_op *io = NULL; - int rc; - - DEBUGP(DLGSUP, "Rx GSUP %s\n", msgb_hexdump(msg)); - - rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup_msg); - if (rc < 0) - return rc; - - if (!gsup_msg.imsi[0]) - return -1; - - rc = op_type_by_gsup_msgt(gsup_msg.message_type); - if (rc < 0) - return rc; - - switch (rc) { - case IMSI_OP_SAI: - case IMSI_OP_LU: - io = imsi_op_find(gsup_msg.imsi, rc); - break; - case IMSI_OP_ISD: - /* ISD is an inbound transaction */ - io = imsi_op_alloc(g_gc, gsup_msg.imsi, IMSI_OP_ISD); - break; - } - if (!io) - return -1; - - imsi_op_rx_gsup(io, &gsup_msg); - msgb_free(msg); - - return 0; -} - -static void print_report(void) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(imsi_op_stats); i++) { - struct imsi_op_stats *st = &imsi_op_stats[i]; - const char *name = get_value_string(imsi_op_names, i); - printf("%s: %u alloc, %u released, %u success, %u error , %u tout\n", - name, st->num_alloc, st->num_released, st->num_rx_success, - st->num_rx_error, st->num_timeout); - } -} - -static void sig_cb(int sig) -{ - switch (sig) { - case SIGINT: - print_report(); - exit(0); - break; - } -} - -/* default categories */ -static struct log_info_cat default_categories[] = { -}; - -static const struct log_info gsup_test_client_log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - -int main(int argc, char **argv) -{ - unsigned long long i; - char *server_host = "127.0.0.1"; - uint16_t server_port = OSMO_GSUP_PORT; - void *ctx = talloc_named_const(NULL, 0, "gsup_test_client"); - - osmo_init_logging2(ctx, &gsup_test_client_log_info); - - g_gc = gsup_client_create(ctx, "GSUPTEST", server_host, server_port, - gsupc_read_cb, NULL); - - - signal(SIGINT, sig_cb); - - for (i = 0; i < 10000; i++) { - unsigned long long imsi = 901790000000000 + i; - char imsi_buf[17] = { 0 }; - int rc; - - snprintf(imsi_buf, sizeof(imsi_buf), "%015llu", imsi); - rc = req_auth_info(imsi_buf); - if (rc < 0) - printf("Failed to request Auth Info for %s\n", imsi_buf); - - osmo_select_main(0); - } - - while (1) { - osmo_select_main(0); - } - - print_report(); - exit(0); -} diff --git a/src/libmsc/Makefile.am b/src/libmsc/Makefile.am index a2560ea21..90bbbf837 100644 --- a/src/libmsc/Makefile.am +++ b/src/libmsc/Makefile.am @@ -15,6 +15,7 @@ AM_CFLAGS = \ $(LIBOSMOSIGTRAN_CFLAGS) \ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOMGCPCLIENT_CFLAGS) \ + $(LIBOSMOGSUPCLIENT_CFLAGS) \ $(LIBOSMORANAP_CFLAGS) \ $(NULL) diff --git a/src/libmsc/gsm_09_11.c b/src/libmsc/gsm_09_11.c index 01389afb7..b863ce87d 100644 --- a/src/libmsc/gsm_09_11.c +++ b/src/libmsc/gsm_09_11.c @@ -46,7 +46,7 @@ #include <osmocom/msc/vlr.h> #include <osmocom/msc/gsm_04_08.h> #include <osmocom/msc/transaction.h> -#include <osmocom/msc/gsup_client.h> +#include <osmocom/gsupclient/gsup_client.h> #include <osmocom/msc/msc_ifaces.h> /* FIXME: choose a proper range */ @@ -168,7 +168,7 @@ int gsm0911_rcv_nc_ss(struct gsm_subscriber_connection *conn, struct msgb *msg) OSMO_STRLCPY_ARRAY(gsup_msg.imsi, conn->vsub->imsi); /* Allocate GSUP message buffer */ - gsup_msgb = gsup_client_msgb_alloc(); + gsup_msgb = osmo_gsup_client_msgb_alloc(); if (!gsup_msgb) { LOGP(DMM, LOGL_ERROR, "Couldn't allocate GSUP message\n"); rc = -ENOMEM; @@ -183,7 +183,7 @@ int gsm0911_rcv_nc_ss(struct gsm_subscriber_connection *conn, struct msgb *msg) } /* Finally send */ - rc = gsup_client_send(conn->network->vlr->gsup_client, gsup_msgb); + rc = osmo_gsup_client_send(conn->network->vlr->gsup_client, gsup_msgb); if (rc) { LOGP(DMM, LOGL_ERROR, "Couldn't send GSUP message\n"); goto error; diff --git a/src/libvlr/Makefile.am b/src/libvlr/Makefile.am index 1408f6cd0..dcae1c7cf 100644 --- a/src/libvlr/Makefile.am +++ b/src/libvlr/Makefile.am @@ -5,6 +5,7 @@ AM_CFLAGS= \ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOMGCPCLIENT_CFLAGS) \ + $(LIBOSMOGSUPCLIENT_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ $(LIBOSMORANAP_CFLAGS) \ $(COVERAGE_CFLAGS) \ diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c index 2f7dc3052..bfaf3339c 100644 --- a/src/libvlr/vlr.c +++ b/src/libvlr/vlr.c @@ -28,7 +28,7 @@ #include <osmocom/gsm/apn.h> #include <osmocom/gsm/gsm48.h> #include <osmocom/msc/gsm_subscriber.h> -#include <osmocom/msc/gsup_client.h> +#include <osmocom/gsupclient/gsup_client.h> #include <osmocom/msc/vlr.h> #include <osmocom/msc/debug.h> @@ -156,7 +156,7 @@ struct vlr_subscr *_vlr_subscr_find_by_msisdn(struct vlr_instance *vlr, static int vlr_tx_gsup_message(const struct vlr_instance *vlr, const struct osmo_gsup_message *gsup_msg) { - struct msgb *msg = gsup_client_msgb_alloc(); + struct msgb *msg = osmo_gsup_client_msgb_alloc(); int rc = osmo_gsup_encode(msg, gsup_msg); if (rc < 0) { @@ -174,7 +174,7 @@ static int vlr_tx_gsup_message(const struct vlr_instance *vlr, LOGP(DVLR, LOGL_DEBUG, "GSUP tx: %s\n", osmo_hexdump_nospc(msg->data, msg->len)); - return gsup_client_send(vlr->gsup_client, msg); + return osmo_gsup_client_send(vlr->gsup_client, msg); } /* Transmit GSUP message for subscriber to HLR, using IMSI from subscriber */ @@ -974,7 +974,7 @@ static int vlr_subscr_handle_cancel_req(struct vlr_subscr *vsub, /* Incoming handler for GSUP from HLR. * Keep this function non-static for direct invocation by unit tests. */ -int vlr_gsupc_read_cb(struct gsup_client *gsupc, struct msgb *msg) +int vlr_gsupc_read_cb(struct osmo_gsup_client *gsupc, struct msgb *msg) { struct vlr_instance *vlr = (struct vlr_instance *) gsupc->data; struct vlr_subscr *vsub; @@ -1214,10 +1214,10 @@ int vlr_start(const char *gsup_unit_name, struct vlr_instance *vlr, { OSMO_ASSERT(vlr); - vlr->gsup_client = gsup_client_create(vlr, gsup_unit_name, - gsup_server_addr_str, - gsup_server_port, - &vlr_gsupc_read_cb, NULL); + vlr->gsup_client = osmo_gsup_client_create(vlr, gsup_unit_name, + gsup_server_addr_str, + gsup_server_port, + &vlr_gsupc_read_cb, NULL); if (!vlr->gsup_client) return -ENOMEM; vlr->gsup_client->data = vlr; diff --git a/src/osmo-msc/Makefile.am b/src/osmo-msc/Makefile.am index 42bc69fe0..bcc4ada01 100644 --- a/src/osmo-msc/Makefile.am +++ b/src/osmo-msc/Makefile.am @@ -17,6 +17,7 @@ AM_CFLAGS = \ $(LIBASN1C_CFLAGS) \ $(LIBOSMOSIGTRAN_CFLAGS) \ $(LIBOSMOMGCPCLIENT_CFLAGS) \ + $(LIBOSMOGSUPCLIENT_CFLAGS) \ $(NULL) AM_LDFLAGS = \ @@ -34,7 +35,6 @@ osmo_msc_SOURCES = \ osmo_msc_LDADD = \ $(top_builddir)/src/libmsc/libmsc.a \ $(top_builddir)/src/libvlr/libvlr.a \ - $(top_builddir)/src/libgsupclient/libgsupclient.a \ $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOCORE_LIBS) \ @@ -43,6 +43,7 @@ osmo_msc_LDADD = \ $(LIBSMPP34_LIBS) \ $(LIBOSMOSIGTRAN_LIBS) \ $(LIBOSMOMGCPCLIENT_LIBS) \ + $(LIBOSMOGSUPCLIENT_LIBS) \ -ldbi \ $(NULL) if BUILD_IU |