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.kdcReqBody;
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 KDC-REQ-BODY 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 KdcReqBodyStatesEnum implements States
34  {
35      // Start
36      START_STATE, // 0
37  
38      // ----- KDC-REQ-BODY message --------------------------------------
39      KDC_REQ_BODY_SEQ_STATE, // 1
40  
41      KDC_REQ_BODY_KDC_OPTIONS_TAG_STATE, // 2
42      KDC_REQ_BODY_KDC_OPTIONS_STATE, // 3
43  
44      KDC_REQ_BODY_CNAME_OR_REALM_TAG_STATE, // 4
45      KDC_REQ_BODY_CNAME_STATE, // 5
46  
47      KDC_REQ_BODY_REALM_TAG_STATE, // 6
48  
49      KDC_REQ_BODY_SNAME_OR_FROM_OR_TILL_TAG_STATE, // 7
50      KDC_REQ_BODY_SNAME_STATE, // 8
51  
52      KDC_REQ_BODY_FROM_STATE, // 9
53  
54      KDC_REQ_BODY_TILL_TAG_STATE, // 10
55      KDC_REQ_BODY_TILL_STATE, // 11
56  
57      KDC_REQ_BODY_RTIME_OR_NONCE_TAG_STATE, // 12
58      KDC_REQ_BODY_RTIME_STATE, // 13
59  
60      KDC_REQ_BODY_NONCE_TAG_STATE, // 14
61      KDC_REQ_BODY_NONCE_STATE, // 15
62  
63      KDC_REQ_BODY_ETYPE_TAG_STATE, // 16
64      KDC_REQ_BODY_ETYPE_SEQ_STATE, // 17
65      KDC_REQ_BODY_ETYPE_STATE, // 18
66  
67      KDC_REQ_BODY_ADDRESSES_STATE, // 19
68  
69      KDC_REQ_BODY_ENC_AUTH_DATA_STATE, // 20
70  
71      KDC_REQ_BODY_ADDITIONAL_TICKETS_TAG_STATE, // 21
72      KDC_REQ_BODY_ADDITIONAL_TICKETS_SEQ_STATE, // 22
73      KDC_REQ_BODY_ADDITIONAL_TICKETS_STATE, // 23
74  
75      // End
76      LAST_KDC_REQ_BODY_STATE; // 24
77  
78      /**
79       * Get the grammar name
80       *
81       * @param grammar The grammar code
82       * @return The grammar name
83       */
84      public String getGrammarName( int grammar )
85      {
86          return "KDC_REQ_BODY_GRAMMAR";
87      }
88  
89  
90      /**
91       * Get the grammar name
92       *
93       * @param grammar The grammar class
94       * @return The grammar name
95       */
96      public String getGrammarName( Grammar<KdcReqBodyContainer> grammar )
97      {
98          if ( grammar instanceof KdcReqBodyGrammar )
99          {
100             return "KDC_REQ_BODY_GRAMMAR";
101         }
102         else
103         {
104             return "UNKNOWN GRAMMAR";
105         }
106     }
107 
108 
109     /**
110      * Get the string representing the state
111      *
112      * @param state The state number
113      * @return The String representing the state
114      */
115     public String getState( int state )
116     {
117         return ( ( state == LAST_KDC_REQ_BODY_STATE.ordinal() ) ? "KDC_REQ_BODY_END_STATE" : name() );
118     }
119 
120 
121     /**
122      * {@inheritDoc}
123      */
124     public boolean isEndState()
125     {
126         return this == LAST_KDC_REQ_BODY_STATE;
127     }
128 
129 
130     /**
131      * {@inheritDoc}
132      */
133     public KdcReqBodyStatesEnum getStartState()
134     {
135         return START_STATE;
136     }
137 }