summaryrefslogtreecommitdiffstats
path: root/library/NS_CodecPort.ttcn
blob: 82ba55bb872788621b00da80976978224529e068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module NS_CodecPort {

	import from IPL4asp_PortType all;
	import from IPL4asp_Types all;
	import from NS_Types all;

	type record NS_RecvFrom {
		ConnectionId	connId,
		HostName	remName,
		PortNumber	remPort,
		HostName	locName,
		PortNumber	locPort,
		PDU_NS		msg
	}

	template NS_RecvFrom t_NS_RecvFrom(template PDU_NS pdu) := {
		connId := ?,
		remName := ?,
		remPort := ?,
		locName := ?,
		locPort := ?,
		msg := pdu
	};

	type record NS_Send {
		ConnectionId	connId,
		PDU_NS		msg
	}

	template NS_Send t_NS_Send(template ConnectionId connId, template PDU_NS msg) := {
		connId := connId,
		msg := 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_PDU_NS(pin.msg);
	} with { extension "prototype(fast)" };

	private function NS_to_IPL4_Send(in NS_Send pin, out ASP_Send pout) {
		pout.connId := pin.connId;
		pout.proto := { udp := {} };
		pout.msg := enc_PDU_NS(pin.msg);
	} with { extension "prototype(fast)" };

	type port NS_CODEC_PT message {
		out	NS_Send;
		in	NS_RecvFrom,
			ASP_ConnId_ReadyToRelease,
			ASP_Event;
	} with { extension "user IPL4asp_PT
		out(NS_Send -> ASP_Send: function(NS_to_IPL4_Send))
		in(ASP_RecvFrom -> NS_RecvFrom: function(IPL4_to_NS_RecvFrom);
		   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
		   ASP_Event -> ASP_Event: simple)"
	}
}