Pike v8.0 release 1738

Method Protocols.DNS.protocol()->decode_entries()


Method decode_entries

array decode_entries(string s, int num, array(int) next)

Description

Decode a set of entries from an answer.

Parameter s

Encoded entries.

Parameter num

Number of entires in s.

Parameter next

Array with a single element containing the start position in s on entry and the continuation position on return.

Returns

Returns an array of mappings describing the decoded entires:

Array
mapping 0..

Mapping describing a single entry:

"name" : string

Name the entry concerns.

"type" : EntryType

Type of entry.

"cl" : ResourceClass

Resource class. Typically C_IN.

"ttl" : int

Time to live for the entry in seconds.

"len" : int

Length in bytes of the encoded data section.

Depending on the type of entry the mapping may contain different additional fields:

T_CNAME
"cname" : string
T_PTR
"ptr" : string
T_NS
"ns" : string
T_MX
"preference" : int
"mx" : string
T_HINFO
"cpu" : string
"os" : string
T_SRV

RFC 2052 and RFC 2782.

"priority" : int
"weight" : int
"port" : int
"target" : string
"service" : string
"proto" : string
"name" : string
T_A
"a" : string

IPv4-address in dotted-decimal format.

T_AAAA
"aaaa" : string

IPv6-address in colon-separated hexadecimal format.

T_LOC
"version" : int

Version, currently only version 0 (zero) is supported.

"size" : int 
"h_perc" : int 
"v_perc" : int 
"lat" : int 
"long" : int 
"alt" : int 
T_SOA
"mname" : string 
"rname" : string 
"serial" : int 
"refresh" : int 
"retry" : int 
"expire" : int 
"minimum" : int

Note: For historical reasons this entry is named "minimum", but it contains the TTL for negative answers (RFC 2308).

T_NAPTR
"order" : int
"preference" : int
"flags" : string
"service" : string
"regexp" : string
"replacement" : string
T_TXT
"txt" : string

Note: For historical reasons, when receiving decoded DNS entries from a client, this will be the first string in the TXT record only.

"txta" : string

When receiving decoded DNS data from a client, txta is the array of all strings in the record. When sending multiple strings in a TXT record in a server, please supply an array as "txt" containing the strings, txta will be ignored.

T_SPF
"spf" : string