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/.
dexter gerrit-no-reply at lists.osmocom.orgHello Neels Hofmeyr, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/4237
to look at the new patch set (#5).
mgcp: move port/timeslot calculator to mgcp_common.h
the functions rtp_calculate_port(), mgcp_timeslot_to_endpoint(),
mgcp_endpoint_to_timeslot() may be useful in an application that uses
the mgcp_client as well.
Move the functions to mgcp_common.h
Change-Id: I8a553e863701d3bafa7b8dc17a503455c303546e
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_common.h
2 files changed, 46 insertions(+), 42 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/37/4237/5
diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index 7307f3c..4c72844 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -37,31 +37,6 @@
#define RTP_PORT_DEFAULT_RANGE_START 16002
#define RTP_PORT_DEFAULT_RANGE_END RTP_PORT_DEFAULT_RANGE_START + 64
-/**
- * Calculate the RTP audio port for the given multiplex
- * and the direction. This allows a semi static endpoint
- * to port calculation removing the need for the BSC
- * and the MediaGateway to communicate.
- *
- * Port usage explained:
- * base + (multiplex * 2) + 0 == local port to wait for network packets
- * base + (multiplex * 2) + 1 == local port for rtcp
- *
- * The above port will receive packets from the BTS that need
- * to be patched and forwarded to the network.
- * The above port will receive packets from the network that
- * need to be patched and forwarded to the BTS.
- *
- * We assume to have a static BTS IP address so we can differentiate
- * network and BTS.
- *
- */
-static inline int rtp_calculate_port(int multiplex, int base)
-{
- return base + (multiplex * 2);
-}
-
-
/*
* Handling of MGCP Endpoints and the MGCP Config
*/
@@ -235,23 +210,6 @@
* format helper functions
*/
struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg);
-
-/* adc helper */
-static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot)
-{
- if (timeslot == 0) {
- LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n");
- timeslot = 255;
- }
-
- return timeslot + (32 * multiplex);
-}
-
-static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int *timeslot)
-{
- *multiplex = endpoint / 32;
- *timeslot = endpoint % 32;
-}
int mgcp_send_reset_ep(struct mgcp_endpoint *endp, int endpoint);
int mgcp_send_reset_all(struct mgcp_config *cfg);
diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h
index 0eb1388..c2fb780 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -68,4 +68,50 @@
return 0;
}
+/**
+ * Calculate the RTP audio port for the given multiplex
+ * and the direction. This allows a semi static endpoint
+ * to port calculation removing the need for the BSC
+ * and the MediaGateway to communicate.
+ *
+ * Port usage explained:
+ * base + (multiplex * 2) + 0 == local port to wait for network packets
+ * base + (multiplex * 2) + 1 == local port for rtcp
+ *
+ * The above port will receive packets from the BTS that need
+ * to be patched and forwarded to the network.
+ * The above port will receive packets from the network that
+ * need to be patched and forwarded to the BTS.
+ *
+ * We assume to have a static BTS IP address so we can differentiate
+ * network and BTS.
+ *
+ */
+static inline int rtp_calculate_port(int multiplex, int base)
+{
+ return base + (multiplex * 2);
+}
+
+/**
+ * Calculate the MGCP endpoint from a given timeslot
+ */
+static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot)
+{
+ if (timeslot == 0) {
+ LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n");
+ timeslot = 255;
+ }
+
+ return timeslot + (32 * multiplex);
+}
+
+/**
+ * Calculate the timeslot from a given mgcp endpoint
+ */
+static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int *timeslot)
+{
+ *multiplex = endpoint / 32;
+ *timeslot = endpoint % 32;
+}
+
#endif
--
To view, visit https://gerrit.osmocom.org/4237
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8a553e863701d3bafa7b8dc17a503455c303546e
Gerrit-PatchSet: 5
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>