This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/9318 Change subject: bsc: Add mgcp_port_to_cic() to determine CIC from RTP Port ...................................................................... bsc: Add mgcp_port_to_cic() to determine CIC from RTP Port Also: Move mgcp_timeslot_to_port() next to it, as they are more or less the inverse transformation of each other. Change-Id: Ica908e2bb8fc4e59e0d146b428c93a9efc385688 --- M include/osmocom/bsc/bsc_msc_data.h M src/osmo-bsc/osmo_bsc_bssap.c 2 files changed, 22 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/18/9318/1 diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h index ce6512e..fef674e 100644 --- a/include/osmocom/bsc/bsc_msc_data.h +++ b/include/osmocom/bsc/bsc_msc_data.h @@ -28,6 +28,7 @@ #define _OSMO_MSC_DATA_H #include "bsc_msc.h" +#include "debug.h" #include <osmocom/core/timer.h> #include <osmocom/gsm/protocol/gsm_04_08.h> @@ -42,6 +43,7 @@ #include <osmocom/gsm/gsm23003.h> #include <regex.h> +#include <errno.h> struct osmo_bsc_rf; struct gsm_network; @@ -162,5 +164,25 @@ struct bsc_msc_data *osmo_msc_data_find(struct gsm_network *, int); struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *, int); +/* Helper function to calculate the port number for a given + * timeslot/multiplex. This functionality is needed to support + * the sccp-lite scenario where the MGW is handled externally */ +static inline int mgcp_timeslot_to_port(int multiplex, int timeslot, int base) +{ + if (timeslot == 0) { + LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n"); + timeslot = 255; + } + + return base + (timeslot + (32 * multiplex)) * 2; +} + +static inline int mgcp_port_to_cic(uint16_t port, uint16_t base) +{ + if (port < base) + return -EINVAL; + return (port - base) / 2; +} + #endif diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 3f7e4f8..1dfd5b4 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -634,19 +634,6 @@ return -1; } -/* Helper function to calculate the port number for a given - * timeslot/multiplex. This functionality is needed to support - * the sccp-lite scenario where the MGW is handled externally */ -static inline int mgcp_timeslot_to_port(int multiplex, int timeslot, int base) -{ - if (timeslot == 0) { - LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n"); - timeslot = 255; - } - - return base + (timeslot + (32 * multiplex)) * 2; -} - /* * Handle the assignment request message. * -- To view, visit https://gerrit.osmocom.org/9318 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ica908e2bb8fc4e59e0d146b428c93a9efc385688 Gerrit-Change-Number: 9318 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte <laforge at gnumonks.org> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180525/1bcb24e4/attachment.htm>