59 lines
1.4 KiB
Plaintext
59 lines
1.4 KiB
Plaintext
module IPL4_example {
|
|
|
|
import from TunDevice_PortType all;
|
|
import from TunDevice_Types all;
|
|
import from NetfilterConntrack_Functions all;
|
|
import from http_www_netfilter_org_xml_libnetfilter_conntrack all;
|
|
|
|
external function enc_Flow(in Flow pdu) return octetstring
|
|
with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
|
|
external function dec_Flow(in octetstring stream) return Flow
|
|
with { extension "prototype (convert) decode(XER:XER_EXTENDED)" }
|
|
|
|
external function enc_Flows(in Flows pdu) return octetstring
|
|
with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
|
|
external function dec_Flows(in octetstring stream) return Flows
|
|
with { extension "prototype (convert) decode(XER:XER_EXTENDED)" }
|
|
|
|
type component dummy_CT {
|
|
port TunDevice_PT TUN;
|
|
port TunDevice_PT TUN2;
|
|
}
|
|
|
|
testcase TC_xml() runs on dummy_CT {
|
|
var charstring xml;
|
|
xml := f_get_conntracks_xml()
|
|
log(xml)
|
|
log(dec_Flows(unichar2oct(xml)))
|
|
}
|
|
|
|
/*
|
|
var Result result;
|
|
result := IPL4asp_PortType.f_IPL4_listen(IPL4, "127.0.0.1", 2342, {udp := {}})
|
|
if (ispresent(result.errorCode)) {
|
|
setverdict(fail);
|
|
stop;
|
|
}
|
|
*/
|
|
|
|
testcase TC_dummy() runs on dummy_CT {
|
|
map(self:TUN, system:TUN);
|
|
map(self:TUN2, system:TUN);
|
|
|
|
var Tun_send s
|
|
|
|
s.msg := unichar2oct("foo")
|
|
TUN.send(s);
|
|
|
|
s.msg := unichar2oct("bar")
|
|
TUN2.send(s);
|
|
|
|
setverdict(pass);
|
|
}
|
|
|
|
control {
|
|
execute(TC_xml());
|
|
execute(TC_dummy());
|
|
}
|
|
}
|