Change in osmo-ttcn3-hacks[master]: library/MNCC_EncDec: rip out MNCC version 6 support

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

fixeria gerrit-no-reply at lists.osmocom.org
Wed Oct 27 15:17:11 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25990 )


Change subject: library/MNCC_EncDec: rip out MNCC version 6 support
......................................................................

library/MNCC_EncDec: rip out MNCC version 6 support

The latest release of osmo-sip-connector (1.5.0, 23 Feb 2021) does
support MNCCv7, so there is no need to maintain MNCCv6 support.

Change-Id: Ie45158e805a62e86b9496b46f323b83a74630460
Related: I5448ff931ec33f24f4837a51376f1703fe97683b
Related: OS#5282
---
M library/MNCC_EncDec.cc
M library/mncc.h
2 files changed, 37 insertions(+), 83 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/25990/1

diff --git a/library/MNCC_EncDec.cc b/library/MNCC_EncDec.cc
index be5d01a..7d09d0a 100644
--- a/library/MNCC_EncDec.cc
+++ b/library/MNCC_EncDec.cc
@@ -9,7 +9,7 @@
 
 BOOLEAN set__MNCC__version(INTEGER const& version)
 {
-	if (version != 6 && version != 7)
+	if (version != 7)
 		return false;
 	mncc_sock_version = version;
 	return true;
@@ -195,46 +195,27 @@
 		ret_val = ret_val & in.u().data().data();
 		break;
 	case MNCC__MsgUnion::ALT_rtp:
-		switch (mncc_sock_version) {
-		case 6:
-			struct gsm_mncc_rtp_mncc6 rtp_old;
-			memset(&rtp_old, 0, sizeof(rtp_old));
-			rtp_old.msg_type = in.msg__type();
-			rtp_old.callref = in.u().rtp().callref();
-			ttcn_buffer.put_string(in.u().rtp().ip());
-			if (!in.u().rtp().is__ipv6()) {
-				memcpy(&rtp_old.ip, ttcn_buffer.get_data(), sizeof(struct in_addr));
-				rtp_old.ip = ntohl(rtp_old.ip);
-			} /* else: ipv6 not supported in MNCCv6 */
-			rtp_old.port = in.u().rtp().rtp__port();
-			rtp_old.payload_type = in.u().rtp().payload__type();
-			rtp_old.payload_msg_type = in.u().rtp().payload__msg__type();
-			ret_val = OCTETSTRING(sizeof(rtp_old), (uint8_t *) &rtp_old);
-			break;
-		case 7:
-			struct gsm_mncc_rtp rtp;
-			memset(&rtp, 0, sizeof(rtp));
-			rtp.msg_type = in.msg__type();
-			rtp.callref = in.u().rtp().callref();
-			ttcn_buffer.put_string(in.u().rtp().ip());
-			if (in.u().rtp().is__ipv6()) {
-				// if(in.u().rtp().ip().lengthof() != 16) print error
-				rtp.addr.ss_family = AF_INET6;
-				memcpy(&((struct sockaddr_in6*)&rtp.addr)->sin6_addr, ttcn_buffer.get_data(),
-				       sizeof(struct in6_addr));
-				((struct sockaddr_in6*)&rtp.addr)->sin6_port = htons(in.u().rtp().rtp__port());
-			} else {
-				// if(in.u().rtp().ip().lengthof() != 4) print error
-				rtp.addr.ss_family = AF_INET;
-				memcpy(&((struct sockaddr_in*)&rtp.addr)->sin_addr, ttcn_buffer.get_data(),
-				       sizeof(struct in_addr));
-				((struct sockaddr_in*)&rtp.addr)->sin_port = htons(in.u().rtp().rtp__port());
-			}
-			rtp.payload_type = in.u().rtp().payload__type();
-			rtp.payload_msg_type = in.u().rtp().payload__msg__type();
-			ret_val = OCTETSTRING(sizeof(rtp), (uint8_t *) &rtp);
-			break;
+		struct gsm_mncc_rtp rtp;
+		memset(&rtp, 0, sizeof(rtp));
+		rtp.msg_type = in.msg__type();
+		rtp.callref = in.u().rtp().callref();
+		ttcn_buffer.put_string(in.u().rtp().ip());
+		if (in.u().rtp().is__ipv6()) {
+			// if(in.u().rtp().ip().lengthof() != 16) print error
+			rtp.addr.ss_family = AF_INET6;
+			memcpy(&((struct sockaddr_in6*)&rtp.addr)->sin6_addr, ttcn_buffer.get_data(),
+			       sizeof(struct in6_addr));
+			((struct sockaddr_in6*)&rtp.addr)->sin6_port = htons(in.u().rtp().rtp__port());
+		} else {
+			// if(in.u().rtp().ip().lengthof() != 4) print error
+			rtp.addr.ss_family = AF_INET;
+			memcpy(&((struct sockaddr_in*)&rtp.addr)->sin_addr, ttcn_buffer.get_data(),
+			       sizeof(struct in_addr));
+			((struct sockaddr_in*)&rtp.addr)->sin_port = htons(in.u().rtp().rtp__port());
 		}
+		rtp.payload_type = in.u().rtp().payload__type();
+		rtp.payload_msg_type = in.u().rtp().payload__msg__type();
+		ret_val = OCTETSTRING(sizeof(rtp), (uint8_t *) &rtp);
 		break;
 	case MNCC__MsgUnion::ALT_hello:
 		struct gsm_mncc_hello hello;
@@ -264,7 +245,6 @@
 	const struct gsm_data_frame *in_data;
 	MNCC__PDU__Data data;
 	const struct gsm_mncc_rtp *in_rtp;
-	const struct gsm_mncc_rtp_mncc6 *in_rtp_old;
 	MNCC__PDU__Rtp rtp;
 	MNCC__MsgUnion u;
 	bool is_ipv6;
@@ -303,40 +283,26 @@
 	case MNCC_RTP_CREATE:
 	case MNCC_RTP_CONNECT:
 	case MNCC_RTP_FREE:
-		switch (mncc_sock_version) {
-		case 6:
-			struct in_addr inaddr;
-			in_rtp_old = (const struct gsm_mncc_rtp_mncc6 *) in_mncc;
-			inaddr.s_addr = htonl(in_rtp_old->ip);
-			ip = OCTETSTRING(sizeof(struct in_addr),
-					(const unsigned char*)&inaddr);
-			rtp = MNCC__PDU__Rtp(in_rtp_old->callref, false, ip, in_rtp_old->port, in_rtp_old->payload_type,
-					     in_rtp_old->payload_msg_type, in_rtp_old->sdp);
-			u.rtp() = rtp;
-			break;
-		case 7:
-			in_rtp = (const struct gsm_mncc_rtp *) in_mncc;
-			switch (in_rtp->addr.ss_family) {
-			case AF_INET6:
-				is_ipv6 = true;
-				port = ntohs(((struct sockaddr_in6*)&in_rtp->addr)->sin6_port);
-				ip = OCTETSTRING(sizeof(struct in6_addr),
-						(const unsigned char*)&((struct sockaddr_in6*)&in_rtp->addr)->sin6_addr);
+		in_rtp = (const struct gsm_mncc_rtp *) in_mncc;
+		switch (in_rtp->addr.ss_family) {
+		case AF_INET6:
+			is_ipv6 = true;
+			port = ntohs(((struct sockaddr_in6*)&in_rtp->addr)->sin6_port);
+			ip = OCTETSTRING(sizeof(struct in6_addr),
+					(const unsigned char*)&((struct sockaddr_in6*)&in_rtp->addr)->sin6_addr);
 
 			break;
-			case AF_UNSPEC: //RTP_CREATE and RTP_FREE can contain fully zeroed addr
-			case AF_INET:
-				is_ipv6 = false;
-				port = ntohs(((struct sockaddr_in*)&in_rtp->addr)->sin_port);
-				ip = OCTETSTRING(sizeof(struct in_addr),
-						(const unsigned char*)&((struct sockaddr_in*)&in_rtp->addr)->sin_addr);
-				break;
-			}
-			rtp = MNCC__PDU__Rtp(in_rtp->callref, is_ipv6, ip, port, in_rtp->payload_type,
-					     in_rtp->payload_msg_type, in_rtp->sdp);
-			u.rtp() = rtp;
+		case AF_UNSPEC: //RTP_CREATE and RTP_FREE can contain fully zeroed addr
+		case AF_INET:
+			is_ipv6 = false;
+			port = ntohs(((struct sockaddr_in*)&in_rtp->addr)->sin_port);
+			ip = OCTETSTRING(sizeof(struct in_addr),
+					(const unsigned char*)&((struct sockaddr_in*)&in_rtp->addr)->sin_addr);
 			break;
 		}
+		rtp = MNCC__PDU__Rtp(in_rtp->callref, is_ipv6, ip, port, in_rtp->payload_type,
+				     in_rtp->payload_msg_type, in_rtp->sdp);
+		u.rtp() = rtp;
 		break;
 	default:
 		sign.callref() = in_mncc->callref;
diff --git a/library/mncc.h b/library/mncc.h
index a55d155..1e45c37 100644
--- a/library/mncc.h
+++ b/library/mncc.h
@@ -292,18 +292,6 @@
 	uint32_t	lchan_type_offset;
 };
 
-/* Use this one in MNCCv6 */
-struct gsm_mncc_rtp_mncc6 {
-	uint32_t	msg_type;
-	uint32_t	callref;
-	uint32_t        ip;
-	uint16_t        port;
-	uint32_t	payload_type;
-	uint32_t	payload_msg_type;
-
-	char		sdp[1024];
-};
-
 struct gsm_mncc_rtp {
 	uint32_t	msg_type;
 	uint32_t	callref;

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie45158e805a62e86b9496b46f323b83a74630460
Gerrit-Change-Number: 25990
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211027/e6229919/attachment.htm>


More information about the gerrit-log mailing list