Change in osmo-sip-connector[master]: mncc: Introduce mncc_rtp_write similiar to mncc_write

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

laforge gerrit-no-reply at lists.osmocom.org
Fri Jan 15 16:21:15 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/22203 )

Change subject: mncc: Introduce mncc_rtp_write similiar to mncc_write
......................................................................

mncc: Introduce mncc_rtp_write similiar to mncc_write

Concentrate the write() to the socket in 2 places.
One for struct gsm_mncc and one for struct gsm_mncc_rtp.
Improve debugging as now all function debug print the
MNCC primitiv.

Change-Id: Ia84602955b913a3bb13de7a6a92048799f2e1955
---
M src/mncc.c
1 file changed, 16 insertions(+), 9 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/mncc.c b/src/mncc.c
index d3d218b..83cfe3b 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -156,21 +156,28 @@
 	return mncc_write(conn, &mncc);
 }
 
-static int mncc_rtp_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref)
+static int mncc_rtp_write(struct mncc_connection *conn, struct gsm_mncc_rtp *rtp)
 {
 	int rc;
+
+	rc = write(conn->fd.fd, &rtp, sizeof(rtp));
+	LOGP(DMNCC, LOGL_DEBUG, "MNCC sent message type: %s\n", osmo_mncc_name(rtp->msg_type));
+	if (rc != sizeof(*rtp)) {
+		LOGP(DMNCC, LOGL_ERROR, "Failed to send message for call(%u)\n", rtp->callref);
+		close_connection(conn);
+	}
+
+	return rc;
+}
+
+static int mncc_rtp_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t callref)
+{
 	struct gsm_mncc_rtp mncc = { 0, };
 
 	mncc.msg_type = msg_type;
 	mncc.callref = callref;
 
-	rc = write(conn->fd.fd, &mncc, sizeof(mncc));
-	if (rc != sizeof(mncc)) {
-		LOGP(DMNCC, LOGL_ERROR, "Failed to send message for call(%u)\n", callref);
-		close_connection(conn);
-	}
-
-	return rc;
+	return mncc_rtp_write(conn, &mncc);
 }
 
 /* Send a MNCC_RTP_CONNECT to the MSC for the given call legs */
@@ -195,7 +202,7 @@
 	LOGP(DMNCC, LOGL_DEBUG, "SEND rtp_connect: IP=(%s) PORT=(%u)\n",
 	     osmo_sockaddr_ntop((const struct sockaddr*)&other->addr, ip_addr),
 	     osmo_sockaddr_port((const struct sockaddr*)&other->addr));
-	rc = write(leg->conn->fd.fd, &mncc, sizeof(mncc));
+	rc = mncc_rtp_write(leg->conn, &mncc);
 	if (rc != sizeof(mncc)) {
 		LOGP(DMNCC, LOGL_ERROR, "Failed to send message for call(%u)\n",
 			leg->callref);

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

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: Ia84602955b913a3bb13de7a6a92048799f2e1955
Gerrit-Change-Number: 22203
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20210115/e8013fb7/attachment.htm>


More information about the gerrit-log mailing list