01: // Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
02:
03: package org.xbill.DNS;
04:
05: /**
06: * Constants and functions relating to DNS opcodes
07: *
08: * @author Brian Wellington
09: */
10:
11: public final class Opcode {
12:
13: /** A standard query */
14: public static final int QUERY = 0;
15:
16: /** An inverse query (deprecated) */
17: public static final int IQUERY = 1;
18:
19: /** A server status request (not used) */
20: public static final int STATUS = 2;
21:
22: /**
23: * A message from a primary to a secondary server to initiate a zone transfer
24: */
25: public static final int NOTIFY = 4;
26:
27: /** A dynamic update message */
28: public static final int UPDATE = 5;
29:
30: private static Mnemonic opcodes = new Mnemonic("DNS Opcode",
31: Mnemonic.CASE_UPPER);
32:
33: static {
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:
45: private Opcode() {
46: }
47:
48: /** Converts a numeric Opcode into a String */
49: public static String string(int i) {
50: return opcodes.getText(i);
51: }
52:
53: /** Converts a String representation of an Opcode into its numeric value */
54: public static int value(String s) {
55: return opcodes.getValue(s);
56: }
57:
58: }
|