View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.directory.shared.kerberos.codec.krbCredInfo;
21  
22  
23  import org.apache.directory.api.asn1.ber.grammar.Grammar;
24  import org.apache.directory.api.asn1.ber.grammar.States;
25  
26  
27  /**
28   * This class store the KrbCredInfo grammar's constants. It is also used for debugging
29   * purpose
30   *
31   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
32   */
33  public enum KrbCredInfoStatesEnum implements States
34  {
35      // Start
36      START_STATE, // 0
37  
38      // ----- KRB-ERROR component --------------------------------------
39      KRB_CRED_INFO_SEQ_TAG_STATE, // 1
40  
41      KRB_CRED_INFO_KEY_TAG_STATE, // 2
42  
43      KRB_CRED_INFO_PREALM_TAG_STATE, // 3
44      KRB_CRED_INFO_PREALM_STATE, // 4
45  
46      KRB_CRED_INFO_PNAME_TAG_STATE, // 5
47  
48      KRB_CRED_INFO_FLAGS_TAG_STATE, // 6
49      KRB_CRED_INFO_FLAGS_STATE, // 7
50  
51      KRB_CRED_INFO_AUTHTIME_TAG_STATE, // 8
52      KRB_CRED_INFO_AUTHTIME_STATE, // 9
53  
54      KRB_CRED_INFO_STARTTIME_TAG_STATE, // 10
55      KRB_CRED_INFO_STARTTIME_STATE, // 11
56  
57      KRB_CRED_INFO_ENDTIME_TAG_STATE, // 12
58      KRB_CRED_INFO_ENDTIME_STATE, // 13
59  
60      KRB_CRED_INFO_RENEWTILL_TAG_STATE, // 14
61      KRB_CRED_INFO_RENEWTILL_STATE, // 15
62  
63      KRB_CRED_INFO_SREALM_TAG_STATE, // 16
64      KRB_CRED_INFO_SREALM_STATE,
65  
66      KRB_CRED_INFO_SNAME_TAG_STATE, // 17
67  
68      KRB_CRED_INFO_CADDR_TAG_STATE, // 18
69  
70      // End
71      LAST_KRB_CRED_INFO_STATE; // 19
72  
73      /**
74       * Get the grammar name
75       *
76       * @param grammar The grammar code
77       * @return The grammar name
78       */
79      public String getGrammarName( int grammar )
80      {
81          return "KRB_CRED_INFO_GRAMMAR";
82      }
83  
84  
85      /**
86       * Get the grammar name
87       *
88       * @param grammar The grammar class
89       * @return The grammar name
90       */
91      public String getGrammarName( Grammar<KrbCredInfoContainer> grammar )
92      {
93          if ( grammar instanceof KrbCredInfoGrammar )
94          {
95              return "KRB_CRED_INFO_GRAMMAR";
96          }
97          else
98          {
99              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 }