gprs_gsup_client*: remove the gprs_ prefix
Make sure everything is named gsup_client_ / GSUP_CLIENT_.
Rename static gsup_client_send() to client_send() to avoid clash with public
gprs_gsup_client_send() being renamed to gsup_client_send().
This is in preparation for moving gsup to libcommon, which is in turn
preparation for libvlr. libvlr and osmo-sgsn will use the same GSUP client
code. A number of patches will follow up on this, also for the the OAP client.
Related: OS#1592
Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51
diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c
index 41b88ad..cd94a8a 100644
--- a/openbsc/src/gprs/gprs_gsup_client.c
+++ b/openbsc/src/gprs/gprs_gsup_client.c
@@ -35,11 +35,11 @@
extern void *tall_bsc_ctx;
-static void start_test_procedure(struct gprs_gsup_client *gsupc);
+static void start_test_procedure(struct gsup_client *gsupc);
-static void gsup_client_send_ping(struct gprs_gsup_client *gsupc)
+static void gsup_client_send_ping(struct gsup_client *gsupc)
{
- struct msgb *msg = gprs_gsup_msgb_alloc();
+ struct msgb *msg = gsup_client_msgb_alloc();
msg->l2h = msgb_put(msg, 1);
msg->l2h[0] = IPAC_MSGT_PING;
@@ -47,7 +47,7 @@
ipa_client_conn_send(gsupc->link, msg);
}
-static int gsup_client_connect(struct gprs_gsup_client *gsupc)
+static int gsup_client_connect(struct gsup_client *gsupc)
{
int rc;
@@ -84,7 +84,8 @@
rc == -EINVAL)
return rc;
- osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0);
+ osmo_timer_schedule(&gsupc->connect_timer,
+ GSUP_CLIENT_RECONNECT_INTERVAL, 0);
LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n",
gsupc->link->addr, gsupc->link->port);
@@ -94,7 +95,7 @@
static void connect_timer_cb(void *gsupc_)
{
- struct gprs_gsup_client *gsupc = gsupc_;
+ struct gsup_client *gsupc = gsupc_;
if (gsupc->is_connected)
return;
@@ -102,7 +103,8 @@
gsup_client_connect(gsupc);
}
-static void gsup_client_send(struct gprs_gsup_client *gsupc, int proto_ext, struct msgb *msg_tx)
+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);
@@ -110,7 +112,7 @@
/* msg_tx is now queued and will be freed. */
}
-static void gsup_client_oap_register(struct gprs_gsup_client *gsupc)
+static void gsup_client_oap_register(struct gsup_client *gsupc)
{
struct msgb *msg_tx;
int rc;
@@ -121,12 +123,12 @@
return;
}
- gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx);
+ client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx);
}
static void gsup_client_updown_cb(struct ipa_client_conn *link, int up)
{
- struct gprs_gsup_client *gsupc = link->data;
+ struct gsup_client *gsupc = link->data;
LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n",
link->addr, link->port, up ? "UP" : "DOWN");
@@ -144,11 +146,11 @@
osmo_timer_del(&gsupc->ping_timer);
osmo_timer_schedule(&gsupc->connect_timer,
- GPRS_GSUP_RECONNECT_INTERVAL, 0);
+ GSUP_CLIENT_RECONNECT_INTERVAL, 0);
}
}
-static int gsup_client_oap_handle(struct gprs_gsup_client *gsupc, struct msgb *msg_rx)
+static int gsup_client_oap_handle(struct gsup_client *gsupc, struct msgb *msg_rx)
{
int rc;
struct msgb *msg_tx;
@@ -159,7 +161,7 @@
return rc;
if (msg_tx)
- gsup_client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx);
+ client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx);
return 0;
}
@@ -168,7 +170,7 @@
{
struct ipaccess_head *hh = (struct ipaccess_head *) msg->data;
struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg);
- struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data;
+ struct gsup_client *gsupc = (struct gsup_client *)link->data;
int rc;
static struct ipaccess_unit ipa_dev = {
.unit_name = "SGSN"
@@ -231,7 +233,7 @@
static void ping_timer_cb(void *gsupc_)
{
- struct gprs_gsup_client *gsupc = gsupc_;
+ struct gsup_client *gsupc = gsupc_;
LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n",
gsupc->is_connected ? "connected" : "not connected",
@@ -249,26 +251,26 @@
gsup_client_connect(gsupc);
}
-static void start_test_procedure(struct gprs_gsup_client *gsupc)
+static void start_test_procedure(struct gsup_client *gsupc)
{
gsupc->ping_timer.data = gsupc;
gsupc->ping_timer.cb = &ping_timer_cb;
gsupc->got_ipa_pong = 0;
- osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0);
+ osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0);
LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n");
gsup_client_send_ping(gsupc);
}
-struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr,
- unsigned int tcp_port,
- gprs_gsup_read_cb_t read_cb,
- struct oap_config *oap_config)
+struct gsup_client *gsup_client_create(const char *ip_addr,
+ unsigned int tcp_port,
+ gsup_client_read_cb_t read_cb,
+ struct oap_config *oap_config)
{
- struct gprs_gsup_client *gsupc;
+ struct gsup_client *gsupc;
int rc;
- gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client);
+ gsupc = talloc_zero(tall_bsc_ctx, struct gsup_client);
OSMO_ASSERT(gsupc);
rc = oap_init(oap_config, &gsupc->oap_state);
@@ -299,11 +301,11 @@
return gsupc;
failed:
- gprs_gsup_client_destroy(gsupc);
+ gsup_client_destroy(gsupc);
return NULL;
}
-void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc)
+void gsup_client_destroy(struct gsup_client *gsupc)
{
osmo_timer_del(&gsupc->connect_timer);
osmo_timer_del(&gsupc->ping_timer);
@@ -316,7 +318,7 @@
talloc_free(gsupc);
}
-int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg)
+int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg)
{
if (!gsupc) {
msgb_free(msg);
@@ -328,12 +330,12 @@
return -EAGAIN;
}
- gsup_client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg);
+ client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg);
return 0;
}
-struct msgb *gprs_gsup_msgb_alloc(void)
+struct msgb *gsup_client_msgb_alloc(void)
{
return msgb_alloc_headroom(4000, 64, __func__);
}
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 658ce04..100fd91 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -45,7 +45,7 @@
extern void *tall_bsc_ctx;
-static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg);
+static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg);
/* TODO: Some functions are specific to the SGSN, but this file is more general
* (it has gprs_* name). Either move these functions elsewhere, split them and
@@ -62,7 +62,7 @@
addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr);
- sgi->gsup_client = gprs_gsup_client_create(
+ sgi->gsup_client = gsup_client_create(
addr_str, sgi->cfg.gsup_server_port,
&gsup_read_cb,
&sgi->cfg.oap);
@@ -73,7 +73,7 @@
return 1;
}
-static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg)
+static int gsup_read_cb(struct gsup_client *gsupc, struct msgb *msg)
{
int rc;
@@ -161,7 +161,7 @@
static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr,
struct osmo_gsup_message *gsup_msg)
{
- struct msgb *msg = gprs_gsup_msgb_alloc();
+ struct msgb *msg = gsup_client_msgb_alloc();
if (strlen(gsup_msg->imsi) == 0 && subscr)
strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1);
@@ -176,7 +176,7 @@
return -ENOTSUP;
}
- return gprs_gsup_client_send(sgsn->gsup_client, msg);
+ return gsup_client_send(sgsn->gsup_client, msg);
}
static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr,
diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c
index 5f123b8..901b870 100644
--- a/openbsc/src/gprs/gsup_test_client.c
+++ b/openbsc/src/gprs/gsup_test_client.c
@@ -12,7 +12,7 @@
#include <openbsc/gprs_gsup_client.h>
#include <openbsc/debug.h>
-static struct gprs_gsup_client *g_gc;
+static struct gsup_client *g_gc;
/***********************************************************************
@@ -113,7 +113,7 @@
osmo_gsup_encode(msg, &gsup);
- return gprs_gsup_client_send(g_gc, msg);
+ return gsup_client_send(g_gc, msg);
}
/* allocate + generate + send Send-Auth-Info */
@@ -128,7 +128,7 @@
osmo_gsup_encode(msg, &gsup);
- return gprs_gsup_client_send(g_gc, msg);
+ return gsup_client_send(g_gc, msg);
}
int resp_isd(struct imsi_op *io)
@@ -143,7 +143,7 @@
imsi_op_release(io);
- return gprs_gsup_client_send(g_gc, msg);
+ return gsup_client_send(g_gc, msg);
}
/* receive an incoming GSUP message */
@@ -196,7 +196,7 @@
}
}
-static int gsupc_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg)
+static int gsupc_read_cb(struct gsup_client *gsupc, struct msgb *msg)
{
struct osmo_gsup_message gsup_msg = {0};
struct imsi_op *io;
@@ -281,8 +281,8 @@
osmo_init_logging(&gprs_log_info);
- g_gc = gprs_gsup_client_create(server_host, server_port,
- gsupc_read_cb, NULL);
+ g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb,
+ NULL);
signal(SIGINT, sig_cb);