Package org.xbill.DNS

Examples of org.xbill.DNS.Name


        response.getHeader().setFlag(Flags.QR);
        if (query.getHeader().getFlag(Flags.RD))
            response.getHeader().setFlag(Flags.RD);
        response.addRecord(queryRecord, Section.QUESTION);

        Name name = queryRecord.getName();
        int type = queryRecord.getType();
        int dclass = queryRecord.getDClass();
        if (!Type.isRR(type) && type != Type.ANY)
            return errorMessage(query, Rcode.NOTIMP);
View Full Code Here


    try {
      Resolver resolver = new ExtendedResolver();
      resolver.setTimeout(timeoutInSeconds);
      resolver.setTCP(true);

      Name name = ReverseMap.fromAddress(hostIp);
      Record record = Record.newRecord(name, Type.PTR, DClass.IN);
      Message response = resolver.send(newQuery(record));

      Record[] answers = response.getSectionArray(Section.ANSWER);
      if (answers.length == 0) {
View Full Code Here

   */
  public static String resolveAddress(String hostIp) throws IOException {
    Resolver res = new ExtendedResolver();
    res.setTimeout(5); // seconds

    Name name = ReverseMap.fromAddress(hostIp);
    int type = Type.PTR;
    int dclass = DClass.IN;
    Record rec = Record.newRecord(name, type, dclass);
    Message query = Message.newQuery(rec);
    Message response = res.send(query);
View Full Code Here

    public Producer createProducer() throws Exception {
        return new DefaultProducer(this) {
            public void process(Exchange exchange) throws Exception {
                SimpleResolver resolver = new SimpleResolver();
                int type = Type.TXT;
                Name name = Name.fromString(String.valueOf(exchange.getIn().getHeader(DnsConstants.TERM)) + ".wp.dg.cx", Name.root);
                Record rec = Record.newRecord(name, type, DClass.IN);
                Message query = Message.newQuery(rec);
                Message response = resolver.send(query);
                Record[] records = response.getSectionArray(Section.ANSWER);
                if (records.length > 0) {
View Full Code Here

                if (dclass == -1) {
                    // by default, value is IN.
                    dclass = DClass.IN;
                }

                Name name = Name.fromString(exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class), Name.root);
                Record rec = Record.newRecord(name, type, dclass);
                Message query = Message.newQuery(rec);
                Message response = resolver.send(query);
                exchange.getOut().setBody(response);
            }
View Full Code Here

   */
  public static String resolveAddress(String hostIp) throws IOException {
    Resolver res = new ExtendedResolver();
    res.setTimeout(5); // seconds

    Name name = ReverseMap.fromAddress(hostIp);
    int type = Type.PTR;
    int dclass = DClass.IN;
    Record rec = Record.newRecord(name, type, dclass);
    Message query = Message.newQuery(rec);
    Message response = res.send(query);
View Full Code Here

                        "NAPTRRecord.toString():" + record.toString());
                }

                String flag = naptrRecord.getFlags();
                String service = naptrRecord.getService();
                Name replacement = naptrRecord.getReplacement();

                if (service.equalsIgnoreCase("E2U+sip") ||
                        service.equalsIgnoreCase("sip+E2U")) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE,
                            "flag:" + naptrRecord.getFlags() + " flaglength:" +
                            naptrRecord.getFlags().length());
                        logger.log(Level.FINE,
                            "regexp:" + naptrRecord.getRegexp() +
                            " replacement:" + replacement);
                    }

                    if (!EnumUtil.isEmpty(replacement) && (flag.length() == 0)) {
                        return lookupTelUrlNAPTRRecord(AUS,
                            replacement.toString(), visited, ++depth);
                    }

                    String substitution = EnumUtil.applyRegExp(AUS,
                            naptrRecord.getRegexp());
View Full Code Here

     */
    @Converter
    public static Record toRecord(String ip) throws IOException {
        Resolver res = new ExtendedResolver();

        Name name = ReverseMap.fromAddress(ip);
        int type = Type.PTR;
        int dclass = DClass.IN;
        Record rec = Record.newRecord(name, type, dclass);
        Message query = Message.newQuery(rec);
        Message response = res.send(query);
View Full Code Here

            records.add(new NSRecord(Name.root, DClass.IN, 3600, Name.root));

            Iterator hosts = zonedata.keySet().iterator();
            while (hosts.hasNext()) {
                String host = (String) hosts.next();
                Name hostname;
                if (!host.endsWith(".")) {
                    hostname = Name.fromString(host + ".");
                } else {
                    hostname = Name.fromString(host);
                }
View Full Code Here

    private void addAdditional2(Message response, int section, int flags) {
        Record[] records = response.getSectionArray(section);
        for (int i = 0; i < records.length; i++) {
            Record r = records[i];
            Name glueName = r.getAdditionalName();
            if (glueName != null)
                addGlue(response, glueName, flags);
        }
    }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.Name

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.