Package de.measite.minidns
Class Record
- java.lang.Object
-
- de.measite.minidns.Record
-
public class Record extends java.lang.ObjectA generic DNS record.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRecord.CLASSThe symbolic class of a DNS record (usually IN for Internet).static classRecord.TYPEThe record type.
-
Field Summary
Fields Modifier and Type Field Description protected Record.CLASSclazzThe record class (usually CLASS.IN).private static java.util.logging.LoggerLOGGERprotected java.lang.StringnameThe generic name of this record.protected DatapayloadDataThe payload object of this record.protected longttlThe ttl of this record.protected Record.TYPEtypeThe type (and payload type) of this record.protected booleanunicastQueryMDNS defines the highest bit of the class as the unicast query bit.
-
Constructor Summary
Constructors Constructor Description Record()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()The generic record name, e.g.DatagetPayload()The payload data, usually a subclass of data (A, AAAA, CNAME, ...).longgetTtl()Retrieve the record ttl.booleanisAnswer(Question q)Check if this record answers a given query.booleanisUnicastQuery()See if this query/response was a unicast query (highest class bit set).voidparse(java.io.DataInputStream dis, byte[] data)Parse a given record based on the full message data and the current stream position.java.lang.StringtoString()Retrieve a textual representation of this resource record.
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
name
protected java.lang.String name
The generic name of this record.
-
type
protected Record.TYPE type
The type (and payload type) of this record.
-
clazz
protected Record.CLASS clazz
The record class (usually CLASS.IN).
-
ttl
protected long ttl
The ttl of this record.
-
payloadData
protected Data payloadData
The payload object of this record.
-
unicastQuery
protected boolean unicastQuery
MDNS defines the highest bit of the class as the unicast query bit.
-
-
Method Detail
-
parse
public void parse(java.io.DataInputStream dis, byte[] data) throws java.io.IOExceptionParse a given record based on the full message data and the current stream position.- Parameters:
dis- The DataInputStream positioned at the first record byte.data- The full message data.- Throws:
java.io.IOException- In case of malformed replies.
-
toString
public java.lang.String toString()
Retrieve a textual representation of this resource record.- Overrides:
toStringin classjava.lang.Object- Returns:
- String
-
isAnswer
public boolean isAnswer(Question q)
Check if this record answers a given query.- Parameters:
q- The query.- Returns:
- True if this record is a valid answer.
-
isUnicastQuery
public boolean isUnicastQuery()
See if this query/response was a unicast query (highest class bit set).- Returns:
- True if it is a unicast query/response record.
-
getName
public java.lang.String getName()
The generic record name, e.g. "measite.de".- Returns:
- The record name.
-
getPayload
public Data getPayload()
The payload data, usually a subclass of data (A, AAAA, CNAME, ...).- Returns:
- The payload data.
-
getTtl
public long getTtl()
Retrieve the record ttl.- Returns:
- The record ttl.
-
-