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.EncKdcRepPart;
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 EncKdcRepPart 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 EncKdcRepPartStatesEnum implements States
34  {
35      // Start
36      START_STATE, // 0
37  
38      // ----- EncKdcRepPart component --------------------------------------
39  
40      ENC_KDC_REP_PART_SEQ_TAG_STATE, // 1
41  
42      ENC_KDC_REP_PART_KEY_TAG_STATE, // 2
43  
44      ENC_KDC_REP_PART_LAST_REQ_TAG_STATE, // 3
45  
46      ENC_KDC_REP_PART_NONCE_TAG_STATE, // 4
47      ENC_KDC_REP_PART_NONCE_STATE, // 5
48  
49      ENC_KDC_REP_PART_KEY_EXPIRATION_TAG_STATE, // 6
50      ENC_KDC_REP_PART_KEY_EXPIRATION_STATE, // 7
51  
52      ENC_KDC_REP_PART_FLAGS_TAG_STATE, // 8
53      ENC_KDC_REP_PART_FLAGS_STATE, // 9
54  
55      ENC_KDC_REP_PART_AUTH_TIME_TAG_STATE, // 10
56      ENC_KDC_REP_PART_AUTH_TIME_STATE, // 11
57  
58      ENC_KDC_REP_PART_START_TIME_TAG_STATE, // 12
59      ENC_KDC_REP_PART_START_TIME_STATE, // 13
60  
61      ENC_KDC_REP_PART_END_TIME_TAG_STATE, // 14
62      ENC_KDC_REP_PART_END_TIME_STATE, // 15
63  
64      ENC_KDC_REP_PART_RENEW_TILL_TAG_STATE, // 16
65      ENC_KDC_REP_PART_RENEW_TILL_STATE, // 17
66  
67      ENC_KDC_REP_PART_SREALM_TAG_STATE, // 18
68      ENC_KDC_REP_PART_SREALM_STATE, // 19
69  
70      ENC_KDC_REP_PART_SNAME_TAG_STATE, // 20
71  
72      ENC_KDC_REP_PART_CADDR_TAG_STATE, // 21
73  
74      // End
75      LAST_ENC_KDC_REP_PART_STATE; // 22
76  
77      /**
78       * Get the grammar name
79       *
80       * @param grammar The grammar code
81       * @return The grammar name
82       */
83      public String getGrammarName( int grammar )
84      {
85          return "ENC_KDC_REP_PART_GRAMMAR";
86      }
87  
88  
89      /**
90       * Get the grammar name
91       *
92       * @param grammar The grammar class
93       * @return The grammar name
94       */
95      public String getGrammarName( Grammar<EncKdcRepPartContainer> grammar )
96      {
97          if ( grammar instanceof EncKdcRepPartGrammar )
98          {
99              return "ENC_KDC_REP_PART_GRAMMAR";
100         }
101         else
102         {
103             return "UNKNOWN GRAMMAR";
104         }
105     }
106 
107 
108     /**
109      * Get the string representing the state
110      *
111      * @param state The state number
112      * @return The String representing the state
113      */
114     public String getState( int state )
115     {
116         return ( ( state == LAST_ENC_KDC_REP_PART_STATE.ordinal() ) ? "LAST_ENC_KDC_REP_PART_STATE" : name() );
117     }
118 
119 
120     /**
121      * {@inheritDoc}
122      */
123     public boolean isEndState()
124     {
125         return this == LAST_ENC_KDC_REP_PART_STATE;
126     }
127 
128 
129     /**
130      * {@inheritDoc}
131      */
132     public EncKdcRepPartStatesEnum getStartState()
133     {
134         return START_STATE;
135     }
136 }