blob: d726ce4a69281eed0be1907e77e7a9bc10ce59e4 [file] [log] [blame]
Harald Welte52c713c2017-07-16 15:44:44 +02001/* dual-faced port that wraps an Unixdomain port and encodes/decodes L1CTL */
2module L1CTL_PortType {
3 import from L1CTL_Types all;
4 import from UD_PortType all;
5 import from UD_Types all;
6
7 type record L1CTL_connect {
8 charstring path
9 }
10
11 type record L1CTL_connect_result {
12 UD_Result_code result_code optional,
13 charstring err optional
14 }
15
16 private function L1CTL_to_UD_connect(in L1CTL_connect pin, out UD_connect pout) {
17 pout.path := pin.path;
18 pout.id := 0;
19 } with { extension "prototype(fast)" }
20
21 private function UD_to_L1CTL_connect_result(in UD_connect_result pin, out L1CTL_connect_result pout) {
22 pout.result_code := pin.result.result_code;
23 pout.err := pin.result.err;
24 } with { extension "prototype(fast)" }
25
26 private function L1CTL_to_UD_ul(in L1ctlUlMessage pin, out UD_send_data pout) {
27 var L1ctlUlMessageLV msg_lv := { msg := pin };
28 pout.data := enc_L1ctlUlMessageLV(msg_lv);
29 pout.id := 0;
30 } with { extension "prototype(fast)" }
31
32 private function UD_to_L1CTL_dl(in UD_send_data pin, out L1ctlDlMessage pout) {
33 var L1ctlDlMessageLV msg_lv := dec_L1ctlDlMessageLV(pin.data);
34 pout:= msg_lv.msg;
35 } with { extension "prototype(fast)" }
36
37 type port L1CTL_PT message {
38 out L1ctlUlMessage
39 out L1CTL_connect
40 in L1ctlDlMessage
41 in L1CTL_connect_result
42 in UD_listen_result
43 in UD_connected
44 } with { extension "user UD_PT
45 out(L1ctlUlMessage -> UD_send_data: function(L1CTL_to_UD_ul);
46 L1CTL_connect -> UD_connect: function(L1CTL_to_UD_connect))
47 in(UD_send_data -> L1ctlDlMessage: function(UD_to_L1CTL_dl);
48 UD_connect_result -> L1CTL_connect_result: function(UD_to_L1CTL_connect_result);
49 UD_listen_result -> UD_listen_result: simple;
50 UD_connected -> UD_connected: simple
51 )" }
52}