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.EncKdcRepPart;
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 EncKdcRepPart 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 EncKdcRepPartStatesEnum implements States
034{
035    // Start
036    START_STATE, // 0
037
038    // ----- EncKdcRepPart component --------------------------------------
039
040    ENC_KDC_REP_PART_SEQ_TAG_STATE, // 1
041
042    ENC_KDC_REP_PART_KEY_TAG_STATE, // 2
043
044    ENC_KDC_REP_PART_LAST_REQ_TAG_STATE, // 3
045
046    ENC_KDC_REP_PART_NONCE_TAG_STATE, // 4
047    ENC_KDC_REP_PART_NONCE_STATE, // 5
048
049    ENC_KDC_REP_PART_KEY_EXPIRATION_TAG_STATE, // 6
050    ENC_KDC_REP_PART_KEY_EXPIRATION_STATE, // 7
051
052    ENC_KDC_REP_PART_FLAGS_TAG_STATE, // 8
053    ENC_KDC_REP_PART_FLAGS_STATE, // 9
054
055    ENC_KDC_REP_PART_AUTH_TIME_TAG_STATE, // 10
056    ENC_KDC_REP_PART_AUTH_TIME_STATE, // 11
057
058    ENC_KDC_REP_PART_START_TIME_TAG_STATE, // 12
059    ENC_KDC_REP_PART_START_TIME_STATE, // 13
060
061    ENC_KDC_REP_PART_END_TIME_TAG_STATE, // 14
062    ENC_KDC_REP_PART_END_TIME_STATE, // 15
063
064    ENC_KDC_REP_PART_RENEW_TILL_TAG_STATE, // 16
065    ENC_KDC_REP_PART_RENEW_TILL_STATE, // 17
066
067    ENC_KDC_REP_PART_SREALM_TAG_STATE, // 18
068    ENC_KDC_REP_PART_SREALM_STATE, // 19
069
070    ENC_KDC_REP_PART_SNAME_TAG_STATE, // 20
071
072    ENC_KDC_REP_PART_CADDR_TAG_STATE, // 21
073
074    // End
075    LAST_ENC_KDC_REP_PART_STATE; // 22
076
077    /**
078     * Get the grammar name
079     *
080     * @param grammar The grammar code
081     * @return The grammar name
082     */
083    public String getGrammarName( int grammar )
084    {
085        return "ENC_KDC_REP_PART_GRAMMAR";
086    }
087
088
089    /**
090     * Get the grammar name
091     *
092     * @param grammar The grammar class
093     * @return The grammar name
094     */
095    public String getGrammarName( Grammar<EncKdcRepPartContainer> grammar )
096    {
097        if ( grammar instanceof EncKdcRepPartGrammar )
098        {
099            return "ENC_KDC_REP_PART_GRAMMAR";
100        }
101        else
102        {
103            return "UNKNOWN GRAMMAR";
104        }
105    }
106
107
108    /**
109     * Get the string representing the state
110     *
111     * @param state The state number
112     * @return The String representing the state
113     */
114    public String getState( int state )
115    {
116        return ( ( state == LAST_ENC_KDC_REP_PART_STATE.ordinal() ) ? "LAST_ENC_KDC_REP_PART_STATE" : name() );
117    }
118
119
120    /**
121     * {@inheritDoc}
122     */
123    public boolean isEndState()
124    {
125        return this == LAST_ENC_KDC_REP_PART_STATE;
126    }
127
128
129    /**
130     * {@inheritDoc}
131     */
132    public EncKdcRepPartStatesEnum getStartState()
133    {
134        return START_STATE;
135    }
136}