|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.bb.dp.capsd.plugin.TestForDnsServer
Tests if a node is a DNS server. Sends a DNS address request for localhost and expects a response of the IP address. The request is retries 3 times.
Field Summary | |
private static String |
CAPABILITY_NAME
The capability name. |
private static int |
DEFAULT_PORT
The port on which the host is checked to see if it supports DNS. |
Constructor Summary | |
TestForDnsServer()
The Default constructor. |
Method Summary | |
String |
getCapabilityName()
Returns the capability string. |
private void |
getResponse(DNSAddressRequest request,
DatagramSocket socket)
Receives the data packet and retrieves the address from the packet. |
boolean |
isProtocolSupported(InetAddress host)
Returns true if the address is a DNS server. |
boolean |
isProtocolSupported(InetAddress host,
int port)
returns true if the address is a DNS server and responds to DNS queries at the specified port |
boolean |
isProtocolSupported(InetAddress host,
int port,
String capName)
returns true only if the address is a DNS server and the capability queried for is 'isDns' and if the interface answers a DNS query on the port number specified. |
boolean |
isProtocolSupported(InetAddress host,
String capName)
Returns true only if the address is a DNS server and the capability queried for is 'isDNS' |
private boolean |
isServer(InetAddress nserver,
int port)
Sends a DNS address request for 'localhost' - if a reply is received, the interface is a DNS server. |
private void |
sendRequest(DNSAddressRequest request,
DatagramSocket socket,
InetAddress nameServer,
int port)
Sends a DNSAddressRequest to the name server. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final String CAPABILITY_NAME
private static int DEFAULT_PORT
Constructor Detail |
public TestForDnsServer()
The Default constructor.
Method Detail |
private void sendRequest(DNSAddressRequest request, DatagramSocket socket, InetAddress nameServer, int port) throws IOException
Sends a DNSAddressRequest to the name server.
request
- The address request to send to the name server.socket
- The datagram socket the request is sent on.nameServer
- The nameserver address for the packet destination.port
- The port number to send the address.IOException
- Thrown if an error occurs while
sending the datagram packet.private void getResponse(DNSAddressRequest request, DatagramSocket socket) throws IOException
Receives the data packet and retrieves the address from the packet.
request
- the DNSAddressRequest whose response is to be gotsocket
- the socket on which the response is recievedIOException
- Thrown if response is not decoded
as expected.private boolean isServer(InetAddress nserver, int port)
Sends a DNS address request for 'localhost' - if a reply is received, the interface is a DNS server.
public boolean isProtocolSupported(InetAddress host)
Returns true if the address is a DNS server.
isProtocolSupported
in interface CapsdPlugin
public boolean isProtocolSupported(InetAddress host, int port)
public boolean isProtocolSupported(InetAddress host, String capName) throws UnsupportedProtocolException
Returns true only if the address is a DNS server and the capability queried for is 'isDNS'
isProtocolSupported
in interface CapsdPlugin
public boolean isProtocolSupported(InetAddress host, int port, String capName) throws UnsupportedProtocolException
returns true only if the address is a DNS server and the capability queried for is 'isDns' and if the interface answers a DNS query on the port number specified.
public String getCapabilityName()
Returns the capability string.
getCapabilityName
in interface CapsdPlugin
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |