gprs_gb: Add NS CodecPort + Emulation; Add NS selftests
diff --git a/gprs_gb/NS_CodecPort.ttcn b/gprs_gb/NS_CodecPort.ttcn
new file mode 100644
index 0000000..735a91f
--- /dev/null
+++ b/gprs_gb/NS_CodecPort.ttcn
@@ -0,0 +1,55 @@
+module NS_CodecPort {
+
+ import from IPL4asp_PortType all;
+ import from IPL4asp_Types all;
+ import from BSSGP_Helper_Functions all;
+ import from NS_Types all;
+
+ type record NS_RecvFrom {
+ ConnectionId connId,
+ HostName remName,
+ PortNumber remPort,
+ HostName locName,
+ PortNumber locPort,
+ NsPdu msg
+ }
+
+ template NS_RecvFrom t_NS_RecvFrom(template NsPdu pdu) := {
+ connId := ?,
+ remName := ?,
+ remPort := ?,
+ locName := ?,
+ locPort := ?,
+ msg := pdu
+ };
+
+ type record NS_Send {
+ ConnectionId connId,
+ NsPdu msg
+ }
+
+ private function IPL4_to_NS_RecvFrom(in ASP_RecvFrom pin, out NS_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_NsPdu(f_NS_expand_len(pin.msg));
+ } with { extension "prototype(fast)" };
+
+ private function NS_to_IPL4_Send(in NS_Send pin, out ASP_SendTo pout) {
+ pout.connId := pin.connId;
+ pout.proto := { udp := {} };
+ pout.msg := f_NS_compact_len(enc_NsPdu(pin.msg));
+ } with { extension "prototype(fast)" };
+
+ type port NS_CODEC_PT message {
+ out NS_Send;
+ in NS_RecvFrom,
+ ASP_Event;
+ } with { extension "user IPL4asp_PT
+ out(NS_Send -> ASP_SendTo: function(NS_to_IPL4_Send))
+ in(ASP_RecvFrom -> NS_RecvFrom: function(IPL4_to_NS_RecvFrom);
+ ASP_Event -> ASP_Event: simple)"
+ }
+}