Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/10110


Change subject: gsup_client: rename gsup_client_* to osmo_gsup_client_*
......................................................................

gsup_client: rename gsup_client_* to osmo_gsup_client_*

As we're moving this to a common/shared library now, we need to use
the osmo_ namespace prefix for symbol names, struct/type names and
constants.

Change-Id: I294f8f96af4c5daa2b128962534426e04909290e
---
M include/osmocom/gsupclient/gsup_client.h
M src/gsupclient/gsup_client.c
2 files changed, 42 insertions(+), 43 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/10/10110/1

diff --git a/include/osmocom/gsupclient/gsup_client.h 
b/include/osmocom/gsupclient/gsup_client.h
index bc0f35a..e8be11f 100644
--- a/include/osmocom/gsupclient/gsup_client.h
+++ b/include/osmocom/gsupclient/gsup_client.h
@@ -27,22 +27,21 @@
 /* a loss of GSUP between MSC and HLR is considered quite serious, let's try 
to recover as quickly as
  * possible.  Even one new connection attempt per second should be quite 
acceptable until the link is
  * re-established */
-#define GSUP_CLIENT_RECONNECT_INTERVAL 1
-#define GSUP_CLIENT_PING_INTERVAL 20
+#define OSMO_GSUP_CLIENT_RECONNECT_INTERVAL 1
+#define OSMO_GSUP_CLIENT_PING_INTERVAL 20

 struct msgb;
 struct ipa_client_conn;
-struct gsup_client;
+struct osmo_gsup_client;

 /* Expects message in msg->l2h */
-typedef int (*gsup_client_read_cb_t)(struct gsup_client *gsupc,
-                                    struct msgb *msg);
+typedef int (*osmo_gsup_client_read_cb_t)(struct osmo_gsup_client *gsupc, 
struct msgb *msg);

-struct gsup_client {
+struct osmo_gsup_client {
        const char *unit_name;

        struct ipa_client_conn *link;
-       gsup_client_read_cb_t read_cb;
+       osmo_gsup_client_read_cb_t read_cb;
        void *data;

        struct oap_client_state oap_state;
@@ -53,14 +52,14 @@
        int got_ipa_pong;
 };
 
-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 oap_client_config *oapc_config);
+struct osmo_gsup_client *osmo_gsup_client_create(void *talloc_ctx,
+                                                const char *unit_name,
+                                                const char *ip_addr,
+                                                unsigned int tcp_port,
+                                                osmo_gsup_client_read_cb_t 
read_cb,
+                                                struct oap_client_config 
*oapc_config);

-void gsup_client_destroy(struct gsup_client *gsupc);
-int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg);
-struct msgb *gsup_client_msgb_alloc(void);
+void osmo_gsup_client_destroy(struct osmo_gsup_client *gsupc);
+int osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg);
+struct msgb *osmo_gsup_client_msgb_alloc(void);

diff --git a/src/gsupclient/gsup_client.c b/src/gsupclient/gsup_client.c
index 7c2bb49..b4b138b 100644
--- a/src/gsupclient/gsup_client.c
+++ b/src/gsupclient/gsup_client.c
@@ -31,11 +31,11 @@
 #include <errno.h>
 #include <string.h>

-static void start_test_procedure(struct gsup_client *gsupc);
+static void start_test_procedure(struct osmo_gsup_client *gsupc);

-static void gsup_client_send_ping(struct gsup_client *gsupc)
+static void gsup_client_send_ping(struct osmo_gsup_client *gsupc)
 {
-       struct msgb *msg = gsup_client_msgb_alloc();
+       struct msgb *msg = osmo_gsup_client_msgb_alloc();

        msg->l2h = msgb_put(msg, 1);
        msg->l2h[0] = IPAC_MSGT_PING;
@@ -43,7 +43,7 @@
        ipa_client_conn_send(gsupc->link, msg);
 }

-static int gsup_client_connect(struct gsup_client *gsupc)
+static int gsup_client_connect(struct osmo_gsup_client *gsupc)
 {
        int rc;

@@ -81,7 +81,7 @@
                return rc;

        osmo_timer_schedule(&gsupc->connect_timer,
-                           GSUP_CLIENT_RECONNECT_INTERVAL, 0);
+                           OSMO_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);
@@ -91,7 +91,7 @@

 static void connect_timer_cb(void *gsupc_)
 {
-       struct gsup_client *gsupc = gsupc_;
+       struct osmo_gsup_client *gsupc = gsupc_;

        if (gsupc->is_connected)
                return;
@@ -99,7 +99,7 @@
        gsup_client_connect(gsupc);
 }

-static void client_send(struct gsup_client *gsupc, int proto_ext,
+static void client_send(struct osmo_gsup_client *gsupc, int proto_ext,
                        struct msgb *msg_tx)
 {
        ipa_prepend_header_ext(msg_tx, proto_ext);
@@ -108,7 +108,7 @@
        /* msg_tx is now queued and will be freed. */
 }

-static void gsup_client_oap_register(struct gsup_client *gsupc)
+static void gsup_client_oap_register(struct osmo_gsup_client *gsupc)
 {
        struct msgb *msg_tx;
        int rc;
@@ -124,7 +124,7 @@

 static void gsup_client_updown_cb(struct ipa_client_conn *link, int up)
 {
-       struct gsup_client *gsupc = link->data;
+       struct osmo_gsup_client *gsupc = link->data;

        LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n",
                     link->addr, link->port, up ? "UP" : "DOWN");
@@ -142,11 +142,11 @@
                osmo_timer_del(&gsupc->ping_timer);

                osmo_timer_schedule(&gsupc->connect_timer,
-                                   GSUP_CLIENT_RECONNECT_INTERVAL, 0);
+                                   OSMO_GSUP_CLIENT_RECONNECT_INTERVAL, 0);
        }
 }

-static int gsup_client_oap_handle(struct gsup_client *gsupc, struct msgb 
*msg_rx)
+static int gsup_client_oap_handle(struct osmo_gsup_client *gsupc, struct msgb 
*msg_rx)
 {
        int rc;
        struct msgb *msg_tx;
@@ -167,7 +167,7 @@
 {
        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;
+       struct osmo_gsup_client *gsupc = (struct osmo_gsup_client *)link->data;
        int rc;
        struct ipaccess_unit ipa_dev = {
                /* see gsup_client_create() on const vs non-const */
@@ -233,7 +233,7 @@

 static void ping_timer_cb(void *gsupc_)
 {
-       struct gsup_client *gsupc = gsupc_;
+       struct osmo_gsup_client *gsupc = gsupc_;

        LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n",
             gsupc->is_connected ? "connected" : "not connected",
@@ -251,27 +251,27 @@
        gsup_client_connect(gsupc);
 }

-static void start_test_procedure(struct gsup_client *gsupc)
+static void start_test_procedure(struct osmo_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);
+       osmo_timer_schedule(&gsupc->ping_timer, OSMO_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 oap_client_config *oapc_config)
+struct osmo_gsup_client *osmo_gsup_client_create(void *talloc_ctx,
+                                                const char *unit_name,
+                                                const char *ip_addr,
+                                                unsigned int tcp_port,
+                                                osmo_gsup_client_read_cb_t 
read_cb,
+                                                struct oap_client_config 
*oapc_config)
 {
-       struct gsup_client *gsupc;
+       struct osmo_gsup_client *gsupc;
        int rc;

-       gsupc = talloc_zero(talloc_ctx, struct gsup_client);
+       gsupc = talloc_zero(talloc_ctx, struct osmo_gsup_client);
        OSMO_ASSERT(gsupc);

        /* struct ipaccess_unit has a non-const unit_name, so let's copy to be
@@ -308,11 +308,11 @@
        return gsupc;

 failed:
-       gsup_client_destroy(gsupc);
+       osmo_gsup_client_destroy(gsupc);
        return NULL;
 }

-void gsup_client_destroy(struct gsup_client *gsupc)
+void osmo_gsup_client_destroy(struct osmo_gsup_client *gsupc)
 {
        osmo_timer_del(&gsupc->connect_timer);
        osmo_timer_del(&gsupc->ping_timer);
@@ -325,7 +325,7 @@
        talloc_free(gsupc);
 }

-int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg)
+int osmo_gsup_client_send(struct osmo_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));
@@ -338,7 +338,7 @@
        return 0;
 }

-struct msgb *gsup_client_msgb_alloc(void)
+struct msgb *osmo_gsup_client_msgb_alloc(void)
 {
        return msgb_alloc_headroom(4000, 64, __func__);
 }

--
To view, visit https://gerrit.osmocom.org/10110
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I294f8f96af4c5daa2b128962534426e04909290e
Gerrit-Change-Number: 10110
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to