-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy pathOpcode.java
More file actions
62 lines (48 loc) · 1.55 KB
/
Opcode.java
File metadata and controls
62 lines (48 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
package org.xbill.DNS;
/**
* Constants and functions relating to DNS opcodes
*
* @author Brian Wellington
*/
public final class Opcode {
/** A standard query */
public static final int QUERY = 0;
/** An inverse query (deprecated) */
public static final int IQUERY = 1;
/** A server status request (not used) */
public static final int STATUS = 2;
/** A message from a primary to a secondary server to initiate a zone transfer */
@SuppressWarnings("java:S1845")
public static final int NOTIFY = 4;
/** A dynamic update message */
public static final int UPDATE = 5;
/**
* DNS Stateful Operations (DSO).
*
* @see <a href="https://datatracker.ietf.org/doc/html/rfc8490">RFC 8490</a>
*/
public static final int DSO = 6;
private static final Mnemonic opcodes = new Mnemonic("DNS Opcode", Mnemonic.CASE_UPPER);
static {
opcodes.setMaximum(0xF);
opcodes.setPrefix("RESERVED");
opcodes.setNumericAllowed(true);
opcodes.add(QUERY, "QUERY");
opcodes.add(IQUERY, "IQUERY");
opcodes.add(STATUS, "STATUS");
opcodes.add(NOTIFY, "NOTIFY");
opcodes.add(UPDATE, "UPDATE");
opcodes.add(DSO, "DSO");
}
private Opcode() {}
/** Converts a numeric Opcode into a String */
public static String string(int i) {
return opcodes.getText(i);
}
/** Converts a String representation of an Opcode into its numeric value */
public static int value(String s) {
return opcodes.getValue(s);
}
}