JDK 11 jdk.naming.dns.jmod - Naming DNS Module

JDK 11 jdk.naming.dns.jmod is the JMOD file for JDK 11 Naming DNS module.

JDK 11 Naming DNS module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.naming.dns.jmod.

JDK 11 Naming DNS module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 Naming DNS module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.naming.dns.

You can click and view the content of each source code file in the list below.

✍: FYIcenter

com/sun/jndi/dns/Header.java

/*
 * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package com.sun.jndi.dns;


import javax.naming.*;


/**
 * The Header class represents the header of a DNS message.
 *
 * @author Scott Seligman
 */


class Header {

    static final int HEADER_SIZE = 12;  // octets in a DNS header

    // Masks and shift amounts for DNS header flag fields.
    static final short QR_BIT =         (short) 0x8000;
    static final short OPCODE_MASK =    (short) 0x7800;
    static final int   OPCODE_SHIFT =   11;
    static final short AA_BIT =         (short) 0x0400;
    static final short TC_BIT =         (short) 0x0200;
    static final short RD_BIT =         (short) 0x0100;
    static final short RA_BIT =         (short) 0x0080;
    static final short RCODE_MASK =     (short) 0x000F;

    int xid;                    // ID:  16-bit query identifier
    boolean query;              // QR:  true if query, false if response
    int opcode;                 // OPCODE:  4-bit opcode
    boolean authoritative;      // AA
    boolean truncated;          // TC
    boolean recursionDesired;   // RD
    boolean recursionAvail;     // RA
    int rcode;                  // RCODE:  4-bit response code
    int numQuestions;
    int numAnswers;
    int numAuthorities;
    int numAdditionals;

    /*
     * Returns a representation of a decoded DNS message header.
     * Does not modify or store a reference to the msg array.
     */
    Header(byte[] msg, int msgLen) throws NamingException {
        decode(msg, msgLen);
    }

    /*
     * Decodes a DNS message header.  Does not modify or store a
     * reference to the msg array.
     */
    private void decode(byte[] msg, int msgLen) throws NamingException {

        try {
            int pos = 0;        // current offset into msg

            if (msgLen < HEADER_SIZE) {
                throw new CommunicationException(
                        "DNS error: corrupted message header");
            }

            xid = getShort(msg, pos);
            pos += 2;

            // Flags
            short flags = (short) getShort(msg, pos);
            pos += 2;
            query = (flags & QR_BIT) == 0;
            opcode = (flags & OPCODE_MASK) >>> OPCODE_SHIFT;
            authoritative = (flags & AA_BIT) != 0;
            truncated = (flags & TC_BIT) != 0;
            recursionDesired = (flags & RD_BIT) != 0;
            recursionAvail = (flags & RA_BIT) != 0;
            rcode = (flags & RCODE_MASK);

            // RR counts
            numQuestions = getShort(msg, pos);
            pos += 2;
            numAnswers = getShort(msg, pos);
            pos += 2;
            numAuthorities = getShort(msg, pos);
            pos += 2;
            numAdditionals = getShort(msg, pos);
            pos += 2;

        } catch (IndexOutOfBoundsException e) {
            throw new CommunicationException(
                    "DNS error: corrupted message header");
        }
    }

    /*
     * Returns the 2-byte unsigned value at msg[pos].  The high
     * order byte comes first.
     */
    private static int getShort(byte[] msg, int pos) {
        return (((msg[pos] & 0xFF) << 8) |
                (msg[pos + 1] & 0xFF));
    }
}

com/sun/jndi/dns/Header.java

 

Or download all of them as a single archive file:

File name: jdk.naming.dns-11.0.1-src.zip
File size: 45078 bytes
Release date: 2018-11-04
Download 

 

JDK 11 jdk.naming.rmi.jmod - Naming RMI Module

JDK 11 jdk.management.jfr.jmod - Management JFR Module

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2020-06-21, 7137👍, 0💬