Package filius.software.dns
Class DNSNachricht
java.lang.Object
filius.software.dns.DNSNachricht
Das Format einer DNS-Nachricht wird in RFC 1035 beschrieben.
The header contains the following fields:
The answer, authority, and additional sections all share the same format
The header contains the following fields:
- ID
- QR
- OPCODE
- AA
- TC
- RD
- RA
- Z
- RCODE
- QDCOUNT
- ANCOUNT
- NSCOUNT
- ARCOUNT
The answer, authority, and additional sections all share the same format
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intKonstanten fuer den Response-Code: The values have the following interpretation: 0 - No error condition 1 - Format error - The name server was unable to interpret the query. 2 - Server failure - The name server was unable to process this query due to a problem with the name server. 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. 4 - Not Implemented - The name server does not support the requested kind of query. 5 - Refused - The name server refuses to perform the specified operation for policy reasons.static final intKonstanten fuer den Response-Code: The values have the following interpretation: 0 - No error condition 1 - Format error - The name server was unable to interpret the query. 2 - Server failure - The name server was unable to process this query due to a problem with the name server. 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. 4 - Not Implemented - The name server does not support the requested kind of query. 5 - Refused - The name server refuses to perform the specified operation for policy reasons.static final intKonstanten fuer den Response-Code: The values have the following interpretation: 0 - No error condition 1 - Format error - The name server was unable to interpret the query. 2 - Server failure - The name server was unable to process this query due to a problem with the name server. 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. 4 - Not Implemented - The name server does not support the requested kind of query. 5 - Refused - The name server refuses to perform the specified operation for policy reasons.static final intKonstanten fuer den Response-Code: The values have the following interpretation: 0 - No error condition 1 - Format error - The name server was unable to interpret the query. 2 - Server failure - The name server was unable to process this query due to a problem with the name server. 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. 4 - Not Implemented - The name server does not support the requested kind of query. 5 - Refused - The name server refuses to perform the specified operation for policy reasons.static final intKonstanten fuer das Bit im Kopfteil (Header), das indiziert, ob es sich um eine Anfrage (QUERY) oder eine Antwort (RESPONSE) handelt.static final intKonstanten fuer den Response-Code: The values have the following interpretation: 0 - No error condition 1 - Format error - The name server was unable to interpret the query. 2 - Server failure - The name server was unable to process this query due to a problem with the name server. 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. 4 - Not Implemented - The name server does not support the requested kind of query. 5 - Refused - The name server refuses to perform the specified operation for policy reasons.static final intKonstanten fuer das Bit im Kopfteil (Header), das indiziert, ob es sich um eine Anfrage (QUERY) oder eine Antwort (RESPONSE) handelt.static final intKonstanten fuer den Response-Code: The values have the following interpretation: 0 - No error condition 1 - Format error - The name server was unable to interpret the query. 2 - Server failure - The name server was unable to process this query due to a problem with the name server. 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. 4 - Not Implemented - The name server does not support the requested kind of query. 5 - Refused - The name server refuses to perform the specified operation for policy reasons. -
Constructor Summary
ConstructorsConstructorDescriptionDNSNachricht(int queryResponse) Konstruktor zur Erzeugung einer DNS-Nachricht mit Standardwerten.DNSNachricht(String nachricht) Ein Konstruktor, der aus einem String, der durch den Aufruf der Methode toString() erzeugt wurde, wieder eine DNSNachricht erstellt. -
Method Summary
Modifier and TypeMethodDescriptionintgetId()intintintvoidvoidhinzuAntwortResourceRecord(String record) Diese Methode fuegt der DNS-Nachricht einen Resource Record hinzu.voidvoidDiese Methode fuegt der DNS-Nachricht einen Resource Record hinzu.voidvoidhinzuQuery(String anfrage) Methode zum hinzufuegen einer Anfrage (query).Methode fuer den Zugriff auf die Resource-Records in der 'answer section'.Methode fuer den Zugriff auf die Resource-Records in der 'authority section'.Methode fuer den Zugriff auf die Anfragen (queries)retrieve all resource records no matter what section they are inMethode fuer den Zugriff auf die Resource-Records in der 'additional section'.booleanbooleanisLocal()booleanbooleanbooleanvoidsetAuthoritativeAnswer(boolean authoritativeAnswer) voidsetId(int id) voidsetLocal()voidsetOpcode(int opcode) voidsetQueryResponse(int queryResponse) voidsetRecursionAvailable(boolean recursionAvailable) voidsetRecursionDesired(boolean recursionDesired) voidsetResponseCode(int responseCode) voidsetTruncated(boolean truncated) toString()Diese Methode liefert die Nachricht mit ausgewaehlten Attributen des Kopfteils in der Form <Attribut>=<Wert> (z.
-
Field Details
-
QUERY
public static final int QUERYKonstanten fuer das Bit im Kopfteil (Header), das indiziert, ob es sich um eine Anfrage (QUERY) oder eine Antwort (RESPONSE) handelt.- See Also:
-
RESPONSE
public static final int RESPONSEKonstanten fuer das Bit im Kopfteil (Header), das indiziert, ob es sich um eine Anfrage (QUERY) oder eine Antwort (RESPONSE) handelt.- See Also:
-
NO_ERROR
public static final int NO_ERRORKonstanten fuer den Response-Code: The values have the following interpretation:- 0 - No error condition
- 1 - Format error - The name server was unable to interpret the query.
- 2 - Server failure - The name server was unable to process this query due to a problem with the name server.
- 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
- 4 - Not Implemented - The name server does not support the requested kind of query.
- 5 - Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.
- See Also:
-
FORMAT_ERROR
public static final int FORMAT_ERRORKonstanten fuer den Response-Code: The values have the following interpretation:- 0 - No error condition
- 1 - Format error - The name server was unable to interpret the query.
- 2 - Server failure - The name server was unable to process this query due to a problem with the name server.
- 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
- 4 - Not Implemented - The name server does not support the requested kind of query.
- 5 - Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.
- See Also:
-
SERVER_FAILURE
public static final int SERVER_FAILUREKonstanten fuer den Response-Code: The values have the following interpretation:- 0 - No error condition
- 1 - Format error - The name server was unable to interpret the query.
- 2 - Server failure - The name server was unable to process this query due to a problem with the name server.
- 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
- 4 - Not Implemented - The name server does not support the requested kind of query.
- 5 - Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.
- See Also:
-
NAME_ERROR
public static final int NAME_ERRORKonstanten fuer den Response-Code: The values have the following interpretation:- 0 - No error condition
- 1 - Format error - The name server was unable to interpret the query.
- 2 - Server failure - The name server was unable to process this query due to a problem with the name server.
- 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
- 4 - Not Implemented - The name server does not support the requested kind of query.
- 5 - Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.
- See Also:
-
NOT_IMPLEMENTED
public static final int NOT_IMPLEMENTEDKonstanten fuer den Response-Code: The values have the following interpretation:- 0 - No error condition
- 1 - Format error - The name server was unable to interpret the query.
- 2 - Server failure - The name server was unable to process this query due to a problem with the name server.
- 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
- 4 - Not Implemented - The name server does not support the requested kind of query.
- 5 - Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.
- See Also:
-
REFUSED
public static final int REFUSEDKonstanten fuer den Response-Code: The values have the following interpretation:- 0 - No error condition
- 1 - Format error - The name server was unable to interpret the query.
- 2 - Server failure - The name server was unable to process this query due to a problem with the name server.
- 3 - Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
- 4 - Not Implemented - The name server does not support the requested kind of query.
- 5 - Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.
- See Also:
-
-
Constructor Details
-
DNSNachricht
public DNSNachricht(int queryResponse) Konstruktor zur Erzeugung einer DNS-Nachricht mit Standardwerten. Lediglich ob es sich um eine Anfrage oder eine Antwort handelt, muss als Parameter uebergeben werden. Dazu werden die Konstanten QUERY und RESPONSE verwendet. -
DNSNachricht
Ein Konstruktor, der aus einem String, der durch den Aufruf der Methode toString() erzeugt wurde, wieder eine DNSNachricht erstellt.- Parameters:
nachricht- ein String, der durch die Methode toString() erstellt wurde
-
-
Method Details
-
toString
Diese Methode liefert die Nachricht mit ausgewaehlten Attributen des Kopfteils in der Form <Attribut>=<Wert> (z. B. "ID=42"), die durch Leerzeichen getrennt sind, und den Datenteil, der durch einen Zeilenumbruch vom Kopfteil abgetrennt ist. -
hinzuQuery
Methode zum hinzufuegen einer Anfrage (query). Das Format muss folgendermassen sein: NAME TYPE CLASS (Bsp.: web.de. A IN) -
holeQueries
Methode fuer den Zugriff auf die Anfragen (queries) -
holeAntwortResourceRecords
Methode fuer den Zugriff auf die Resource-Records in der 'answer section'. -
holeAuthoritativeResourceRecords
Methode fuer den Zugriff auf die Resource-Records in der 'authority section'. -
holeZusatzResourceRecords
Methode fuer den Zugriff auf die Resource-Records in der 'additional section'. -
holeResourceRecords
retrieve all resource records no matter what section they are in -
hinzuAntwortResourceRecord
Diese Methode fuegt der DNS-Nachricht einen Resource Record hinzu. Das Format muss folgendermassen aussehen: NAME TYPE CLASS TTL RDATA (Bsp. web.de. A IN 3600 217.72.195.42) -
hinzuAntwortResourceRecords
-
hinzuAntwortResourceRecord
-
hinzuAuthoritativeResourceRecord
Diese Methode fuegt der DNS-Nachricht einen Resource Record hinzu. Das Format muss folgendermassen aussehen: NAME TYPE CLASS TTL RDATA (Bsp. web.de. A IN 3600 217.72.195.42) -
hinzuAuthoritativeResourceRecords
-
isAuthoritativeAnswer
public boolean isAuthoritativeAnswer()- Returns:
- the authoritativeAnswer
-
setAuthoritativeAnswer
public void setAuthoritativeAnswer(boolean authoritativeAnswer) - Parameters:
authoritativeAnswer- the authoritativeAnswer to set
-
getId
public int getId()- Returns:
- the id
-
setId
public void setId(int id) - Parameters:
id- the id to set
-
getOpcode
public int getOpcode()- Returns:
- the opcode
-
setOpcode
public void setOpcode(int opcode) - Parameters:
opcode- the opcode to set
-
getQueryResponse
public int getQueryResponse()- Returns:
- the queryResponse
-
setQueryResponse
public void setQueryResponse(int queryResponse) - Parameters:
queryResponse- the queryResponse to set
-
isRecursionAvailable
public boolean isRecursionAvailable()- Returns:
- the recursionAvailable
-
setRecursionAvailable
public void setRecursionAvailable(boolean recursionAvailable) - Parameters:
recursionAvailable- the recursionAvailable to set
-
isRecursionDesired
public boolean isRecursionDesired()- Returns:
- the recursionDesired
-
setRecursionDesired
public void setRecursionDesired(boolean recursionDesired) - Parameters:
recursionDesired- the recursionDesired to set
-
getResponseCode
public int getResponseCode()- Returns:
- the responseCode
-
setResponseCode
public void setResponseCode(int responseCode) - Parameters:
responseCode- the responseCode to set
-
isTruncated
public boolean isTruncated()- Returns:
- the truncated
-
setTruncated
public void setTruncated(boolean truncated) - Parameters:
truncated- the truncated to set
-
isLocal
public boolean isLocal() -
setLocal
public void setLocal()
-