Change in osmo-ttcn3-hacks[master]: library/MNCC: implement MNCCv8 encoding/decoding 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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 28 14:35:46 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26008 )

Change subject: library/MNCC: implement MNCCv8 encoding/decoding support
......................................................................

library/MNCC: implement MNCCv8 encoding/decoding support

Change-Id: I5488c5a4cc671e1d6a0d35b2ff4bdda0b0b48c00
Related: OS#5164, OS#5282
---
M library/MNCC_Emulation.ttcn
M library/MNCC_EncDec.cc
M library/MNCC_Types.ttcn
M library/mncc.h
4 files changed, 74 insertions(+), 5 deletions(-)

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



diff --git a/library/MNCC_Emulation.ttcn b/library/MNCC_Emulation.ttcn
index 66294a4..85556c1 100644
--- a/library/MNCC_Emulation.ttcn
+++ b/library/MNCC_Emulation.ttcn
@@ -38,7 +38,7 @@
 import from UD_Types all;
 
 modulepar {
-	int mp_mncc_version := 7;
+	int mp_mncc_version := 8;
 }
 
 /* General "base class" component definition, of which specific implementations
diff --git a/library/MNCC_EncDec.cc b/library/MNCC_EncDec.cc
index f896cd3..ffc2aa8 100644
--- a/library/MNCC_EncDec.cc
+++ b/library/MNCC_EncDec.cc
@@ -9,7 +9,7 @@
 
 BOOLEAN set__MNCC__version(INTEGER const& version)
 {
-	if (version != 7)
+	if (version != 7 && version != 8)
 		return false;
 	mncc_sock_version = version;
 	return true;
@@ -184,9 +184,19 @@
 		strncpy(mncc.imsi, in_sig.imsi(), sizeof(mncc.imsi));
 		mncc.lchan_type = in_sig.lchan__type();
 		mncc.lchan_mode = in_sig.lchan__mode();
+		if (in_sig.gcr().is_value()) {
+			const OCTETSTRING &gcr = in_sig.gcr();
+			if (mncc_sock_version < 8)
+				TTCN_error("GCR is only available since MNCCv8");
+			memcpy(&mncc.v8.gcr[0], gcr, sizeof(mncc.v8.gcr));
+			mncc.fields |= MNCC_F_GCR;
+		}
 		if (in_sig.sdp().is_value()) {
 			const CHARSTRING &sdp = in_sig.sdp();
-			strncpy(&mncc.sdp[0], sdp, sizeof(mncc.sdp));
+			if (mncc_sock_version > 7)
+				strncpy(&mncc.v8.sdp[0], sdp, sizeof(mncc.v8.sdp));
+			else
+				strncpy(&mncc.v7.sdp[0], sdp, sizeof(mncc.v7.sdp));
 		}
 		ret_val = OCTETSTRING(sizeof(mncc), (uint8_t *)&mncc);
 		}
@@ -361,7 +371,13 @@
 		sign.imsi() = CHARSTRING(in_mncc->imsi);
 		sign.lchan__type() = in_mncc->lchan_type;
 		sign.lchan__mode() = in_mncc->lchan_mode;
-		sign.sdp() = in_mncc->sdp;
+		if (mncc_sock_version > 7) {
+			if (in_mncc->fields & MNCC_F_GCR)
+				sign.gcr() = OCTETSTRING(sizeof(in_mncc->v8.gcr), in_mncc->v8.gcr);
+			sign.sdp() = in_mncc->v8.sdp;
+		} else {
+			sign.sdp() = in_mncc->v7.sdp;
+		}
 		u.signal() = sign;
 		break;
 	}
diff --git a/library/MNCC_Types.ttcn b/library/MNCC_Types.ttcn
index e396892..1de34a0 100644
--- a/library/MNCC_Types.ttcn
+++ b/library/MNCC_Types.ttcn
@@ -362,6 +362,7 @@
 	uint8_t		lchan_type,	/* empty in OSmoMSC */
 	uint8_t		lchan_mode,	/* empty in OsmoMSC */
 
+	octetstring	gcr optional,
 	charstring	sdp optional
 };
 
@@ -472,6 +473,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -503,6 +505,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -537,6 +540,7 @@
 			imsi := imsi,
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -570,6 +574,7 @@
 			imsi := imsi,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -604,6 +609,7 @@
 			imsi := imsi,
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -636,6 +642,7 @@
 			imsi := imsi,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -670,6 +677,7 @@
 			imsi := imsi,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -703,6 +711,7 @@
 			imsi := imsi,
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -735,6 +744,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -767,6 +777,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -809,6 +820,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -841,6 +853,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -875,6 +888,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -908,6 +922,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -944,6 +959,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -978,6 +994,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1012,6 +1029,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1046,6 +1064,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1079,6 +1098,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1115,6 +1135,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1148,6 +1169,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1181,6 +1203,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1213,6 +1236,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1248,6 +1272,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1281,6 +1306,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1316,6 +1342,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1350,6 +1377,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1384,6 +1412,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1417,6 +1446,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1450,6 +1480,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1481,6 +1512,7 @@
 			imsi := ?,
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1529,6 +1561,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1561,6 +1594,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1593,6 +1627,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1625,6 +1660,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1657,6 +1693,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1697,6 +1734,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1729,6 +1767,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1761,6 +1800,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1794,6 +1834,7 @@
 			imsi := ?,
 			lchan_type := ?,
 			lchan_mode := ?,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1826,6 +1867,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
@@ -1859,6 +1901,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := *,
 			sdp := *
 		}
 	}
@@ -1899,6 +1942,7 @@
 			imsi := "",
 			lchan_type := 0,
 			lchan_mode := 0,
+			gcr := omit,
 			sdp := omit
 		}
 	}
diff --git a/library/mncc.h b/library/mncc.h
index 1e45c37..f70f9bd 100644
--- a/library/mncc.h
+++ b/library/mncc.h
@@ -230,6 +230,7 @@
 #define MNCC_F_CCCAP		0x0800
 #define MNCC_F_KEYPAD		0x1000
 #define MNCC_F_SIGNAL		0x2000
+#define MNCC_F_GCR		0x4000
 
 struct gsm_mncc {
 	/* context based information */
@@ -267,7 +268,15 @@
 	unsigned char	lchan_type;
 	unsigned char	lchan_mode;
 
-	char		sdp[1024];
+	union {
+		struct {
+			char sdp[1024];
+		} v7;
+		struct {
+			uint8_t gcr[16];
+			char sdp[1024];
+		} v8;
+	};
 };
 
 struct gsm_data_frame {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26008
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: I5488c5a4cc671e1d6a0d35b2ff4bdda0b0b48c00
Gerrit-Change-Number: 26008
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith <keith at rhizomatica.org>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith 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/20211028/cb352c80/attachment.htm>


More information about the gerrit-log mailing list