Change in osmo-mgw[master]: constify some function arg pointers

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/.

pespin gerrit-no-reply at lists.osmocom.org
Wed Jul 7 12:23:40 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/24871 )

Change subject: constify some function arg pointers
......................................................................

constify some function arg pointers

Change-Id: I7a7560fad96719da01f1ee30eea0be0e52c60e99
---
M include/osmocom/mgcp/mgcp_network.h
M include/osmocom/mgcp/mgcp_protocol.h
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_protocol.c
M tests/mgcp/mgcp_test.c
5 files changed, 20 insertions(+), 25 deletions(-)

Approvals:
  Jenkins Builder: Verified
  dexter: Looks good to me, approved



diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h
index 0487b91..1ed00e4 100644
--- a/include/osmocom/mgcp/mgcp_network.h
+++ b/include/osmocom/mgcp/mgcp_network.h
@@ -152,7 +152,7 @@
 int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port,
 			   struct mgcp_conn_rtp *conn);
 void mgcp_free_rtp_port(struct mgcp_rtp_end *end);
-void mgcp_patch_and_count(struct mgcp_endpoint *endp,
+void mgcp_patch_and_count(const struct mgcp_endpoint *endp,
 			  struct mgcp_rtp_state *state,
 			  struct mgcp_rtp_end *rtp_end,
 			  struct osmo_sockaddr *addr, struct msgb *msg);
@@ -172,6 +172,6 @@
 					  struct mgcp_conn_rtp *conn);
 
 /* internal RTP Annex A counting */
-void mgcp_rtp_annex_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *state,
+void mgcp_rtp_annex_count(const struct mgcp_endpoint *endp, struct mgcp_rtp_state *state,
 			const uint16_t seq, const int32_t transit,
 			const uint32_t ssrc);
diff --git a/include/osmocom/mgcp/mgcp_protocol.h b/include/osmocom/mgcp/mgcp_protocol.h
index abd264c..edd0554 100644
--- a/include/osmocom/mgcp/mgcp_protocol.h
+++ b/include/osmocom/mgcp/mgcp_protocol.h
@@ -23,5 +23,5 @@
 void mgcp_rtp_end_config(struct mgcp_endpoint *endp, int expect_ssrc_change,
 			 struct mgcp_rtp_end *rtp);
 
-uint32_t mgcp_rtp_packet_duration(struct mgcp_endpoint *endp,
-				  struct mgcp_rtp_end *rtp);
+uint32_t mgcp_rtp_packet_duration(const struct mgcp_endpoint *endp,
+				  const struct mgcp_rtp_end *rtp);
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index cac8ef0..46cb0fd 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -240,7 +240,7 @@
 }
 
 /* Compute timestamp alignment error */
-static int32_t ts_alignment_error(struct mgcp_rtp_stream_state *sstate,
+static int32_t ts_alignment_error(const struct mgcp_rtp_stream_state *sstate,
 				  int ptime, uint32_t timestamp)
 {
 	int32_t timestamp_delta;
@@ -255,11 +255,11 @@
 }
 
 /* Check timestamp and sequence number for plausibility */
-static int check_rtp_timestamp(struct mgcp_endpoint *endp,
-			       struct mgcp_rtp_state *state,
-			       struct mgcp_rtp_stream_state *sstate,
-			       struct mgcp_rtp_end *rtp_end,
-			       struct osmo_sockaddr *addr,
+static int check_rtp_timestamp(const struct mgcp_endpoint *endp,
+			       const struct mgcp_rtp_state *state,
+			       const struct mgcp_rtp_stream_state *sstate,
+			       const struct mgcp_rtp_end *rtp_end,
+			       const struct osmo_sockaddr *addr,
 			       uint16_t seq, uint32_t timestamp,
 			       const char *text, int32_t * tsdelta_out)
 {
@@ -344,10 +344,10 @@
 }
 
 /* Set the timestamp offset according to the packet duration. */
-static int adjust_rtp_timestamp_offset(struct mgcp_endpoint *endp,
+static int adjust_rtp_timestamp_offset(const struct mgcp_endpoint *endp,
 				       struct mgcp_rtp_state *state,
-				       struct mgcp_rtp_end *rtp_end,
-				       struct osmo_sockaddr *addr,
+				       const struct mgcp_rtp_end *rtp_end,
+				       const struct osmo_sockaddr *addr,
 				       int16_t delta_seq, uint32_t in_timestamp)
 {
 	int32_t tsdelta = state->packet_duration;
@@ -394,10 +394,10 @@
 }
 
 /* Set the timestamp offset according to the packet duration. */
-static int align_rtp_timestamp_offset(struct mgcp_endpoint *endp,
+static int align_rtp_timestamp_offset(const struct mgcp_endpoint *endp,
 				      struct mgcp_rtp_state *state,
-				      struct mgcp_rtp_end *rtp_end,
-				      struct osmo_sockaddr *addr,
+				      const struct mgcp_rtp_end *rtp_end,
+				      const struct osmo_sockaddr *addr,
 				      uint32_t timestamp)
 {
 	char ipbuf[INET6_ADDRSTRLEN];
@@ -475,7 +475,7 @@
 	*fmtp_extra = conn->end.fmtp_extra;
 }
 
-void mgcp_rtp_annex_count(struct mgcp_endpoint *endp,
+void mgcp_rtp_annex_count(const struct mgcp_endpoint *endp,
 			  struct mgcp_rtp_state *state, const uint16_t seq,
 			  const int32_t transit, const uint32_t ssrc)
 {
@@ -556,7 +556,7 @@
  * is only one source.
  * There is also no probation period for new sources. Every RTP header
  * we receive will be seen as a switch in streams. */
-void mgcp_patch_and_count(struct mgcp_endpoint *endp,
+void mgcp_patch_and_count(const struct mgcp_endpoint *endp,
 			  struct mgcp_rtp_state *state,
 			  struct mgcp_rtp_end *rtp_end,
 			  struct osmo_sockaddr *addr, struct msgb *msg)
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 3014048..8d6f6f5 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -611,8 +611,8 @@
 		 rtp->force_constant_ssrc ? ", force constant ssrc" : "");
 }
 
-uint32_t mgcp_rtp_packet_duration(struct mgcp_endpoint *endp,
-				  struct mgcp_rtp_end *rtp)
+uint32_t mgcp_rtp_packet_duration(const struct mgcp_endpoint *endp,
+				  const struct mgcp_rtp_end *rtp)
 {
 	int f = 0;
 
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 2ca0b4c..e6862e5 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -1261,11 +1261,6 @@
 	 "\x01\x23\x45\x67\x89\xAB\xCD\xEF"},
 };
 
-void mgcp_patch_and_count(struct mgcp_endpoint *endp,
-			  struct mgcp_rtp_state *state,
-			  struct mgcp_rtp_end *rtp_end,
-			  struct osmo_sockaddr *addr, struct msgb *msg);
-
 static void test_packet_error_detection(int patch_ssrc, int patch_ts)
 {
 	int i;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/24871
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I7a7560fad96719da01f1ee30eea0be0e52c60e99
Gerrit-Change-Number: 24871
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210707/34395d0d/attachment.htm>


More information about the gerrit-log mailing list