Package filius.software.dns
Class ResourceRecord
java.lang.Object
filius.software.dns.ResourceRecord
Resource record format
The answer, authority, and additional sections all share the same format: a variable number of resource records, where the number of records is specified in the corresponding count field in the header. Each resource record has the following format: ...
The answer, authority, and additional sections all share the same format: a variable number of resource records, where the number of records is specified in the corresponding count field in the header. Each resource record has the following format: ...
- NAME a domain name to which this resource record pertains.
- TYPE two octets containing one of the RR type codes. This field specifies the meaning of the data in the RDATA field.
- CLASS two octets which specify the class of the data in the RDATA field.
- TTL a 32 bit unsigned integer that specifies the time interval (in seconds) that the resource record may be cached before it should be discarded. Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached.
- RDLENGTH an unsigned 16 bit integer that specifies the length in octets of the RDATA field.
- RDATA a variable length string of octets that describes the resource. The format of this information varies according to the TYPE and CLASS of the resource record. For example, the if the TYPE is A and the CLASS is IN, the RDATA field is a 4 octet ARPA Internet address.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic ResourceRecordstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionResourceRecord(String rr) Ein Konstruktor, der aus einem String, der durch den Aufruf der Methode toString() erzeugt wurde, wieder einen Resource-Record erstellt.ResourceRecord(String domainname, String typ, String rdata) -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceRecordfindApplicableNSRecord(String domainname, List<ResourceRecord> recordList) Find the best matching NS record for the given domain.static ResourceRecordfindRecord(String domainname, String typ, List<ResourceRecord> recordList) Find the exact matching record for given domain and type.static List<ResourceRecord>findRecords(String domainname, String typ, List<ResourceRecord> recordList) Find the exact matching records for given domain and type.getRdata()intgetTtl()getType()booleanisValid()voidsetDomainname(String domainname) voidvoidsetTtl(int ttl) voidtoString()Diese Methode liefert einen Resource Record als String zurueck.
-
Field Details
-
ADDRESS
- See Also:
-
MAIL_EXCHANGE
- See Also:
-
NAME_SERVER
- See Also:
-
LOCALHOST_ADDRESS
-
-
Constructor Details
-
ResourceRecord
-
ResourceRecord
Ein Konstruktor, der aus einem String, der durch den Aufruf der Methode toString() erzeugt wurde, wieder einen Resource-Record erstellt.- Parameters:
rr- ein String, der durch die Methode toString() erstellt wurde
-
-
Method Details
-
isValid
public boolean isValid() -
toString
Diese Methode liefert einen Resource Record als String zurueck. Methode zum Abruf eines Resource Record. Das Rueckgabeformat ist NAME TYPE CLASS TTL RDATA (Bsp. web.de. A IN 3600 217.72.195.42) -
getDomainname
- Returns:
- the domainname
-
setDomainname
- Parameters:
domainname- the domainname to set
-
getRdata
- Returns:
- the rdata
-
setRdata
- Parameters:
rdata- the rdata to set
-
findRecord
public static ResourceRecord findRecord(String domainname, String typ, List<ResourceRecord> recordList) Find the exact matching record for given domain and type.- Parameters:
domainname- the domainname to look for in field domainname of the resource recordtyp- one of A, NS, MXrecordList- the list to search in- Returns:
- the resource record or null if no applicable record could be found
-
findRecords
public static List<ResourceRecord> findRecords(String domainname, String typ, List<ResourceRecord> recordList) Find the exact matching records for given domain and type.- Parameters:
domainname- the domainname to look for in field domainname of the resource recordtyp- one of A, NS, MXrecordList- the list to search in- Returns:
- the resource record list, emty if no applicable record could be found
-
findApplicableNSRecord
public static ResourceRecord findApplicableNSRecord(String domainname, List<ResourceRecord> recordList) Find the best matching NS record for the given domain.- Returns:
- the resource record or null if no applicable record could be found
-
getTtl
public int getTtl()- Returns:
- the ttl
-
setTtl
public void setTtl(int ttl) - Parameters:
ttl- the ttl to set
-
getType
- Returns:
- the type
-
setType
- Parameters:
type- the type to set
-