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