From 8358c4ba070871c829f4d4985630e7b99e9f9213 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 7 Jul 2021 12:41:38 +0200 Subject: [PATCH] constify some function arg pointers Change-Id: I7a7560fad96719da01f1ee30eea0be0e52c60e99 --- include/osmocom/mgcp/mgcp_network.h | 4 ++-- include/osmocom/mgcp/mgcp_protocol.h | 4 ++-- src/libosmo-mgcp/mgcp_network.c | 28 ++++++++++++++-------------- src/libosmo-mgcp/mgcp_protocol.c | 4 ++-- tests/mgcp/mgcp_test.c | 5 ----- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h index 0487b911f..1ed00e495 100644 --- a/include/osmocom/mgcp/mgcp_network.h +++ b/include/osmocom/mgcp/mgcp_network.h @@ -152,7 +152,7 @@ void mgcp_cleanup_e1_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn *con 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 @@ void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp, 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 abd264c65..edd0554db 100644 --- a/include/osmocom/mgcp/mgcp_protocol.h +++ b/include/osmocom/mgcp/mgcp_protocol.h @@ -23,5 +23,5 @@ struct mgcp_rtp_end; 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 cac8ef083..46cb0fd34 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -240,7 +240,7 @@ failed: } /* 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 @@ static int32_t ts_alignment_error(struct mgcp_rtp_stream_state *sstate, } /* 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 @@ static int check_rtp_timestamp(struct mgcp_endpoint *endp, } /* 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 @@ static int adjust_rtp_timestamp_offset(struct mgcp_endpoint *endp, } /* 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 @@ void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp, *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 @@ static int mgcp_patch_pt(struct mgcp_conn_rtp *conn_src, * 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 3014048b7..8d6f6f502 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -611,8 +611,8 @@ void mgcp_rtp_end_config(struct mgcp_endpoint *endp, int expect_ssrc_change, 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 2ca0b4c02..e6862e533 100644 --- a/tests/mgcp/mgcp_test.c +++ b/tests/mgcp/mgcp_test.c @@ -1261,11 +1261,6 @@ struct rtp_packet_info test_rtp_packets1[] = { "\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;