[PATCH] osmo-ttcn3-hacks[master]: Add TRXC (OsmoTRX Control) protocol types + codec port

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Feb 24 00:03:26 UTC 2018


Review at  https://gerrit.osmocom.org/6872

Add TRXC (OsmoTRX Control) protocol types + codec port

Change-Id: I3b5e81693e5cf8ee8a2c360bde8b16c5276d2297
---
A library/TRXC_CodecPort.ttcn
A library/TRXC_CodecPort_CtrlFunct.ttcn
A library/TRXC_CodecPort_CtrlFunctDef.cc
A library/TRXC_Types.ttcn
4 files changed, 234 insertions(+), 0 deletions(-)


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

diff --git a/library/TRXC_CodecPort.ttcn b/library/TRXC_CodecPort.ttcn
new file mode 100644
index 0000000..6acead0
--- /dev/null
+++ b/library/TRXC_CodecPort.ttcn
@@ -0,0 +1,62 @@
+module TRXC_CodecPort {
+
+import from IPL4asp_PortType all;
+import from IPL4asp_Types all;
+import from TRXC_Types all;
+
+type record TRXC_RecvFrom {
+	ConnectionId	connId,
+	HostName	remName,
+	PortNumber	remPort,
+	HostName	locName,
+	PortNumber	locPort,
+	TrxcMessage	msg
+}
+
+template TRXC_RecvFrom tr_TRXC_RecvFrom(template TrxcMessage msg) := {
+	connId := ?,
+	remName := ?,
+	remPort := ?,
+	locName := ?,
+	locPort := ?,
+	msg := msg
+}
+
+type record TRXC_Send {
+	ConnectionId	connId,
+	TrxcMessage	msg
+}
+
+private function IPL4_to_TRXC_RecvFrom(in ASP_RecvFrom pin, out TRXC_RecvFrom pout) {
+	pout.connId := pin.connId;
+	pout.remName := pin.remName;
+	pout.remPort := pin.remPort;
+	pout.locName := pin.locName;
+	pout.locPort := pin.locPort;
+	pout.msg := dec_TrxcMessage(oct2char(pin.msg));
+} with { extension "prototype(fast)" };
+
+private function TRXC_to_IPL4_Send(in TRXC_Send pin, out ASP_Send pout) {
+	pout.connId := pin.connId;
+	pout.proto := { udp := {} };
+	pout.msg := char2oct(enc_TrxcMessage(pin.msg));
+} with { extension "prototype(fast)" };
+
+type port TRXC_CODEC_PT message {
+	out	TRXC_Send;
+	in	TRXC_RecvFrom,
+		ASP_ConnId_ReadyToRelease,
+		ASP_Event;
+} with { extension "user IPL4asp_PT
+	out(TRXC_Send -> ASP_Send: function(TRXC_to_IPL4_Send))
+	in(ASP_RecvFrom -> TRXC_RecvFrom: function(IPL4_to_TRXC_RecvFrom);
+	   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
+	   ASP_Event -> ASP_Event: simple)"
+}
+
+template (value) TRXC_Send ts_TRXC_Send(ConnectionId cid, template (value) TrxcMessage msg) := {
+	connId := cid,
+	msg := msg
+}
+
+}
diff --git a/library/TRXC_CodecPort_CtrlFunct.ttcn b/library/TRXC_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 0000000..07d809c
--- /dev/null
+++ b/library/TRXC_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,43 @@
+module TRXC_CodecPort_CtrlFunct {
+
+  import from TRXC_CodecPort all;
+  import from IPL4asp_Types all;
+
+  external function f_IPL4_listen(
+    inout TRXC_CODEC_PT portRef,
+    in HostName locName,
+    in PortNumber locPort,
+    in ProtoTuple proto,
+    in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_connect(
+    inout TRXC_CODEC_PT portRef,
+    in HostName remName,
+    in PortNumber remPort,
+    in HostName locName,
+    in PortNumber locPort,
+    in ConnectionId connId,
+    in ProtoTuple proto,
+    in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_close(
+    inout TRXC_CODEC_PT portRef,
+    in ConnectionId id,
+    in ProtoTuple proto := { unspecified := {} }
+  ) return Result;
+
+  external function f_IPL4_setUserData(
+    inout TRXC_CODEC_PT portRef,
+    in ConnectionId id,
+    in UserData userData
+  ) return Result;
+
+  external function f_IPL4_getUserData(
+    inout TRXC_CODEC_PT portRef,
+    in ConnectionId id,
+    out UserData userData
+  ) return Result;
+
+ }
diff --git a/library/TRXC_CodecPort_CtrlFunctDef.cc b/library/TRXC_CodecPort_CtrlFunctDef.cc
new file mode 100644
index 0000000..aecd1ee
--- /dev/null
+++ b/library/TRXC_CodecPort_CtrlFunctDef.cc
@@ -0,0 +1,55 @@
+#include "IPL4asp_PortType.hh"
+#include "IPL4asp_PT.hh"
+#include "TRXC_CodecPort.hh"
+
+namespace TRXC__CodecPort__CtrlFunct {
+
+  IPL4asp__Types::Result f__IPL4__listen(
+    TRXC__CodecPort::TRXC__CODEC__PT& portRef,
+    const IPL4asp__Types::HostName& locName,
+    const IPL4asp__Types::PortNumber& locPort,
+    const IPL4asp__Types::ProtoTuple& proto,
+    const IPL4asp__Types::OptionList& options)
+  {
+    return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
+  }
+  
+  IPL4asp__Types::Result f__IPL4__connect(
+    TRXC__CodecPort::TRXC__CODEC__PT& portRef,
+    const IPL4asp__Types::HostName& remName,
+    const IPL4asp__Types::PortNumber& remPort,
+    const IPL4asp__Types::HostName& locName,
+    const IPL4asp__Types::PortNumber& locPort,
+    const IPL4asp__Types::ConnectionId& connId,
+    const IPL4asp__Types::ProtoTuple& proto,
+    const IPL4asp__Types::OptionList& options)
+  {
+    return f__IPL4__PROVIDER__connect(portRef, remName, remPort,
+                                      locName, locPort, connId, proto, options);
+  }
+
+  IPL4asp__Types::Result f__IPL4__close(
+    TRXC__CodecPort::TRXC__CODEC__PT& portRef, 
+    const IPL4asp__Types::ConnectionId& connId, 
+    const IPL4asp__Types::ProtoTuple& proto)
+  {
+      return f__IPL4__PROVIDER__close(portRef, connId, proto);
+  }
+
+  IPL4asp__Types::Result f__IPL4__setUserData(
+    TRXC__CodecPort::TRXC__CODEC__PT& portRef,
+    const IPL4asp__Types::ConnectionId& connId,
+    const IPL4asp__Types::UserData& userData)
+  {
+    return f__IPL4__PROVIDER__setUserData(portRef, connId, userData);
+  }
+  
+  IPL4asp__Types::Result f__IPL4__getUserData(
+    TRXC__CodecPort::TRXC__CODEC__PT& portRef,
+    const IPL4asp__Types::ConnectionId& connId,
+    IPL4asp__Types::UserData& userData)
+  {
+    return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
+  }
+
+}
diff --git a/library/TRXC_Types.ttcn b/library/TRXC_Types.ttcn
new file mode 100644
index 0000000..c12e5d2
--- /dev/null
+++ b/library/TRXC_Types.ttcn
@@ -0,0 +1,74 @@
+module TRXC_Types {
+
+import from Osmocom_Types all;
+
+type charstring TrxcType ("CMD", "RSP", "IND") with {
+	variant "TEXT_CODING(,convert=upper_case,'((CMD)|(RSP)|(IND))',case_insensitive)"
+}
+
+type charstring TrxcVerb ("POWERON", "POWEROFF", "CLOCK",
+			  "RXTUNE", "TXTUNE", "SETSLOT", "SETTSC", "SETBSIC", "SETPOWER",
+			  "SETMAXDLY", "SETMAXDLYNB", "SETSLOT", "HANDOVER", "NOHANDOVER",
+			  "MEASURE", "FAKE_RSSI", "FAKE_TIMING" ) with {
+	variant "TEXT_CODING(,convert=upper_case,
+			'((POWERON)|(POWEROFF)|(CLOCK)|(RXTUNE)|(TXTUNE)|(SETSLOT)|(SETTSC)|(SETBSIC)|(SETPOWER)|(SETMAXDLY)|(SETMAXDLYNB)|(HANDOVER)|(NOHANDOVER)|(MEASURE)|(FAKE_RSSI)|(FAKE_TIMING))'
+			,case_insensitive)"
+}
+
+type integer TrxcStatus;
+type charstring TrxcParam;
+type record of TrxcParam TrxcParams;
+
+type record TrxcCommand {
+	TrxcVerb	verb,
+	TrxcParams	params optional
+} with {
+	variant "SEPARATOR(' ', ' ')"
+}
+
+type record TrxcResponse {
+	TrxcVerb	verb,
+	TrxcStatus	status,
+	TrxcParams	params optional
+} with {
+	variant "SEPARATOR(' ', ' ')"
+}
+
+type record TrxcIndication {
+	TrxcVerb	verb,
+	TrxcParams	params optional
+} with {
+	variant "SEPARATOR(' ', ' ')"
+}
+
+type union TrxcMessage {
+	TrxcCommand	cmd,
+	TrxcResponse	rsp,
+	TrxcIndication	ind
+} with {
+	variant (cmd) "BEGIN('CMD ')"
+	variant (rsp) "BEGIN('RSP ')"
+	variant (ind) "BEGIN('IND ')"
+}
+
+external function enc_TrxcMessage(in TrxcMessage id) return charstring
+	with { extension "prototype(convert) encode(TEXT)" };
+external function dec_TrxcMessage(in charstring id) return TrxcMessage
+	with { extension "prototype(convert) decode(TEXT)" };
+
+template (value) TrxcMessage ts_TRXC_FAKE_RSSI(uint8_t rssi) := {
+	cmd := {
+		verb := "FAKE_RSSI",
+		params := { int2str(rssi) }
+	}
+}
+
+template (value) TrxcMessage ts_TRXC_FAKE_TIMING(int16_t timing) := {
+	cmd := {
+		verb := "FAKE_TIMING",
+		params := { int2str(timing) }
+	}
+}
+
+
+} with { encode "TEXT" }

-- 
To view, visit https://gerrit.osmocom.org/6872
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b5e81693e5cf8ee8a2c360bde8b16c5276d2297
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list