001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.shared.asn1.ber.tlv;
021
022
023 /**
024 * Stores the different states of a PDU parsing.
025 *
026 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
027 * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sam, 07 jui 2008) $
028 */
029 public class TLVStateEnum
030 {
031 // ~ Static fields/initializers
032 // -----------------------------------------------------------------
033
034 /** Start means that the deconding hasn't read the first byte */
035 public static final int TAG_STATE_START = 0x00;
036
037 /** Pending means that the Type Tag is contained in more that one byte */
038 public static final int TAG_STATE_PENDING = 0x01;
039
040 /** End means that the Type is totally read */
041 public static final int TAG_STATE_END = 0x02;
042
043 /**
044 * Overflow could have two meaning : either there are more than 5 bytes to
045 * encode the value (5 bytes = 5bits + 4*7 bits = 33 bits) or the value that
046 * is represented by those bytes is over MAX_INTEGER
047 */
048 public static final int TAG_STATE_OVERFLOW = 0x04;
049
050 /** Start means that the decoding hasn't read the first byte */
051 public static final int LENGTH_STATE_START = 0x08;
052
053 /** Pending means that the Type length is contained in more that one byte */
054 public static final int LENGTH_STATE_PENDING = 0x10;
055
056 /** End means that the Length is totally read */
057 public static final int LENGTH_STATE_END = 0x20;
058
059 /** Start means that the decoding hasn't read the first byte */
060 public static final int VALUE_STATE_START = 0x40;
061
062 /** Pending means that the Type Value is contained in more that one byte */
063 public static final int VALUE_STATE_PENDING = 0x80;
064
065 /** End means that the Value is totally read */
066 public static final int VALUE_STATE_END = 0x100;
067
068 /** The decoding of a TLV is done */
069 public static final int TLV_STATE_DONE = 0x200;
070
071 /** The decoding of a PDU is done */
072 public static final int PDU_DECODED = 0x400;
073 }