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 */
020package org.apache.directory.shared.kerberos.codec.encKrbPrivPart;
021
022
023import org.apache.directory.api.asn1.ber.grammar.Grammar;
024import org.apache.directory.api.asn1.ber.grammar.States;
025
026
027/**
028 * This class stores the EncKrbPrivPart grammar's constants. It is also used for debugging
029 * purpose
030 *
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public enum EncKrbPrivPartStatesEnum implements States
034{
035    // Start
036    START_STATE, // 0
037
038    // ----- EncKrbPrivPart component --------------------------------------
039
040    ENC_KRB_PRIV_PART_TAG_STATE, // 2
041
042    ENC_KRB_PRIV_PART_SEQ_TAG_STATE, // 3
043
044    ENC_KRB_PRIV_PART_USER_DATA_TAG_STATE, // 4
045    ENC_KRB_PRIV_PART_USER_DATA_STATE, // 5
046
047    ENC_KRB_PRIV_PART_TIMESTAMP_TAG_STATE, // 5
048    ENC_KRB_PRIV_PART_TIMESTAMP_STATE, // 6
049
050    ENC_KRB_PRIV_PART_USEC_TAG_STATE, // 7
051    ENC_KRB_PRIV_PART_USEC_STATE, // 8
052
053    ENC_KRB_PRIV_PART_SEQ_NUMBER_TAG_STATE, // 9
054    ENC_KRB_PRIV_PART_SEQ_NUMBER_STATE, // 10
055
056    ENC_KRB_PRIV_PART_SENDER_ADDRESS_TAG_STATE, // 11
057
058    ENC_KRB_PRIV_PART_RECIPIENT_ADDRESS_TAG_STATE, // 12
059
060    // End
061    LAST_ENC_KRB_PRIV_PART_STATE; // 13
062
063    /**
064     * Get the grammar name
065     *
066     * @param grammar The grammar code
067     * @return The grammar name
068     */
069    public String getGrammarName( int grammar )
070    {
071        return "ENC_KRB_PRIV_PART_GRAMMAR";
072    }
073
074
075    /**
076     * Get the grammar name
077     *
078     * @param grammar The grammar class
079     * @return The grammar name
080     */
081    public String getGrammarName( Grammar<EncKrbPrivPartContainer> grammar )
082    {
083        if ( grammar instanceof EncKrbPrivPartGrammar )
084        {
085            return "ENC_KRB_PRIV_PART_GRAMMAR";
086        }
087        else
088        {
089            return "UNKNOWN GRAMMAR";
090        }
091    }
092
093
094    /**
095     * Get the string representing the state
096     *
097     * @param state The state number
098     * @return The String representing the state
099     */
100    public String getState( int state )
101    {
102        return ( ( state == LAST_ENC_KRB_PRIV_PART_STATE.ordinal() ) ? "LAST_ENC_KRB_PRIV_PART_STATE" : name() );
103    }
104
105
106    /**
107     * {@inheritDoc}
108     */
109    public boolean isEndState()
110    {
111        return this == LAST_ENC_KRB_PRIV_PART_STATE;
112    }
113
114
115    /**
116     * {@inheritDoc}
117     */
118    public EncKrbPrivPartStatesEnum getStartState()
119    {
120        return START_STATE;
121    }
122}