DNSResultCode.java
Go to the documentation of this file.
00001 
00004 package javax.jmdns.impl.constants;
00005 
00011 public enum DNSResultCode {
00015     Unknown("Unknown", 65535),
00019     NoError("No Error", 0),
00023     FormErr("Format Error", 1),
00027     ServFail("Server Failure", 2),
00031     NXDomain("Non-Existent Domain", 3),
00035     NotImp("Not Implemented", 4),
00039     Refused("Query Refused", 5),
00043     YXDomain("Name Exists when it should not", 6),
00047     YXRRSet("RR Set Exists when it should not", 7),
00051     NXRRSet("RR Set that should exist does not", 8),
00055     NotAuth("Server Not Authoritative for zone", 9),
00059     NotZone("NotZone Name not contained in zone", 10),
00060 
00061     ;
00062 
00063     // 0 NoError No Error [RFC1035]
00064     // 1 FormErr Format Error [RFC1035]
00065     // 2 ServFail Server Failure [RFC1035]
00066     // 3 NXDomain Non-Existent Domain [RFC1035]
00067     // 4 NotImp Not Implemented [RFC1035]
00068     // 5 Refused Query Refused [RFC1035]
00069     // 6 YXDomain Name Exists when it should not [RFC2136]
00070     // 7 YXRRSet RR Set Exists when it should not [RFC2136]
00071     // 8 NXRRSet RR Set that should exist does not [RFC2136]
00072     // 9 NotAuth Server Not Authoritative for zone [RFC2136]
00073     // 10 NotZone Name not contained in zone [RFC2136]
00074     // 11-15 Unassigned
00075     // 16 BADVERS Bad OPT Version [RFC2671]
00076     // 16 BADSIG TSIG Signature Failure [RFC2845]
00077     // 17 BADKEY Key not recognized [RFC2845]
00078     // 18 BADTIME Signature out of time window [RFC2845]
00079     // 19 BADMODE Bad TKEY Mode [RFC2930]
00080     // 20 BADNAME Duplicate key name [RFC2930]
00081     // 21 BADALG Algorithm not supported [RFC2930]
00082     // 22 BADTRUNC Bad Truncation [RFC4635]
00083     // 23-3840 Unassigned
00084     // 3841-4095 Reserved for Private Use [RFC5395]
00085     // 4096-65534 Unassigned
00086     // 65535 Reserved, can be allocated by Standards Action [RFC5395]
00087 
00091     final static int     RCode_MASK         = 0x0F;
00095     final static int     ExtendedRCode_MASK = 0xFF;
00096 
00097     private final String _externalName;
00098 
00099     private final int    _index;
00100 
00101     DNSResultCode(String name, int index) {
00102         _externalName = name;
00103         _index = index;
00104     }
00105 
00111     public String externalName() {
00112         return _externalName;
00113     }
00114 
00120     public int indexValue() {
00121         return _index;
00122     }
00123 
00128     public static DNSResultCode resultCodeForFlags(int flags) {
00129         int maskedIndex = flags & RCode_MASK;
00130         for (DNSResultCode aCode : DNSResultCode.values()) {
00131             if (aCode._index == maskedIndex) return aCode;
00132         }
00133         return Unknown;
00134     }
00135 
00136     public static DNSResultCode resultCodeForFlags(int flags, int extendedRCode) {
00137         int maskedIndex = ((extendedRCode >> 28) & ExtendedRCode_MASK) | (flags & RCode_MASK);
00138         for (DNSResultCode aCode : DNSResultCode.values()) {
00139             if (aCode._index == maskedIndex) return aCode;
00140         }
00141         return Unknown;
00142     }
00143 
00144     @Override
00145     public String toString() {
00146         return this.name() + " index " + this.indexValue();
00147     }
00148 
00149 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


zeroconf_jmdns
Author(s): Daniel Stonier
autogenerated on Tue Nov 6 2012 14:18:57