Class DnsQueryIdSpace


  • final class DnsQueryIdSpace
    extends java.lang.Object
    Special data-structure that will allow to retrieve the next query id to use, while still guarantee some sort of randomness. The query id will be between 0 (inclusive) and 65535 (inclusive) as defined by the RFC.
    • Constructor Detail

      • DnsQueryIdSpace

        DnsQueryIdSpace()
    • Method Detail

      • nextId

        int nextId()
        Returns the next ID to use for a query or -1 if there is none left to use.
        Returns:
        next id to use.
      • pushId

        void pushId​(int id)
        Push back the id, so it can be used again for the next query.
        Parameters:
        id - the id.
      • usableIds

        int usableIds()
        Return how much more usable ids are left.
        Returns:
        the number of ids that are left for usage.
      • maxUsableIds

        int maxUsableIds()
        Return the maximum number of ids that are supported.
        Returns:
        the maximum number of ids.