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.krbCredInfo; 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 KrbCredInfo 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 KrbCredInfoStatesEnum implements States 034{ 035 // Start 036 START_STATE, // 0 037 038 // ----- KRB-ERROR component -------------------------------------- 039 KRB_CRED_INFO_SEQ_TAG_STATE, // 1 040 041 KRB_CRED_INFO_KEY_TAG_STATE, // 2 042 043 KRB_CRED_INFO_PREALM_TAG_STATE, // 3 044 KRB_CRED_INFO_PREALM_STATE, // 4 045 046 KRB_CRED_INFO_PNAME_TAG_STATE, // 5 047 048 KRB_CRED_INFO_FLAGS_TAG_STATE, // 6 049 KRB_CRED_INFO_FLAGS_STATE, // 7 050 051 KRB_CRED_INFO_AUTHTIME_TAG_STATE, // 8 052 KRB_CRED_INFO_AUTHTIME_STATE, // 9 053 054 KRB_CRED_INFO_STARTTIME_TAG_STATE, // 10 055 KRB_CRED_INFO_STARTTIME_STATE, // 11 056 057 KRB_CRED_INFO_ENDTIME_TAG_STATE, // 12 058 KRB_CRED_INFO_ENDTIME_STATE, // 13 059 060 KRB_CRED_INFO_RENEWTILL_TAG_STATE, // 14 061 KRB_CRED_INFO_RENEWTILL_STATE, // 15 062 063 KRB_CRED_INFO_SREALM_TAG_STATE, // 16 064 KRB_CRED_INFO_SREALM_STATE, 065 066 KRB_CRED_INFO_SNAME_TAG_STATE, // 17 067 068 KRB_CRED_INFO_CADDR_TAG_STATE, // 18 069 070 // End 071 LAST_KRB_CRED_INFO_STATE; // 19 072 073 /** 074 * Get the grammar name 075 * 076 * @param grammar The grammar code 077 * @return The grammar name 078 */ 079 public String getGrammarName( int grammar ) 080 { 081 return "KRB_CRED_INFO_GRAMMAR"; 082 } 083 084 085 /** 086 * Get the grammar name 087 * 088 * @param grammar The grammar class 089 * @return The grammar name 090 */ 091 public String getGrammarName( Grammar<KrbCredInfoContainer> grammar ) 092 { 093 if ( grammar instanceof KrbCredInfoGrammar ) 094 { 095 return "KRB_CRED_INFO_GRAMMAR"; 096 } 097 else 098 { 099 return "UNKNOWN GRAMMAR"; 100 } 101 } 102 103 104 /** 105 * Get the string representing the state 106 * 107 * @param state The state number 108 * @return The String representing the state 109 */ 110 public String getState( int state ) 111 { 112 return ( ( state == LAST_KRB_CRED_INFO_STATE.ordinal() ) ? "LAST_KRB_CRED_INFO_STATE" : name() ); 113 } 114 115 116 /** 117 * {@inheritDoc} 118 */ 119 public boolean isEndState() 120 { 121 return this == LAST_KRB_CRED_INFO_STATE; 122 } 123 124 125 /** 126 * {@inheritDoc} 127 */ 128 public KrbCredInfoStatesEnum getStartState() 129 { 130 return START_STATE; 131 } 132}