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.etypeInfo2Entry; 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 store the ETYPE-INFO2-ENTRY 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 ETypeInfo2EntryStatesEnum implements States 034{ 035 // Start 036 START_STATE, // 0 037 038 ETYPE_INFO2_ENTRY_SEQ_STATE, // 1 039 040 ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE, // 2 041 042 ETYPE_INFO2_ENTRY_ETYPE_STATE, // 3 043 044 ETYPE_INFO2_ENTRY_SALT_TAG_STATE, // 4 045 046 ETYPE_INFO2_ENTRY_SALT_STATE, // 5 047 048 ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE, // 6 049 050 ETYPE_INFO2_ENTRY_S2KPARAMS_STATE, // 7 051 052 // End 053 LAST_ETYPE_INFO2_ENTRY_STATE; // 8 054 055 /** 056 * Get the grammar name 057 * 058 * @param grammar The grammar code 059 * @return The grammar name 060 */ 061 public String getGrammarName( int grammar ) 062 { 063 return "ETYPE_INFO2_ENTRY_GRAMMAR"; 064 } 065 066 067 /** 068 * Get the grammar name 069 * 070 * @param grammar The grammar class 071 * @return The grammar name 072 */ 073 public String getGrammarName( Grammar<ETypeInfo2EntryContainer> grammar ) 074 { 075 if ( grammar instanceof ETypeInfo2EntryGrammar ) 076 { 077 return "ETYPE_INFO2_ENTRY_GRAMMAR"; 078 } 079 else 080 { 081 return "UNKNOWN GRAMMAR"; 082 } 083 } 084 085 086 /** 087 * Get the string representing the state 088 * 089 * @param state The state number 090 * @return The String representing the state 091 */ 092 public String getState( int state ) 093 { 094 return ( ( state == LAST_ETYPE_INFO2_ENTRY_STATE.ordinal() ) ? "LAST_ETYPE_INFO2_ENTRY_STATE" : name() ); 095 } 096 097 098 /** 099 * {@inheritDoc} 100 */ 101 public boolean isEndState() 102 { 103 return this == LAST_ETYPE_INFO2_ENTRY_STATE; 104 } 105 106 107 /** 108 * {@inheritDoc} 109 */ 110 public ETypeInfo2EntryStatesEnum getStartState() 111 { 112 return START_STATE; 113 } 114}