当前位置: 首页>>代码示例>>Java>>正文


Java DNSRecordType.TYPE_PTR属性代码示例

本文整理汇总了Java中javax.jmdns.impl.constants.DNSRecordType.TYPE_PTR属性的典型用法代码示例。如果您正苦于以下问题:Java DNSRecordType.TYPE_PTR属性的具体用法?Java DNSRecordType.TYPE_PTR怎么用?Java DNSRecordType.TYPE_PTR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.jmdns.impl.constants.DNSRecordType的用法示例。


在下文中一共展示了DNSRecordType.TYPE_PTR属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAnswers

@Override
public void addAnswers(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers) {
    String loname = this.getName().toLowerCase();
    if (jmDNSImpl.getLocalHost().getName().equalsIgnoreCase(loname)) {
        // type = DNSConstants.TYPE_A;
        answers.addAll(jmDNSImpl.getLocalHost().answers(this.getRecordClass(), this.isUnique(), DNSConstants.DNS_TTL));
        return;
    }
    // Service type request
    if (jmDNSImpl.getServiceTypes().containsKey(loname)) {
        DNSQuestion question = new Pointer(this.getName(), DNSRecordType.TYPE_PTR, this.getRecordClass(), this.isUnique());
        question.addAnswers(jmDNSImpl, answers);
        return;
    }

    this.addAnswersForServiceInfo(jmDNSImpl, answers, (ServiceInfoImpl) jmDNSImpl.getServices().get(loname));
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:17,代码来源:DNSQuestion.java

示例2: addAnswers

@Override
public void addAnswers(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers) {
    String loname = this.getName().toLowerCase();
    if (jmDNSImpl.getLocalHost().getName().equalsIgnoreCase(loname)) {
        // type = DNSConstants.TYPE_A;
        answers.addAll(jmDNSImpl.getLocalHost().answers(this.isUnique(), DNSConstants.DNS_TTL));
        return;
    }
    // Service type request
    if (jmDNSImpl.getServiceTypes().containsKey(loname)) {
        DNSQuestion question = new Pointer(this.getName(), DNSRecordType.TYPE_PTR, this.getRecordClass(), this.isUnique());
        question.addAnswers(jmDNSImpl, answers);
        return;
    }

    this.addAnswersForServiceInfo(jmDNSImpl, answers, (ServiceInfoImpl) jmDNSImpl.getServices().get(loname));
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:17,代码来源:DNSQuestion.java

示例3: addAnswers

@Override
public void addAnswers(JmDNSImpl jmDNSImpl, Set<DNSRecord> answers)
{
    String name = this.getName().toLowerCase();
    if (jmDNSImpl.getLocalHost().getName().equalsIgnoreCase(name))
    {
        // type = DNSConstants.TYPE_A;
        answers.addAll(jmDNSImpl.getLocalHost().answers(this.isUnique(), DNSConstants.DNS_TTL));
        return;
    }
    // Service type request
    if (jmDNSImpl.getServiceTypes().containsKey(name))
    {
        DNSQuestion question = new Pointer(this.getName(), DNSRecordType.TYPE_PTR, this.getRecordClass(), this.isUnique());
        question.addAnswers(jmDNSImpl, answers);
        return;
    }

    this.addAnswersForServiceInfo(jmDNSImpl, answers, (ServiceInfoImpl) jmDNSImpl.getServices().get(name));
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:20,代码来源:DNSQuestion.java

示例4: handleRecord

void handleRecord(DNSRecord record, long now) {
    DNSRecord newRecord = record;

    Operation cacheOperation = Operation.Noop;
    final boolean expired = newRecord.isExpired(now);
    if (logger.isLoggable(Level.FINE)) {
        logger.fine(this.getName() + " handle response: " + newRecord);
    }

    // update the cache
    if (!newRecord.isServicesDiscoveryMetaQuery() && !newRecord.isDomainDiscoveryQuery()) {
        final boolean unique = newRecord.isUnique();
        final DNSRecord cachedRecord = (DNSRecord) this.getCache().getDNSEntry(newRecord);
        if (logger.isLoggable(Level.FINE)) {
            logger.fine(this.getName() + " handle response cached record: " + cachedRecord);
        }
        if (unique) {
            for (DNSEntry entry : this.getCache().getDNSEntryList(newRecord.getKey())) {
                if (newRecord.getRecordType().equals(entry.getRecordType()) && newRecord.getRecordClass().equals(entry.getRecordClass()) && (entry != cachedRecord)) {
                    ((DNSRecord) entry).setWillExpireSoon(now);
                }
            }
        }
        if (cachedRecord != null) {
            if (expired) {
                // if the record has a 0 ttl that means we have a cancel record we need to delay the removal by 1s
                if (newRecord.getTTL() == 0) {
                    cacheOperation = Operation.Noop;
                    cachedRecord.setWillExpireSoon(now);
                    // the actual record will be disposed of by the record reaper.
                } else {
                    cacheOperation = Operation.Remove;
                    this.getCache().removeDNSEntry(cachedRecord);
                }
            } else {
                // If the record content has changed we need to inform our listeners.
                if (!newRecord.sameValue(cachedRecord) || (!newRecord.sameSubtype(cachedRecord) && (newRecord.getSubtype().length() > 0))) {
                    if (newRecord.isSingleValued()) {
                        cacheOperation = Operation.Update;
                        this.getCache().replaceDNSEntry(newRecord, cachedRecord);
                    } else {
                        // Address record can have more than one value on multi-homed machines
                        cacheOperation = Operation.Add;
                        this.getCache().addDNSEntry(newRecord);
                    }
                } else {
                    cachedRecord.resetTTL(newRecord);
                    newRecord = cachedRecord;
                }
            }
        } else {
            if (!expired) {
                cacheOperation = Operation.Add;
                this.getCache().addDNSEntry(newRecord);
            }
        }
    }

    // Register new service types
    if (newRecord.getRecordType() == DNSRecordType.TYPE_PTR) {
        // handle DNSConstants.DNS_META_QUERY records
        boolean typeAdded = false;
        if (newRecord.isServicesDiscoveryMetaQuery()) {
            // The service names are in the alias.
            if (!expired) {
                typeAdded = this.registerServiceType(((DNSRecord.Pointer) newRecord).getAlias());
            }
            return;
        }
        typeAdded |= this.registerServiceType(newRecord.getName());
        if (typeAdded && (cacheOperation == Operation.Noop)) {
            cacheOperation = Operation.RegisterServiceType;
        }
    }

    // notify the listeners
    if (cacheOperation != Operation.Noop) {
        this.updateRecord(now, newRecord, cacheOperation);
    }

}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:81,代码来源:JmDNSImpl.java

示例5: Pointer

public Pointer(String name, DNSRecordClass recordClass, boolean unique, int ttl, String alias) {
    super(name, DNSRecordType.TYPE_PTR, recordClass, unique, ttl);
    this._alias = alias;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:4,代码来源:DNSRecord.java

示例6: handleRecord

void handleRecord(DNSRecord record, long now)
{
    DNSRecord newRecord = record;

    Operation cacheOperation = Operation.Noop;
    final boolean expired = newRecord.isExpired(now);
    if (logger.isLoggable(Level.FINE))
    {
        logger.fine(this.getName() + " handle response: " + newRecord);
    }

    // update the cache
    // if ((newRecord.getRecordType() != DNSRecordType.TYPE_PTR) || (!newRecord.isServicesDiscoveryMetaQuery()))
    if (!newRecord.isServicesDiscoveryMetaQuery() && !newRecord.isDomainDiscoveryQuery())
    {
        final DNSRecord cachedRecord = (DNSRecord) this.getCache().getDNSEntry(newRecord);
        if (logger.isLoggable(Level.FINE))
        {
            logger.fine(this.getName() + " handle response cached record: " + cachedRecord);
        }
        if (cachedRecord != null)
        {
            if (expired)
            {
                cacheOperation = Operation.Remove;
                this.getCache().removeDNSEntry(cachedRecord);
            }
            else
            {
                // If the record content has changed we need to inform our listeners.
                if (!newRecord.sameValue(cachedRecord) || (!newRecord.sameSubtype(cachedRecord) && (newRecord.getSubtype().length() > 0)))
                {
                    cacheOperation = Operation.Update;
                    this.getCache().replaceDNSEntry(newRecord, cachedRecord);
                }
                else
                {
                    cachedRecord.resetTTL(newRecord);
                    newRecord = cachedRecord;
                }
            }
        }
        else
        {
            if (!expired)
            {
                cacheOperation = Operation.Add;
                this.getCache().addDNSEntry(newRecord);
            }
        }
    }

    // Register new service types
    if (newRecord.getRecordType() == DNSRecordType.TYPE_PTR)
    {
        // handle DNSConstants.DNS_META_QUERY records
        boolean typeAdded = false;
        if (newRecord.isServicesDiscoveryMetaQuery())
        {
            // The service names are in the alias.
            if (!expired)
            {
                typeAdded = this.registerServiceType(((DNSRecord.Pointer) newRecord).getAlias());
            }
            return;
        }
        typeAdded |= this.registerServiceType(newRecord.getName());
        if (typeAdded && (cacheOperation == Operation.Noop))
        {
            cacheOperation = Operation.RegisterServiceType;
        }
    }

    // notify the listeners
    if (cacheOperation != Operation.Noop)
    {
        this.updateRecord(now, newRecord, cacheOperation);
    }

}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:80,代码来源:JmDNSImpl.java

示例7: Pointer

public Pointer(String name, DNSRecordClass recordClass, boolean unique, int ttl, String alias)
{
    super(name, DNSRecordType.TYPE_PTR, recordClass, unique, ttl);
    this._alias = alias;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:5,代码来源:DNSRecord.java


注:本文中的javax.jmdns.impl.constants.DNSRecordType.TYPE_PTR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。