Max has uploaded this change for review. ( https://gerrit.osmocom.org/11709
Change subject: Make pointcode width function public ...................................................................... Make pointcode width function public Adjust function caller types accordingly. Change-Id: I5a9981dd2c1d78966c61a3f6b50c7c0d9b542caf --- M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c 2 files changed, 7 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/09/11709/1 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 e7cbd03..dd48b2a 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -179,17 +179,17 @@ } /* 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]; } /* get the number of bits we must shift the given component of a point * code in this ss7_instance */ -static unsigned int get_pc_comp_shift(const struct osmo_ss7_pc_fmt *pc_fmt, +static uint8_t 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); + uint8_t pc_width = osmo_ss7_pc_width(pc_fmt); switch (comp_num) { case 0: return pc_width - pc_fmt->component_len[0]; @@ -206,7 +206,7 @@ static uint32_t pc_comp_shift_and_mask(const struct osmo_ss7_pc_fmt *pc_fmt, unsigned int comp_num, uint32_t pc) { - unsigned int shift = get_pc_comp_shift(pc_fmt, comp_num); + uint8_t shift = get_pc_comp_shift(pc_fmt, comp_num); uint32_t mask = (1 << pc_fmt->component_len[comp_num]) - 1; return (pc >> shift) & mask; @@ -288,7 +288,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: newchange Gerrit-Change-Id: I5a9981dd2c1d78966c61a3f6b50c7c0d9b542caf Gerrit-Change-Number: 11709 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msur...@sysmocom.de>