laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/32298 )


Change subject: SS7: Support secondary point codes
......................................................................

SS7: Support secondary point codes

osmo_ss7 so far only supported a single local point code per cs7
instance: The primary point code.  Let's add support for a secondary
point code, just like it is the case in Cisco ITP.

Change-Id: I3c4c0d89d2a0ea36aa5df0887225d99a16b810f0
---
M TODO-RELEASE
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
4 files changed, 42 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/98/32298/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 05e12a6..a021219 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library       what            description / commit summary line
 libosmocore    >1.8.0          uses new osmo_prim_operation_name()
+libosmo-sigtran API change     struct osmo_ss7_instance has new member 
'secondary_pc'
diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index cd1779c..0cb7a80 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -96,7 +96,7 @@
                char *name;
                char *description;
                uint32_t primary_pc;
-               /* secondary PCs */
+               uint32_t secondary_pc;
                /* capability PCs */
                uint8_t network_indicator;
                struct osmo_ss7_pc_fmt pc_fmt;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 3dc0d51..0be23e9 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -382,6 +382,7 @@
                return NULL;

        inst->cfg.primary_pc = OSMO_SS7_PC_INVALID;
+       inst->cfg.secondary_pc = OSMO_SS7_PC_INVALID;

        inst->cfg.id = id;
        LOGSS7(inst, LOGL_INFO, "Creating SS7 Instance\n");
@@ -2314,7 +2315,9 @@
        OSMO_ASSERT(ss7_initialized);
        if (osmo_ss7_pc_is_valid(inst->cfg.primary_pc) && pc == 
inst->cfg.primary_pc)
                return true;
-       /* FIXME: Secondary and Capability Point Codes */
+       if (osmo_ss7_pc_is_valid(inst->cfg.secondary_pc) && pc == 
inst->cfg.secondary_pc)
+               return true;
+       /* FIXME: Capability Point Codes */
        return false;
 }

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 7dffe02..acded2b 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -205,7 +205,23 @@
        return CMD_SUCCESS;
 }

-/* TODO: cs7 secondary-pc */
+DEFUN_ATTR(cs7_secondary_pc, cs7_secondary_pc_cmd,
+          "secondary-pc POINT_CODE",
+          "Configure the local Secondary Point Code\n"
+          "Point Code\n",
+          CMD_ATTR_IMMEDIATE)
+{
+       struct osmo_ss7_instance *inst = vty->index;
+       int pc = osmo_ss7_pointcode_parse(inst, argv[0]);
+       if (pc < 0 || !osmo_ss7_pc_is_valid((uint32_t)pc)) {
+               vty_out(vty, "Invalid point code (%s)%s", argv[0], VTY_NEWLINE);
+               return CMD_WARNING;
+       }
+
+       inst->cfg.secondary_pc = pc;
+       return CMD_SUCCESS;
+}
+
 /* TODO: cs7 capability-pc */
 DEFUN_ATTR(cs7_permit_dyn_rkm, cs7_permit_dyn_rkm_cmd,
           "xua rkm routing-key-allocation (static-only|dynamic-permitted)",
@@ -1929,6 +1945,11 @@
                        osmo_ss7_pointcode_print(inst, inst->cfg.primary_pc),
                        VTY_NEWLINE);

+       if (osmo_ss7_pc_is_valid(inst->cfg.secondary_pc)) {
+               vty_out(vty, " secondary-pc %s%s",
+                       osmo_ss7_pointcode_print(inst, inst->cfg.secondary_pc), 
VTY_NEWLINE);
+       }
+
        if (inst->cfg.permit_dyn_rkm_alloc)
                vty_out(vty, " xua rkm routing-key-allocation 
dynamic-permitted%s", VTY_NEWLINE);

@@ -2087,6 +2108,7 @@
        install_lib_element(L_CS7_NODE, &cfg_description_cmd);
        install_lib_element(L_CS7_NODE, &cs7_net_ind_cmd);
        install_lib_element(L_CS7_NODE, &cs7_point_code_cmd);
+       install_lib_element(L_CS7_NODE, &cs7_secondary_pc_cmd);
        install_lib_element(L_CS7_NODE, &cs7_pc_format_cmd);
        install_lib_element(L_CS7_NODE, &cs7_pc_format_def_cmd);
        install_lib_element(L_CS7_NODE, &cs7_pc_delimiter_cmd);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/32298
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I3c4c0d89d2a0ea36aa5df0887225d99a16b810f0
Gerrit-Change-Number: 32298
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to