• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DNSRecordType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: handleResponse

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Handle an incoming response. Cache answers, and pass them on to the appropriate questions.
 *
 * @exception IOException
 */
void handleResponse(DNSIncoming msg) throws IOException {
    final long now = System.currentTimeMillis();

    boolean hostConflictDetected = false;
    boolean serviceConflictDetected = false;

    for (DNSRecord newRecord : msg.getAllAnswers()) {
        this.handleRecord(newRecord, now);

        if (DNSRecordType.TYPE_A.equals(newRecord.getRecordType()) || DNSRecordType.TYPE_AAAA.equals(newRecord.getRecordType())) {
            hostConflictDetected |= newRecord.handleResponse(this);
        } else {
            serviceConflictDetected |= newRecord.handleResponse(this);
        }

    }

    if (hostConflictDetected || serviceConflictDetected) {
        this.startProber();
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:27,代码来源:JmDNSImpl.java


示例2: getDNSEntry

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Get a matching DNS entry from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return DNSEntry
 */
public DNSEntry getDNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass) {
    DNSEntry result = null;
    Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name);
    if (entryList != null) {
        synchronized (entryList) {
            for (DNSEntry testDNSEntry : entryList) {
                if (testDNSEntry.matchRecordType(type) && testDNSEntry.matchRecordClass(recordClass)) {
                    result = testDNSEntry;
                    break;
                }
            }
        }
    }
    return result;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:24,代码来源:DNSCache.java


示例3: getDNSEntryList

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Get all matching DNS entries from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return list of entries
 */
public Collection<? extends DNSEntry> getDNSEntryList(String name, DNSRecordType type, DNSRecordClass recordClass) {
    Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name);
    if (entryList != null) {
        synchronized (entryList) {
            entryList = new ArrayList<DNSEntry>(entryList);
            for (Iterator<? extends DNSEntry> i = entryList.iterator(); i.hasNext();) {
                DNSEntry testDNSEntry = i.next();
                if (!testDNSEntry.matchRecordType(type) || (!testDNSEntry.matchRecordClass(recordClass))) {
                    i.remove();
                }
            }
        }
    } else {
        entryList = Collections.emptyList();
    }
    return entryList;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:26,代码来源:DNSCache.java


示例4: addAnswers

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@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,代码行数:18,代码来源:DNSQuestion.java


示例5: newQuestion

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Create a question.
 *
 * @param name
 *            DNS name to be resolved
 * @param type
 *            Record type to resolve
 * @param recordClass
 *            Record class to resolve
 * @param unique
 *            Request unicast response (Currently not supported in this implementation)
 * @return new question
 */
public static DNSQuestion newQuestion(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) {
    switch (type) {
        case TYPE_A:
            return new DNS4Address(name, type, recordClass, unique);
        case TYPE_A6:
            return new DNS6Address(name, type, recordClass, unique);
        case TYPE_AAAA:
            return new DNS6Address(name, type, recordClass, unique);
        case TYPE_ANY:
            return new AllRecords(name, type, recordClass, unique);
        case TYPE_HINFO:
            return new HostInformation(name, type, recordClass, unique);
        case TYPE_PTR:
            return new Pointer(name, type, recordClass, unique);
        case TYPE_SRV:
            return new Service(name, type, recordClass, unique);
        case TYPE_TXT:
            return new Text(name, type, recordClass, unique);
        default:
            return new DNSQuestion(name, type, recordClass, unique);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:36,代码来源:DNSQuestion.java


示例6: addAnswers

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@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,代码行数:21,代码来源:DNSQuestion.java


示例7: getDNSEntryList

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Get all matching DNS entries from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return list of entries
 */
public synchronized Collection<? extends DNSEntry> getDNSEntryList(String name, DNSRecordType type, DNSRecordClass recordClass) {
    Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name);
    if (entryList != null) {
        entryList = new ArrayList<DNSEntry>(entryList);
        for (Iterator<? extends DNSEntry> i = entryList.iterator(); i.hasNext();) {
            DNSEntry testDNSEntry = i.next();
            if (!testDNSEntry.getRecordType().equals(type) || ((DNSRecordClass.CLASS_ANY != recordClass) && !testDNSEntry.getRecordClass().equals(recordClass))) {
                i.remove();
            }
        }
    } else {
        entryList = Collections.emptyList();
    }
    return entryList;
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:24,代码来源:DNSCache.java


示例8: addAnswers

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@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,代码行数:18,代码来源:DNSQuestion.java


示例9: newQuestion

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Create a question.
 * 
 * @param name
 *            DNS name to be resolved
 * @param type
 *            Record type to resolve
 * @param recordClass
 *            Record class to resolve
 * @param unique
 *            Request unicast response (Currently not supported in this implementation)
 * @return new question
 */
public static DNSQuestion newQuestion(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) {
    switch (type) {
        case TYPE_A:
            return new DNS4Address(name, type, recordClass, unique);
        case TYPE_A6:
            return new DNS6Address(name, type, recordClass, unique);
        case TYPE_AAAA:
            return new DNS6Address(name, type, recordClass, unique);
        case TYPE_ANY:
            return new AllRecords(name, type, recordClass, unique);
        case TYPE_HINFO:
            return new HostInformation(name, type, recordClass, unique);
        case TYPE_PTR:
            return new Pointer(name, type, recordClass, unique);
        case TYPE_SRV:
            return new Service(name, type, recordClass, unique);
        case TYPE_TXT:
            return new Text(name, type, recordClass, unique);
        default:
            return new DNSQuestion(name, type, recordClass, unique);
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:36,代码来源:DNSQuestion.java


示例10: addAnswers

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@Override
protected DNSOutgoing addAnswers(DNSOutgoing out) throws IOException
{
    DNSOutgoing newOut = out;
    if (!_info.hasData())
    {
        long now = System.currentTimeMillis();
        newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN), now);
        newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN), now);
        if (_info.getServer().length() > 0)
        {
            newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN), now);
            newOut = this.addAnswer(newOut, (DNSRecord) this.getDns().getCache().getDNSEntry(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN), now);
        }
    }
    return newOut;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:18,代码来源:ServiceInfoResolver.java


示例11: addQuestions

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@Override
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException
{
    DNSOutgoing newOut = out;
    if (!_info.hasData())
    {
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        if (_info.getServer().length() > 0)
        {
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        }
    }
    return newOut;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:17,代码来源:ServiceInfoResolver.java


示例12: getDNSEntry

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Get a matching DNS entry from the table.
 *
 * @param name
 * @param type
 * @param recordClass
 * @return DNSEntry
 */
public synchronized DNSEntry getDNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass)
{
    DNSEntry result = null;
    Collection<? extends DNSEntry> entryList = this.getDNSEntryList(name);
    if (entryList != null)
    {
        for (DNSEntry testDNSEntry : entryList)
        {
            if (testDNSEntry.getRecordType().equals(type) && ((DNSRecordClass.CLASS_ANY == recordClass) || testDNSEntry.getRecordClass().equals(recordClass)))
            {
                result = testDNSEntry;
                break;
            }
        }
    }
    return result;
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:26,代码来源:DNSCache.java


示例13: DNSEntry

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
/**
 * Create an entry.
 */
DNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass, boolean unique) {
    _name = name;
    // _key = (name != null ? name.trim().toLowerCase() : null);
    _recordType = type;
    _dnsClass = recordClass;
    _unique = unique;
    _qualifiedNameMap = ServiceInfoImpl.decodeQualifiedNameMapForType(this.getName());
    String domain = _qualifiedNameMap.get(Fields.Domain);
    String protocol = _qualifiedNameMap.get(Fields.Protocol);
    String application = _qualifiedNameMap.get(Fields.Application);
    String instance = _qualifiedNameMap.get(Fields.Instance).toLowerCase();
    _type = (application.length() > 0 ? "_" + application + "." : "") + (protocol.length() > 0 ? "_" + protocol + "." : "") + domain + ".";
    _key = ((instance.length() > 0 ? instance + "." : "") + _type).toLowerCase();
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:18,代码来源:DNSEntry.java


示例14: buildOutgoingForDNS

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@Override
protected DNSOutgoing buildOutgoingForDNS(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    newOut.addQuestion(DNSQuestion.newQuestion(this.getDns().getLocalHost().getName(), DNSRecordType.TYPE_ANY, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    for (DNSRecord answer : this.getDns().getLocalHost().answers(DNSRecordClass.CLASS_ANY, DNSRecordClass.NOT_UNIQUE, this.getTTL())) {
        newOut = this.addAuthoritativeAnswer(newOut, answer);
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:10,代码来源:Prober.java


示例15: buildOutgoingForInfo

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@Override
protected DNSOutgoing buildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(info.getQualifiedName(), DNSRecordType.TYPE_ANY, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    // the "unique" flag should be not set here because these answers haven't been proven unique yet this means the record will not exactly match the announcement record
    newOut = this.addAuthoritativeAnswer(newOut, new DNSRecord.Service(info.getQualifiedName(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, this.getTTL(), info.getPriority(), info.getWeight(), info.getPort(), this.getDns().getLocalHost()
            .getName()));
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:10,代码来源:Prober.java


示例16: addQuestions

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@Override
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_type, DNSRecordType.TYPE_PTR, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    // newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_type, DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:8,代码来源:ServiceResolver.java


示例17: addQuestions

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
@Override
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException {
    DNSOutgoing newOut = out;
    if (!_info.hasData()) {
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        if (_info.getServer().length() > 0) {
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
            newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
        }
    }
    return newOut;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:14,代码来源:ServiceInfoResolver.java


示例18: getDNSAddressRecord

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
DNSRecord.Address getDNSAddressRecord(DNSRecordType type, boolean unique, int ttl) {
    switch (type) {
        case TYPE_A:
            return this.getDNS4AddressRecord(unique, ttl);
        case TYPE_A6:
        case TYPE_AAAA:
            return this.getDNS6AddressRecord(unique, ttl);
        default:
    }
    return null;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:12,代码来源:HostInfo.java


示例19: getDNSReverseAddressRecord

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
DNSRecord.Pointer getDNSReverseAddressRecord(DNSRecordType type, boolean unique, int ttl) {
    switch (type) {
        case TYPE_A:
            return this.getDNS4ReverseAddressRecord(unique, ttl);
        case TYPE_A6:
        case TYPE_AAAA:
            return this.getDNS6ReverseAddressRecord(unique, ttl);
        default:
    }
    return null;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:12,代码来源:HostInfo.java


示例20: addServiceListener

import javax.jmdns.impl.constants.DNSRecordType; //导入依赖的package包/类
private void addServiceListener(String type, ServiceListener listener, boolean synch) {
    ServiceListenerStatus status = new ServiceListenerStatus(listener, synch);
    final String loType = type.toLowerCase();
    List<ServiceListenerStatus> list = _serviceListeners.get(loType);
    if (list == null) {
        if (_serviceListeners.putIfAbsent(loType, new LinkedList<ServiceListenerStatus>()) == null) {
            if (_serviceCollectors.putIfAbsent(loType, new ServiceCollector(type)) == null) {
                // We have a problem here. The service collectors must be called synchronously so that their cache get cleaned up immediately or we will report .
                this.addServiceListener(loType, _serviceCollectors.get(loType), ListenerStatus.SYNCHONEOUS);
            }
        }
        list = _serviceListeners.get(loType);
    }
    if (list != null) {
        synchronized (list) {
            if (!list.contains(listener)) {
                list.add(status);
            }
        }
    }
    // report cached service types
    final List<ServiceEvent> serviceEvents = new ArrayList<ServiceEvent>();
    Collection<DNSEntry> dnsEntryLits = this.getCache().allValues();
    for (DNSEntry entry : dnsEntryLits) {
        final DNSRecord record = (DNSRecord) entry;
        if (record.getRecordType() == DNSRecordType.TYPE_SRV) {
            if (record.getKey().endsWith(loType)) {
                // Do not used the record embedded method for generating event this will not work.
                // serviceEvents.add(record.getServiceEvent(this));
                serviceEvents.add(new ServiceEventImpl(this, record.getType(), toUnqualifiedName(record.getType(), record.getName()), record.getServiceInfo()));
            }
        }
    }
    // Actually call listener with all service events added above
    for (ServiceEvent serviceEvent : serviceEvents) {
        status.serviceAdded(serviceEvent);
    }
    // Create/start ServiceResolver
    this.startServiceResolver(type);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:41,代码来源:JmDNSImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Solution类代码示例发布时间:2022-05-22
下一篇:
Java QueryResult类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap