osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27462 )


Change subject: bsc_nat_sccp_inst: rename from bsc_nat_ss7_inst
......................................................................

bsc_nat_sccp_inst: rename from bsc_nat_ss7_inst

This name seems more fitting, since the code mostly interacts with the
sccp addr and scu contained in the struct.

Related: SYS#5560
Change-Id: Id0f965811eff0eb7b387d5ae2eec2451d6d8e415
---
M include/osmocom/bsc_nat/bsc_nat.h
M src/osmo-bsc-nat/bsc_nat.c
M src/osmo-bsc-nat/bsc_nat_fsm.c
3 files changed, 34 insertions(+), 34 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc-nat refs/changes/62/27462/1

diff --git a/include/osmocom/bsc_nat/bsc_nat.h 
b/include/osmocom/bsc_nat/bsc_nat.h
index 2031527..37568e8 100644
--- a/include/osmocom/bsc_nat/bsc_nat.h
+++ b/include/osmocom/bsc_nat/bsc_nat.h
@@ -22,7 +22,7 @@
 #include <osmocom/sigtran/sccp_sap.h>


-struct bsc_nat_ss7_inst {
+struct bsc_nat_sccp_inst {
        uint32_t ss7_id;
        struct osmo_sccp_addr local_sccp_addr;
        struct osmo_sccp_user *scu;
@@ -31,8 +31,8 @@
 struct bsc_nat {
        struct osmo_fsm_inst *fi;

-       struct bsc_nat_ss7_inst *cn;
-       struct bsc_nat_ss7_inst *ran;
+       struct bsc_nat_sccp_inst *cn;
+       struct bsc_nat_sccp_inst *ran;
 };

 struct bsc_nat *bsc_nat_alloc(void *tall_ctx);
diff --git a/src/osmo-bsc-nat/bsc_nat.c b/src/osmo-bsc-nat/bsc_nat.c
index adb32c4..f9867c1 100644
--- a/src/osmo-bsc-nat/bsc_nat.c
+++ b/src/osmo-bsc-nat/bsc_nat.c
@@ -31,13 +31,13 @@
        bsc_nat = talloc_zero(tall_ctx, struct bsc_nat);
        OSMO_ASSERT(bsc_nat);

-       bsc_nat->cn = talloc_zero(bsc_nat, struct bsc_nat_ss7_inst);
+       bsc_nat->cn = talloc_zero(bsc_nat, struct bsc_nat_sccp_inst);
        OSMO_ASSERT(bsc_nat->cn);
-       talloc_set_name_const(bsc_nat->cn, "struct bsc_nat_ss7_inst (CN)");
+       talloc_set_name_const(bsc_nat->cn, "struct bsc_nat_sccp_inst (CN)");

-       bsc_nat->ran = talloc_zero(bsc_nat, struct bsc_nat_ss7_inst);
+       bsc_nat->ran = talloc_zero(bsc_nat, struct bsc_nat_sccp_inst);
        OSMO_ASSERT(bsc_nat->ran);
-       talloc_set_name_const(bsc_nat->ran, "struct bsc_nat_ss7_inst (RAN)");
+       talloc_set_name_const(bsc_nat->ran, "struct bsc_nat_sccp_inst (RAN)");

        bsc_nat_fsm_alloc(bsc_nat);

diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c
index 1de3e0c..a35a704 100644
--- a/src/osmo-bsc-nat/bsc_nat_fsm.c
+++ b/src/osmo-bsc-nat/bsc_nat_fsm.c
@@ -39,13 +39,13 @@

 static char log_buf[255];

-#define LOG_SCCP(ss7_inst, peer_addr_in, level, fmt, args...) do { \
+#define LOG_SCCP(sccp_inst, peer_addr_in, level, fmt, args...) do { \
        if (peer_addr_in) \
                osmo_sccp_addr_to_str_buf(log_buf, sizeof(log_buf), NULL, 
peer_addr_in); \
        LOGP(DMAIN, level, "(%s%s%s) " fmt, \
             peer_addr_in ? log_buf : "", \
             peer_addr_in ? " from " : "", \
-            ss7_inst == g_bsc_nat->ran ? "RAN" : "CN", \
+            sccp_inst == g_bsc_nat->ran ? "RAN" : "CN", \
             ## args); \
 } while (0)

@@ -62,7 +62,7 @@
        BSC_NAT_FSM_EV_STOP,
 };

-static struct bsc_nat_ss7_inst *ss7_inst_dest(struct bsc_nat_ss7_inst *src)
+static struct bsc_nat_sccp_inst *sccp_inst_dest(struct bsc_nat_sccp_inst *src)
 {
        if (src == g_bsc_nat->cn)
                return g_bsc_nat->ran;
@@ -71,7 +71,7 @@

 /* For connection-oriented messages, figure out which side is not the BSCNAT,
  * either the called_addr or calling_addr. */
-static int sccp_sap_get_peer_addr_in(struct bsc_nat_ss7_inst *src, struct 
osmo_sccp_addr **peer_addr_in,
+static int sccp_sap_get_peer_addr_in(struct bsc_nat_sccp_inst *src, struct 
osmo_sccp_addr **peer_addr_in,
                                     struct osmo_sccp_addr *called_addr, struct 
osmo_sccp_addr *calling_addr)
 {
        if (osmo_sccp_addr_ri_cmp(&src->local_sccp_addr, called_addr) != 0) {
@@ -96,10 +96,10 @@

 /* Figure out who will receive the message.
  * For now this is simplified by assuming there is only one MSC, one BSC. */
-static int sccp_sap_get_peer_addr_out(struct bsc_nat_ss7_inst *src, struct 
osmo_sccp_addr *peer_addr_in,
+static int sccp_sap_get_peer_addr_out(struct bsc_nat_sccp_inst *src, struct 
osmo_sccp_addr *peer_addr_in,
                                      struct osmo_sccp_addr *peer_addr_out)
 {
-       struct bsc_nat_ss7_inst *dest = ss7_inst_dest(src);
+       struct bsc_nat_sccp_inst *dest = sccp_inst_dest(src);
        struct osmo_ss7_instance *dest_ss7 = 
osmo_ss7_instance_find(dest->ss7_id);

        OSMO_ASSERT(dest_ss7);
@@ -123,8 +123,8 @@
  * only one MSC, one BSC (not yet translating connection ids etc.). */
 static int sccp_sap_up(struct osmo_prim_hdr *oph, void *scu)
 {
-       struct bsc_nat_ss7_inst *src = osmo_sccp_user_get_priv(scu);
-       struct bsc_nat_ss7_inst *dest = ss7_inst_dest(src);
+       struct bsc_nat_sccp_inst *src = osmo_sccp_user_get_priv(scu);
+       struct bsc_nat_sccp_inst *dest = sccp_inst_dest(src);
        struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
        struct osmo_sccp_addr *peer_addr_in;
        struct osmo_sccp_addr peer_addr_out;
@@ -235,7 +235,7 @@
        return rc;
 }

-static int ss7_inst_init(struct bsc_nat_ss7_inst *inst, const char *name, 
const char *default_pc_str,
+static int sccp_inst_init(struct bsc_nat_sccp_inst *sccp_inst, const char 
*name, const char *default_pc_str,
                         enum osmo_sccp_ssn ssn)
 {
        int default_pc;
@@ -244,49 +244,49 @@
        default_pc = osmo_ss7_pointcode_parse(NULL, default_pc_str);
        OSMO_ASSERT(default_pc >= 0);

-       sccp = osmo_sccp_simple_client_on_ss7_id(inst, inst->ss7_id, name, 
default_pc, OSMO_SS7_ASP_PROT_M3UA, 0, NULL,
-                                                0, NULL);
+       sccp = osmo_sccp_simple_client_on_ss7_id(sccp_inst, sccp_inst->ss7_id, 
name, default_pc, OSMO_SS7_ASP_PROT_M3UA,
+                                                0, NULL, 0, NULL);
        if (!sccp) {
                LOGP(DMAIN, LOGL_ERROR, "%s: failed to request sccp client 
instance for sccp user\n", name);
                return -1;
        }

-       osmo_sccp_local_addr_by_instance(&inst->local_sccp_addr, sccp, ssn);
+       osmo_sccp_local_addr_by_instance(&sccp_inst->local_sccp_addr, sccp, 
ssn);

-       inst->scu = osmo_sccp_user_bind(sccp, name, sccp_sap_up, ssn);
-       if (!inst->scu) {
+       sccp_inst->scu = osmo_sccp_user_bind(sccp, name, sccp_sap_up, ssn);
+       if (!sccp_inst->scu) {
                LOGP(DMAIN, LOGL_ERROR, "%s: failed to bind sccp user\n", name);
                return -2;
        }

-       osmo_sccp_user_set_priv(inst->scu, inst);
+       osmo_sccp_user_set_priv(sccp_inst->scu, sccp_inst);
        return 0;
 }

-static void ss7_inst_free(struct bsc_nat_ss7_inst *inst)
+static void sccp_inst_free(struct bsc_nat_sccp_inst *sccp_inst)
 {
-       if (inst->scu) {
-               osmo_sccp_user_unbind(inst->scu);
-               inst->scu = NULL;
+       if (sccp_inst->scu) {
+               osmo_sccp_user_unbind(sccp_inst->scu);
+               sccp_inst->scu = NULL;
        }

-       struct osmo_ss7_instance *ss7 = osmo_ss7_instance_find(inst->ss7_id);
-       if (ss7)
-               osmo_ss7_instance_destroy(ss7);
+       struct osmo_ss7_instance *ss7_inst = 
osmo_ss7_instance_find(sccp_inst->ss7_id);
+       if (ss7_inst)
+               osmo_ss7_instance_destroy(ss7_inst);

-       talloc_free(inst);
+       talloc_free(sccp_inst);
 }

 static void st_starting_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
        struct bsc_nat *bsc_nat = (struct bsc_nat *)fi->priv;

-       if (ss7_inst_init(bsc_nat->cn, "OsmoBSCNAT-CN", DEFAULT_PC_CN, 
OSMO_SCCP_SSN_BSSAP) < 0) {
+       if (sccp_inst_init(bsc_nat->cn, "OsmoBSCNAT-CN", DEFAULT_PC_CN, 
OSMO_SCCP_SSN_BSSAP) < 0) {
                osmo_fsm_inst_state_chg(fi, BSC_NAT_FSM_ST_STOPPED, 0, 0);
                return;
        }

-       if (ss7_inst_init(bsc_nat->ran, "OsmoBSCNAT-RAN", DEFAULT_PC_RAN, 
OSMO_SCCP_SSN_BSSAP) < 0) {
+       if (sccp_inst_init(bsc_nat->ran, "OsmoBSCNAT-RAN", DEFAULT_PC_RAN, 
OSMO_SCCP_SSN_BSSAP) < 0) {
                osmo_fsm_inst_state_chg(fi, BSC_NAT_FSM_ST_STOPPED, 0, 0);
                return;
        }
@@ -309,10 +309,10 @@
 {
        struct bsc_nat *bsc_nat = (struct bsc_nat *)fi->priv;

-       ss7_inst_free(bsc_nat->cn);
+       sccp_inst_free(bsc_nat->cn);
        bsc_nat->cn = NULL;

-       ss7_inst_free(bsc_nat->ran);
+       sccp_inst_free(bsc_nat->ran);
        bsc_nat->ran = NULL;
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27462
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: Id0f965811eff0eb7b387d5ae2eec2451d6d8e415
Gerrit-Change-Number: 27462
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-MessageType: newchange

Reply via email to