Change in osmo-mgw[master]: Define mgcp_rtp_end.output_enabled as bool

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
Fri Dec 24 13:48:35 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/26686 )


Change subject: Define mgcp_rtp_end.output_enabled as bool
......................................................................

Define mgcp_rtp_end.output_enabled as bool

Change-Id: I55f7796ef774f86050041f2c5e3a2f8f7d1f56df
---
M include/osmocom/mgcp/mgcp_network.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_msg.c
M tests/mgcp/mgcp_test.c
4 files changed, 6 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/86/26686/1

diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h
index b9cf5e3..e3fa3b1 100644
--- a/include/osmocom/mgcp/mgcp_network.h
+++ b/include/osmocom/mgcp/mgcp_network.h
@@ -110,8 +110,8 @@
 	uint32_t packet_duration_ms;
 	int maximum_packet_time; /* -1: not set */
 	char *fmtp_extra;
-	/* are we transmitting packets (1) or dropping (0) outbound packets */
-	int output_enabled;
+	/* are we transmitting packets (true) or dropping (false) outbound packets */
+	bool output_enabled;
 	/* FIXME: This parameter can be set + printed, but is nowhere used! */
 	int force_output_ptime;
 
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 5c3c60e..9c2fb0f 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -108,7 +108,7 @@
 	/* Set default values */
 	end->frames_per_packet = 0;	/* unknown */
 	end->packet_duration_ms = DEFAULT_RTP_AUDIO_PACKET_DURATION_MS;
-	end->output_enabled = 0;
+	end->output_enabled = false;
 	end->maximum_packet_time = -1;
 
 	conn_rtp->rate_ctr_group = rate_ctr_group_alloc(conn, &rate_ctr_group_desc, rate_ctr_index++);
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index f36fa71..4581b76 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -110,8 +110,7 @@
 
 	/* Special handling for RTP connections */
 	if (conn->type == MGCP_CONN_TYPE_RTP) {
-		conn->u.rtp.end.output_enabled =
-		    conn->mode & MGCP_CONN_SEND_ONLY ? 1 : 0;
+		conn->u.rtp.end.output_enabled = !!(conn->mode & MGCP_CONN_SEND_ONLY);
 	}
 
 	LOGPENDP(endp, DLMGCP, LOGL_DEBUG, "conn:%s\n", mgcp_conn_dump(conn));
@@ -121,7 +120,7 @@
 
 	/* Special handling für RTP connections */
 	if (conn->type == MGCP_CONN_TYPE_RTP) {
-		LOGPCONN(conn, DLMGCP, LOGL_DEBUG, "output_enabled %d\n",
+		LOGPCONN(conn, DLMGCP, LOGL_DEBUG, "output_enabled %u\n",
 			 conn->u.rtp.end.output_enabled);
 	}
 
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index a8aad14..9b4933c 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -868,7 +868,7 @@
 					printf("Connection mode not set\n");
 
 				OSMO_ASSERT(conn->end.output_enabled
-					    == (conn->conn->mode & MGCP_CONN_SEND_ONLY ? 1 : 0));
+					    == !!(conn->conn->mode & MGCP_CONN_SEND_ONLY));
 
 				conn->conn->mode |= CONN_UNMODIFIED;
 

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I55f7796ef774f86050041f2c5e3a2f8f7d1f56df
Gerrit-Change-Number: 26686
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211224/791faa5a/attachment.htm>


More information about the gerrit-log mailing list