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.encKrbPrivPart;
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 stores the EncKrbPrivPart 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 EncKrbPrivPartStatesEnum implements States
34  {
35      // Start
36      START_STATE, // 0
37  
38      // ----- EncKrbPrivPart component --------------------------------------
39  
40      ENC_KRB_PRIV_PART_TAG_STATE, // 2
41  
42      ENC_KRB_PRIV_PART_SEQ_TAG_STATE, // 3
43  
44      ENC_KRB_PRIV_PART_USER_DATA_TAG_STATE, // 4
45      ENC_KRB_PRIV_PART_USER_DATA_STATE, // 5
46  
47      ENC_KRB_PRIV_PART_TIMESTAMP_TAG_STATE, // 5
48      ENC_KRB_PRIV_PART_TIMESTAMP_STATE, // 6
49  
50      ENC_KRB_PRIV_PART_USEC_TAG_STATE, // 7
51      ENC_KRB_PRIV_PART_USEC_STATE, // 8
52  
53      ENC_KRB_PRIV_PART_SEQ_NUMBER_TAG_STATE, // 9
54      ENC_KRB_PRIV_PART_SEQ_NUMBER_STATE, // 10
55  
56      ENC_KRB_PRIV_PART_SENDER_ADDRESS_TAG_STATE, // 11
57  
58      ENC_KRB_PRIV_PART_RECIPIENT_ADDRESS_TAG_STATE, // 12
59  
60      // End
61      LAST_ENC_KRB_PRIV_PART_STATE; // 13
62  
63      /**
64       * Get the grammar name
65       *
66       * @param grammar The grammar code
67       * @return The grammar name
68       */
69      public String getGrammarName( int grammar )
70      {
71          return "ENC_KRB_PRIV_PART_GRAMMAR";
72      }
73  
74  
75      /**
76       * Get the grammar name
77       *
78       * @param grammar The grammar class
79       * @return The grammar name
80       */
81      public String getGrammarName( Grammar<EncKrbPrivPartContainer> grammar )
82      {
83          if ( grammar instanceof EncKrbPrivPartGrammar )
84          {
85              return "ENC_KRB_PRIV_PART_GRAMMAR";
86          }
87          else
88          {
89              return "UNKNOWN GRAMMAR";
90          }
91      }
92  
93  
94      /**
95       * Get the string representing the state
96       *
97       * @param state The state number
98       * @return The String representing the state
99       */
100     public String getState( int state )
101     {
102         return ( ( state == LAST_ENC_KRB_PRIV_PART_STATE.ordinal() ) ? "LAST_ENC_KRB_PRIV_PART_STATE" : name() );
103     }
104 
105 
106     /**
107      * {@inheritDoc}
108      */
109     public boolean isEndState()
110     {
111         return this == LAST_ENC_KRB_PRIV_PART_STATE;
112     }
113 
114 
115     /**
116      * {@inheritDoc}
117      */
118     public EncKrbPrivPartStatesEnum getStartState()
119     {
120         return START_STATE;
121     }
122 }