1// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org) 2 3package org.xbill.DNS; 4 5/** 6 * Constants and functions relating to DNS opcodes 7 * 8 * @author Brian Wellington 9 */ 10 11public final class Opcode { 12 13/** A standard query */ 14public static final int QUERY = 0; 15 16/** An inverse query (deprecated) */ 17public static final int IQUERY = 1; 18 19/** A server status request (not used) */ 20public static final int STATUS = 2; 21 22/** 23 * A message from a primary to a secondary server to initiate a zone transfer 24 */ 25public static final int NOTIFY = 4; 26 27/** A dynamic update message */ 28public static final int UPDATE = 5; 29 30private static Mnemonic opcodes = new Mnemonic("DNS Opcode", 31 Mnemonic.CASE_UPPER); 32 33static { 34 opcodes.setMaximum(0xF); 35 opcodes.setPrefix("RESERVED"); 36 opcodes.setNumericAllowed(true); 37 38 opcodes.add(QUERY, "QUERY"); 39 opcodes.add(IQUERY, "IQUERY"); 40 opcodes.add(STATUS, "STATUS"); 41 opcodes.add(NOTIFY, "NOTIFY"); 42 opcodes.add(UPDATE, "UPDATE"); 43} 44 45private 46Opcode() {} 47 48/** Converts a numeric Opcode into a String */ 49public static String 50string(int i) { 51 return opcodes.getText(i); 52} 53 54/** Converts a String representation of an Opcode into its numeric value */ 55public static int 56value(String s) { 57 return opcodes.getValue(s); 58} 59 60} 61