Shuyi Chen | d7955ce | 2013-05-22 14:51:55 -0700 | [diff] [blame] | 1 | // Copyright (c) 2004 Brian Wellington (bwelling@xbill.org) |
| 2 | |
| 3 | package org.xbill.DNS; |
| 4 | |
| 5 | /** |
| 6 | * Constants and functions relating to EDNS flags. |
| 7 | * |
| 8 | * @author Brian Wellington |
| 9 | */ |
| 10 | |
| 11 | public final class ExtendedFlags { |
| 12 | |
| 13 | private static Mnemonic extflags = new Mnemonic("EDNS Flag", |
| 14 | Mnemonic.CASE_LOWER); |
| 15 | |
| 16 | /** dnssec ok */ |
| 17 | public static final int DO = 0x8000; |
| 18 | |
| 19 | static { |
| 20 | extflags.setMaximum(0xFFFF); |
| 21 | extflags.setPrefix("FLAG"); |
| 22 | extflags.setNumericAllowed(true); |
| 23 | |
| 24 | extflags.add(DO, "do"); |
| 25 | } |
| 26 | |
| 27 | private |
| 28 | ExtendedFlags() {} |
| 29 | |
| 30 | /** Converts a numeric extended flag into a String */ |
| 31 | public static String |
| 32 | string(int i) { |
| 33 | return extflags.getText(i); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Converts a textual representation of an extended flag into its numeric |
| 38 | * value |
| 39 | */ |
| 40 | public static int |
| 41 | value(String s) { |
| 42 | return extflags.getValue(s); |
| 43 | } |
| 44 | |
| 45 | } |