Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11709 )

Change subject: Make pointcode width function public
......................................................................

Make pointcode width function public

That's useful for external programs veryfying pointcode validity. For
example if used as part of BSS-related identity in GCR construction by
LCLS code we should be able to double.check that no significant bits off
pointcode are lost/ignored.

Change-Id: I5a9981dd2c1d78966c61a3f6b50c7c0d9b542caf
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
2 files changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index 414606a..a97e236 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -113,6 +113,8 @@

 struct osmo_sccp_instance *osmo_ss7_ensure_sccp(struct osmo_ss7_instance 
*inst);

+uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt);
+
 /***********************************************************************
  * MTP Users (Users of MTP, such as SCCP or ISUP)
  ***********************************************************************/
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index f97876c..73f8127 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -179,7 +179,7 @@
 }

 /* get the total width (in bits) of the point-codes in this ss7_instance */
-static unsigned int get_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
+uint8_t osmo_ss7_pc_width(const struct osmo_ss7_pc_fmt *pc_fmt)
 {
        return pc_fmt->component_len[0] + pc_fmt->component_len[1] + 
pc_fmt->component_len[2];
 }
@@ -189,7 +189,7 @@
 static unsigned int get_pc_comp_shift(const struct osmo_ss7_pc_fmt *pc_fmt,
                                        unsigned int comp_num)
 {
-       uint32_t pc_width = get_pc_width(pc_fmt);
+       uint32_t pc_width = osmo_ss7_pc_width(pc_fmt);
        switch (comp_num) {
        case 0:
                return pc_width - pc_fmt->component_len[0];
@@ -287,7 +287,7 @@

 int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const 
char *in)
 {
-       unsigned int width = get_pc_width(inst ? &inst->cfg.pc_fmt : 
&default_pc_fmt);
+       unsigned int width = osmo_ss7_pc_width(inst ? &inst->cfg.pc_fmt : 
&default_pc_fmt);

        if (in[0] == '/') {
                /* parse mask by length */

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5a9981dd2c1d78966c61a3f6b50c7c0d9b542caf
Gerrit-Change-Number: 11709
Gerrit-PatchSet: 4
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to