diff options
Diffstat (limited to 'library/MSLookup_mDNS_Templates.ttcn')
-rw-r--r-- | library/MSLookup_mDNS_Templates.ttcn | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/library/MSLookup_mDNS_Templates.ttcn b/library/MSLookup_mDNS_Templates.ttcn index e2426fab..e8158eb6 100644 --- a/library/MSLookup_mDNS_Templates.ttcn +++ b/library/MSLookup_mDNS_Templates.ttcn @@ -45,6 +45,38 @@ template MSLookup_mDNS t_MSLookup_mDNS_query(integer id, charstring domain) := { udpPort := 4266 } +template MSLookup_mDNS tr_MSLookup_mDNS_query(charstring domain) := { + dnsMessage := { + header := { + id := ?, + qr := DNS_QUERY, + opCode := 0, + aa := false, + tc := false, + rd := false, + ra := false, + z := '000'B, + rCode := DNS_NO_ERROR, + qdCount := 1, + anCount := 0, + nsCount := 0, + arCount := 0 + }, + queries := { + { + qName := domain, + qType := 255, + qClass := DNS_IN + } + }, + answers := {}, + nameServerRecords := {}, + additionalRecords := {} + }, + udpAddress := ?, + udpPort := ? +} + template MSLookup_mDNS tr_MSLookup_mDNS_result_IPv4(integer id, charstring domain, UInt32 ip_v4, integer port_v4) := { dnsMessage := { header := { @@ -96,4 +128,55 @@ template MSLookup_mDNS tr_MSLookup_mDNS_result_IPv4(integer id, charstring domai udpPort := ? } +template MSLookup_mDNS t_MSLookup_mDNS_result_IPv4(integer id, charstring domain, UInt32 ip_v4, integer port_v4) := { + dnsMessage := { + header := { + id := id, + qr := DNS_RESPONSE, + opCode := DNS_OP_QUERY, + aa := false, + tc := false, + rd := false, + ra := false, + z := '000'B, + rCode := DNS_NO_ERROR, + qdCount := 0, + anCount := 3, + nsCount := 0, + arCount := 0 + }, + queries := {}, + answers := { + { + name := domain, + rrType := DNS_TXT, + rrClass := DNS_IN, + ttl := '00000000'O, + rdLength := 6, + rData := {txt := {"age=0"}} + }, + { + name := domain, + rrType := DNS_A, + rrClass := DNS_IN, + ttl := '00000000'O, + rdLength := 4, + rData := {a := ip_v4} + }, + { + name := domain, + rrType := DNS_TXT, + rrClass := DNS_IN, + ttl := '00000000'O, + rdLength := 1 + lengthof("port=" & int2str(port_v4)), + rData := {txt := {"port=" & int2str(port_v4)}} + } + }, + nameServerRecords := {}, + additionalRecords := {} + }, + udpAddress := "239.192.23.42", + udpPort := 4266 +} + } |