Top Inners Fields Constructors Methods
io.netty.resolver.dns

pack-priv abstract Class DnsResolveContext<T>

extends Object
Class Inheritance
Known Direct Subclasses
io.netty.resolver.dns.DnsAddressResolveContext, io.netty.resolver.dns.DnsRecordResolveContext
Imports
io.netty.buffer.ByteBuf, .ByteBufHolder, io.netty.channel.AddressedEnvelope, .Channel, .EventLoop, io.netty.handler.codec.CorruptedFrameException, io.netty.handler.codec.dns.DefaultDnsQuestion, .DefaultDnsRecordDecoder, .DnsQuestion, .DnsRawRecord, .DnsRecord, .DnsRecordType, .DnsResponse, .DnsResponseCode, .DnsSection, io.netty.util.NetUtil, .ReferenceCountUtil, io.netty.util.concurrent.Future, .FutureListener, .Promise, io.netty.util.internal.ObjectUtil, .PlatformDependent, .StringUtil, .SuppressJava6Requirement, .ThrowableUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.InetAddress, .InetSocketAddress, .UnknownHostException, java.util.AbstractList, .ArrayList, .Arrays, .Collections, .HashMap, .IdentityHashMap, .Iterator, .List, .Locale, .Map, .NoSuchElementException, .Set

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
DnsResolveContext.AuthoritativeNameServerList

Holds the closed DNS Servers for a domain.

private class
private static class
pack-priv static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv final DnsRecord[]
private int
private final Channel
private final Future<? extends Channel>
private static final RuntimeException
private boolean
private final int
private final DnsRecordType[]
private List<T>
private final String
private static final InternalLogger
private static final RuntimeException
private final DnsServerAddressStream
private static final RuntimeException
private static final RuntimeException
private static final RuntimeException
private final Promise<?>
pack-priv final DnsNameResolver
private final Set<Future<AddressedEnvelope<DnsResponse, InetSocketAddress>>>
private static final RuntimeException
private boolean
private static final RuntimeException

Constructor Summary

AccessConstructor and Description
pack-priv
DnsResolveContext(DnsNameResolver parent, Channel channel, Future<? extends Channel> channelReadyFuture, Promise<?> originalPromise, String hostname, int dnsClass, DnsRecordType[] expectedTypes, DnsRecord[] additionals, DnsServerAddressStream nameServerAddrs, int allowedQueries)

Method Summary

Modifier and TypeMethod and Description
pack-priv AuthoritativeDnsServerCache
private static Map<String, String>
pack-priv abstract void
cache(String hostname, DnsRecord[] additionals, DnsRecord result, T convertedResult)

Caches a successful resolution.

pack-priv abstract void
cache(String hostname, DnsRecord[] additionals, UnknownHostException cause)

Caches a failed resolution.

private static Throwable
cause(final DnsResponseCode code)

pack-priv Channel
channel()

The Channel used.

private static void
checkCnameLoop(String hostname, String first, String second)

pack-priv DnsCnameCache
cnameCache()

The DnsCnameCache that is used for resolving.

pack-priv static String
private static String
cnameResolveFromCacheLoop(DnsCnameCache cnameCache, String hostname, String first, String mapping)

pack-priv abstract T
convertRecord(DnsRecord record, String hostname, DnsRecord[] additionals, EventLoop eventLoop)

Converts the given DnsRecord into T.

pack-priv static String
pack-priv void
doSearchDomainQuery(String hostname, Promise<List<T>> nextPromise)

private static DnsResolveContext.AuthoritativeNameServerList
extractAuthoritativeNameServers(String questionName, DnsResponse res)

Returns the {@code AuthoritativeNameServerList which were included in DnsSection#AUTHORITY or null if non are found.

pack-priv abstract List<T>
filterResults(List<T> unfiltered)

Returns a filtered list of results which should be the final result of DNS resolution.

private void
finishResolve(Promise<List<T>> promise, Throwable cause)

private void
followCname(DnsQuestion question, String cname, DnsQueryLifecycleObserver queryLifecycleObserver, Promise<List<T>> promise)

private DnsServerAddressStream
private DnsServerAddressStream
getNameServersFromCache(String hostname)

Returns the DnsServerAddressStream that was cached for the given hostname or null if non could be found.

private boolean
handleRedirect(DnsQuestion question, AddressedEnvelope<DnsResponse, InetSocketAddress> envelope, final DnsQueryLifecycleObserver queryLifecycleObserver, Promise<List<T>> promise)

Handles a redirect answer if needed and returns true if a redirect query has been made.

private boolean
private static String
private void
internalResolve(String name, Promise<List<T>> promise)

pack-priv abstract boolean
isCompleteEarly(T resolved)

pack-priv abstract boolean
isDuplicateAllowed()

Returns true if we should allow duplicates in the result or false if no duplicates should be included.

private DnsQueryLifecycleObserver
pack-priv abstract DnsResolveContext<T>
newResolverContext(DnsNameResolver parent, Channel channel, Future<? extends Channel> channelReadyFuture, Promise<?> originalPromise, String hostname, int dnsClass, DnsRecordType[] expectedTypes, DnsRecord[] additionals, DnsServerAddressStream nameServerAddrs, int allowedQueries)

Creates a new context with the given parameters.

private void
private void
onResponse(final DnsServerAddressStream nameServerAddrStream, final int nameServerAddrStreamIndex, final DnsQuestion question, AddressedEnvelope<DnsResponse, InetSocketAddress> envelope, final DnsQueryLifecycleObserver queryLifecycleObserver, Promise<List<T>> promise)

private void
onResponseCNAME(DnsQuestion question, Map<String, String> cnames, final DnsQueryLifecycleObserver queryLifecycleObserver, Promise<List<T>> promise)

private void
query(final DnsServerAddressStream nameServerAddrStream, final int nameServerAddrStreamIndex, final DnsQuestion question, final DnsQueryLifecycleObserver queryLifecycleObserver, final boolean flush, final Promise<List<T>> promise, final Throwable cause)

private boolean
query(String hostname, DnsRecordType type, DnsServerAddressStream dnsServerAddressStream, boolean flush, Promise<List<T>> promise)

private void
queryUnresolvedNameServer(final InetSocketAddress nameServerAddr, final DnsServerAddressStream nameServerAddrStream, final int nameServerAddrStreamIndex, final DnsQuestion question, final DnsQueryLifecycleObserver queryLifecycleObserver, final Promise<List<T>> promise, final Throwable cause)

private static AuthoritativeDnsServerCache
pack-priv void
resolve(final Promise<List<T>> promise)

pack-priv DnsCache
resolveCache()

The DnsCache to use while resolving.

private void
tryToFinishResolve(final DnsServerAddressStream nameServerAddrStream, final int nameServerAddrStreamIndex, final DnsQuestion question, final DnsQueryLifecycleObserver queryLifecycleObserver, final Promise<List<T>> promise, final Throwable cause)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait