Package org.jitsi.dnssec
Class SMessage
- java.lang.Object
-
- org.jitsi.dnssec.SMessage
-
public class SMessage extends java.lang.Object
This class represents a DNS message with validator state and some utility methods.- Author:
- davidb
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SRRset
findAnswerRRset(org.xbill.DNS.Name qname, int qtype, int qclass)
Find an "answer" RRset.SRRset
findRRset(org.xbill.DNS.Name name, int type, int dclass, int section)
Find a specific (S)RRset in a given section.java.lang.String
getBogusReason()
Gets the reason why this messages' status is bogus.int
getCount(int section)
Gets the number of records.org.xbill.DNS.Header
getHeader()
Gets the header of this message.org.xbill.DNS.Message
getMessage()
Gets this message as a standard DNSJAVA message.org.xbill.DNS.Record
getQuestion()
Gets the question section of this message.int
getRcode()
Gets the result code of the response message.java.util.List<SRRset>
getSectionRRsets(int section)
Gets signed RRsets for the queried section.SRRset[]
getSectionRRsets(int section, int qtype)
Gets signed RRsets for the queried section.SecurityStatus
getStatus()
Gets the security status of this message.void
setBogus(java.lang.String reason)
Sets the security status of this message to bogus and sets the reason.void
setStatus(SecurityStatus status)
Sets the security status for this message.void
setStatus(SecurityStatus status, java.lang.String reason)
Sets the security status for this message.
-
-
-
Constructor Detail
-
SMessage
public SMessage(org.xbill.DNS.Header h)
Creates a instance of this class.- Parameters:
h
- The header of the original message.
-
SMessage
public SMessage(int id, org.xbill.DNS.Record question)
Creates a new instance of this class.- Parameters:
id
- The ID of the DNS query or response message.question
- The question section of the query or response.
-
SMessage
public SMessage(org.xbill.DNS.Message m)
Creates a new instance of this class.- Parameters:
m
- The DNS message to wrap.
-
-
Method Detail
-
getHeader
public org.xbill.DNS.Header getHeader()
Gets the header of this message.- Returns:
- The header of this message.
-
getQuestion
public org.xbill.DNS.Record getQuestion()
Gets the question section of this message.- Returns:
- The question section of this message.
-
getSectionRRsets
public java.util.List<SRRset> getSectionRRsets(int section)
Gets signed RRsets for the queried section.- Parameters:
section
- The section whose RRsets are demanded.- Returns:
- Signed RRsets for the queried section.
-
getSectionRRsets
public SRRset[] getSectionRRsets(int section, int qtype)
Gets signed RRsets for the queried section.- Parameters:
section
- The section whose RRsets are demanded.qtype
- Filter the results for these record types.- Returns:
- Signed RRsets for the queried section.
-
getRcode
public int getRcode()
Gets the result code of the response message.- Returns:
- The result code of the response message.
-
getStatus
public SecurityStatus getStatus()
Gets the security status of this message.- Returns:
- The security status of this message.
-
setStatus
public void setStatus(SecurityStatus status)
Sets the security status for this message.- Parameters:
status
- the new security status for this message.
-
setStatus
public void setStatus(SecurityStatus status, java.lang.String reason)
Sets the security status for this message.- Parameters:
status
- the new security status for this message.reason
- Why this message's status is set as indicated.
-
getBogusReason
public java.lang.String getBogusReason()
Gets the reason why this messages' status is bogus.- Returns:
- The reason why this messages' status is bogus.
-
setBogus
public void setBogus(java.lang.String reason)
Sets the security status of this message to bogus and sets the reason.- Parameters:
reason
- Why this message's status is bogus.
-
getMessage
public org.xbill.DNS.Message getMessage()
Gets this message as a standard DNSJAVA message.- Returns:
- This message as a standard DNSJAVA message.
-
getCount
public int getCount(int section)
Gets the number of records.- Parameters:
section
- The section for which the records are counted.- Returns:
- The number of records for the queried section.
-
findRRset
public SRRset findRRset(org.xbill.DNS.Name name, int type, int dclass, int section)
Find a specific (S)RRset in a given section.- Parameters:
name
- the name of the RRset.type
- the type of the RRset.dclass
- the class of the RRset.section
- the section to look in (ANSWER to ADDITIONAL)- Returns:
- The SRRset if found, null otherwise.
-
findAnswerRRset
public SRRset findAnswerRRset(org.xbill.DNS.Name qname, int qtype, int qclass)
Find an "answer" RRset. This will look for RRsets in the ANSWER section that match the <qname,qtype,qclass>, without considering CNAMEs.- Parameters:
qname
- The starting search name.qtype
- The search type.qclass
- The search class.- Returns:
- a SRRset matching the query.
-
-