001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    
021    package org.apache.directory.server.dns.messages;
022    
023    
024    import org.apache.directory.server.dns.util.EnumConverter;
025    import org.apache.directory.server.dns.util.ReverseEnumMap;
026    
027    
028    /**
029     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030     * @version $Rev: 547524 $, $Date: 2007-06-15 06:42:26 +0200 (Fri, 15 Jun 2007) $
031     */
032    public enum ProtocolType implements EnumConverter<Byte>
033    {
034        /** Null */
035        NULL(0),
036    
037        /** Internet Conrol Message */
038        ICMP(1),
039    
040        /** Internet Group Management */
041        IGMP(2),
042    
043        /** Gateway-to-Gateway */
044        GGP(3),
045    
046        /** Stream */
047        ST(5),
048    
049        /** Transmission control */
050        TCP(6),
051    
052        /** UCL */
053        UCL(7),
054    
055        /** Exterior Gateway Protocol */
056        EGP(8),
057    
058        /** any private interior gateway */
059        IGP(9),
060    
061        /** BBN RCC Monitoring */
062        BBN_RCC_MON(10),
063    
064        /** Network Voice Protocol */
065        NVP_II(11),
066    
067        /** PUP */
068        PUP(12),
069    
070        /** ARGUS */
071        ARGUS(13),
072    
073        /** EMCON */
074        EMCON(14),
075    
076        /** Cross Net Debugger */
077        XNET(15),
078    
079        /** Chaos */
080        CHAOS(16),
081    
082        /** User Datagram */
083        UDP(17),
084    
085        /** Multiplexing */
086        MUX(18),
087    
088        /** DCN Measurement Subsystems */
089        DCN_MEAS(19),
090    
091        /** Host Monitoring */
092        HMP(20),
093    
094        /** Packet Radio Measurement */
095        PRM(21),
096    
097        /** XEROX NS IDP */
098        XNS_IDP(22),
099    
100        /** Trunk-1 */
101        TRUNK_1(23),
102    
103        /** Trunk-2 */
104        TRUNK_2(24),
105    
106        /** Leaf-1 */
107        LEAF_1(25),
108    
109        /** Leaf-2 */
110        LEAF_2(26),
111    
112        /** Reliable Data Protocol */
113        RDP(27),
114    
115        /** Internet Reliable Transaction */
116        IRTP(28),
117    
118        /** ISO Transport Protocol Class 4 */
119        ISO_TP4(29),
120    
121        /** Bulk Data Transfer Protocol */
122        NETBLT(30),
123    
124        /** MFE Network Services Protocol */
125        MFE_NSP(31),
126    
127        /** MERIT Internodal Protocol */
128        MERIT_INP(32),
129    
130        /** Sequential Exchange Protocol */
131        SEP(33),
132    
133        /** CFTP */
134        CFTP(62),
135    
136        /** SATNET and Backroom EXPAK */
137        SAT_EXPAK(64),
138    
139        /** MIT Subnet Support */
140        MIT_SUBNET(65),
141    
142        /** MIT Remote Virtual Disk Protocol */
143        RVD(66),
144    
145        /** Internet Pluribus Packet Core */
146        IPPC(67),
147    
148        /** SATNET Monitoring */
149        SAT_MON(69),
150    
151        /** Internet Packet Core Utility */
152        IPCV(71),
153    
154        /** Backroom SETNET Monitoring */
155        BR_SAT_MON(76),
156    
157        /** WIDEBAND Monitoring */
158        WB_MON(78),
159    
160        /** WIDEBAND EXPAK */
161        WB_EXPAK(79);
162    
163        private static ReverseEnumMap<Byte, ProtocolType> map = new ReverseEnumMap<Byte, ProtocolType>( ProtocolType.class );
164    
165        private final byte value;
166    
167    
168        private ProtocolType( int value )
169        {
170            this.value = ( byte ) value;
171        }
172    
173    
174        public Byte convert()
175        {
176            return this.value;
177        }
178    
179    
180        /**
181         * Converts an ordinal value into a {@link ProtocolType}.
182         *
183         * @param value
184         * @return The {@link ProtocolType}.
185         */
186        public static ProtocolType convert( byte value )
187        {
188            return map.get( value );
189        }
190    }