Package org.xbill.DNS

Examples of org.xbill.DNS.Name


                    iterations + 1, flags);
        } else if (sr.isDNAME()) {
            DNAMERecord dname = sr.getDNAME();
            RRset rrset = new RRset(dname);
            addRRset(name, response, rrset, Section.ANSWER, flags);
            Name newname;
            try {
                newname = name.fromDNAME(dname);
            } catch (NameTooLongException e) {
                return Rcode.YXDOMAIN;
            }
View Full Code Here


        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

   */
  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

            if (systemSearchPath != null && systemSearchPath.length > 0) {
                sPaths.addAll(Arrays.asList(systemSearchPath));
            }
            if (logger.isInfoEnabled()) {
                for (Iterator<Name> i = sPaths.iterator(); i.hasNext();) {
                    Name searchPath = i.next();
                    logger.info("Adding autodiscovered search path " + searchPath.toString());
                }
            }
        }

        singleIPPerMX = configuration.getBoolean( "singleIPperMX", false );
View Full Code Here

    /**
     * @see org.apache.james.dnsservice.api.DNSService#getHostName(java.net.InetAddress)
     */
    public String getHostName(InetAddress addr){
        String result = null;
        Name name = ReverseMap.fromAddress(addr);
        Record[] records = lookupNoException(name.toString(), Type.PTR, "PTR");

        if (records == null) {
            result = addr.getHostAddress();
        } else {
            PTRRecord ptr = (PTRRecord) records[0];
View Full Code Here

     * @param namestr the name of the host to be looked up
     * @param querysent whether the query has already been sent to the DNS servers
     * @param type the type of record desired
     */
    private Record[] rawDNSLookup(String namestr, boolean querysent, int type) {
        Name name = null;
        try {
            name = Name.fromString(namestr, Name.root);
        } catch (TextParseException tpe) {
            // TODO: Figure out how to handle this correctly.
            getLogger().error("Couldn't parse name " + namestr, tpe);
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.getIn().setBody(response);
            }
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.getIn().setBody(response);
            }
View Full Code Here

  }
    }

    public void test_init_from_name() throws TextParseException
    {
  Name n = new Name("A.B.c.d.");
  Name e = new Name("B.c.d.");
  Name o = new Name(n, 1);
  assertEquals(e, o);
    }
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.