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 */
020package org.apache.directory.api.asn1.ber.tlv;
021
022
023import org.apache.directory.api.asn1.DecoderException;
024
025
026/**
027 * A MBean used to get stats on the decoding process.
028 * 
029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030 */
031public interface TLVBerDecoderMBean
032{
033    /**
034     * Set the number of bytes that can be used to encode the Value length,
035     * including the first byte. Max is 127 if the Length use a definite form,
036     * default is 1
037     * 
038     * @param length the number of byte to use
039     * @throws DecoderException Thrown if the indefinite length is 
040     * allowed or if the length's Length is above 126 bytes
041     */
042    void setMaxLengthLength( int length ) throws DecoderException;
043
044
045    /**
046     * Set the maximum number of bytes that should be used to encode a Tag
047     * label, including the first byte. Default is 1, no maximum
048     * 
049     * @param length The length to use
050     */
051    void setMaxTagLength( int length );
052
053
054    /** Allow indefinite length. */
055    void allowIndefiniteLength();
056
057
058    /** Disallow indefinite length. */
059    void disallowIndefiniteLength();
060
061
062    /**
063     * Get the actual maximum number of bytes that can be used to encode the
064     * Length
065     * 
066     * @return The maximum bytes of the Length
067     */
068    int getMaxLengthLength();
069
070
071    /**
072     * Get the actual maximum number of bytes that can be used to encode the Tag
073     * 
074     * @return The maximum length of the Tag
075     */
076    int getMaxTagLength();
077
078
079    /**
080     * Tell if indefinite length form could be used for Length
081     * 
082     * @return <code>true</code> if the Indefinite form is allowed
083     */
084    boolean isIndefiniteLengthAllowed();
085}