DNSOperationCode.java
Go to the documentation of this file.
00001 
00004 package javax.jmdns.impl.constants;
00005 
00011 public enum DNSOperationCode {
00015     Query("Query", 0),
00019     IQuery("Inverse Query", 1),
00023     Status("Status", 2),
00027     Unassigned("Unassigned", 3),
00031     Notify("Notify", 4),
00035     Update("Update", 5);
00036 
00040     static final int     OpCode_MASK = 0x7800;
00041 
00042     private final String _externalName;
00043 
00044     private final int    _index;
00045 
00046     DNSOperationCode(String name, int index) {
00047         _externalName = name;
00048         _index = index;
00049     }
00050 
00056     public String externalName() {
00057         return _externalName;
00058     }
00059 
00065     public int indexValue() {
00066         return _index;
00067     }
00068 
00073     public static DNSOperationCode operationCodeForFlags(int flags) {
00074         int maskedIndex = (flags & OpCode_MASK) >> 11;
00075         for (DNSOperationCode aCode : DNSOperationCode.values()) {
00076             if (aCode._index == maskedIndex) return aCode;
00077         }
00078         return Unassigned;
00079     }
00080 
00081     @Override
00082     public String toString() {
00083         return this.name() + " index " + this.indexValue();
00084     }
00085 
00086 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


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