1 /*
2 * Copyright 2005 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17 package org.apache.asn1new.ber.tlv;
18
19 /**
20 * Stores the different states of a PDU parsing.
21 *
22 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
23 */
24 public class TLVStateEnum
25 {
26 //~ Static fields/initializers -----------------------------------------------------------------
27
28 /** Start means that the deconding hasn't read the first byte */
29 public static final int TAG_STATE_START = 0x00;
30
31 /** Pending means that the Type Tag is contained in more that one byte */
32 public static final int TAG_STATE_PENDING = 0x01;
33
34 /** End means that the Type is totally read */
35 public static final int TAG_STATE_END = 0x02;
36
37 /**
38 * Overflow could have two meaning : either there are more than 5 bytes to
39 * encode the value (5 bytes = 5bits + 4*7 bits = 33 bits) or the value that
40 * is represented by those bytes is over MAX_INTEGER
41 */
42 public static final int TAG_STATE_OVERFLOW = 0x04;
43
44 /** Start means that the decoding hasn't read the first byte */
45 public static final int LENGTH_STATE_START = 0x08;
46
47 /** Pending means that the Type length is contained in more that one byte */
48 public static final int LENGTH_STATE_PENDING = 0x10;
49
50 /** End means that the Length is totally read */
51 public static final int LENGTH_STATE_END = 0x20;
52
53 /** Start means that the decoding hasn't read the first byte */
54 public static final int VALUE_STATE_START = 0x40;
55
56 /** Pending means that the Type Value is contained in more that one byte */
57 public static final int VALUE_STATE_PENDING = 0x80;
58
59 /** End means that the Value is totally read */
60 public static final int VALUE_STATE_END = 0x100;
61
62 /** The decoding of a TLV is done */
63 public static final int TLV_STATE_DONE = 0x200;
64
65 /** The decoding of a PDU is done */
66 public static final int PDU_DECODED = 0x400;
67 }