Tk Library Source Code

Artifact [10492060f6]
Login

Artifact 10492060f690a7b63ede937ee4771b76a1ec8c9f:

Attachment "dns_txt.diff" to ticket [1453327fff] added by teopetuk 2006-03-19 02:22:22.
--- /usr/lib/tcllib1.8/dns/dns.tcl	2006-03-18 22:11:13.596769104 +0300
+++ /usr/local/lib/dns1.3.0/dns.tcl	2006-03-18 21:51:17.164654432 +0300
@@ -1106,6 +1106,9 @@
                     lappend rdata target [ReadName data $x off]
                     incr x $off
                 }
+		TXT {
+		    set rdata [ReadString data $index $rdlength]
+		}
                 SOA {
                     set x $index
                     set rdata [list MNAME [ReadName data $x off]]
@@ -1211,6 +1214,26 @@
     return [join $r .]
 }
 
+proc ::dns::ReadString {datavar index length} {
+    upvar $datavar data
+    set startindex $index
+
+    set r {}
+    set max [expr {$index + $length}]
+
+    while {$index < $max} {
+	binary scan [string range $data $index end] c len
+	set len [expr {$len & 0xFF}]
+	incr index
+
+        if {$len != 0} {
+            append r [string range $data $index [expr {$index + $len - 1}]]
+	    incr index $len
+        }
+    }
+    return $r
+}
+
 # -------------------------------------------------------------------------
 
 # Experimental support for finding the nameservers