Package org.apache.directory.shared.asn1

Examples of org.apache.directory.shared.asn1.AbstractAsn1Object


                if ( expectedLength > 4 )
                {
                    String msg = I18n.err( I18n.ERR_00005_LENGTH_OVERFLOW );
                    LOG.error( msg );
                    throw new DecoderException( msg );
                }

                tlv.setLength( 0 );
                tlv.setLengthNbBytes( 1 + expectedLength );
                tlv.setLengthBytesRead( 1 );
                container.setState( TLVStateEnum.LENGTH_STATE_PENDING );
            }
            else
            {
                String msg = I18n.err( I18n.ERR_00006_LENGTH_EXTENSION_RESERVED );
                LOG.error( msg );
                throw new DecoderException( msg );
            }

            return MORE;
        }
        else
View Full Code Here


        if ( tlv == null )
        {
            String msg = I18n.err( I18n.ERR_00007_TLV_NULL );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        int length = tlv.getLength();

        // We will check the length here. What we must control is
        // that the enclosing constructed TLV expected length is not
        // exceeded by the current TLV.
        TLV parentTLV = container.getParentTLV();

        if ( IS_DEBUG )
        {
            LOG.debug( "Parent length : {}", getParentLength( parentTLV ) );
        }

        if ( parentTLV == null )
        {
            // This is the first TLV, so we can't check anything. We will
            // just store this TLV as the root of the PDU
            tlv.setExpectedLength( length );
            container.setParentTLV( tlv );

            if ( IS_DEBUG )
            {
                LOG.debug( "Root TLV[{}]", Integer.valueOf( length ) );
            }
        }
        else
        {
            // We have a parent, so we will check that its expected length is
            // not exceeded.
            int expectedLength = parentTLV.getExpectedLength();
            int currentLength = tlv.getSize();

            if ( expectedLength < currentLength )
            {
                // The expected length is lower than the Value length of the
                // current TLV. This is an error...
                LOG.debug( "tlv[{}, {}]", Integer.valueOf( expectedLength ), Integer.valueOf( currentLength ) );
                throw new DecoderException( I18n.err( I18n.ERR_00008_VALUE_LENGTH_ABOVE_EXPECTED_LENGTH, Integer
                    .valueOf( currentLength ), Integer.valueOf( expectedLength ) ) );
            }

            // deal with the particular case where expected length equal
            // the current length, which means that the parentTLV has been
View Full Code Here

                    container.setState( TLVStateEnum.PDU_DECODED );
                }
                else
                {
                    LOG.error( I18n.err( I18n.ERR_00009_MORE_TLV_EXPECTED ) );
                    throw new DecoderException( I18n.err( I18n.ERR_00010_TRUNCATED_PDU ) );
                }
            }
        }
        else
        {
View Full Code Here

        if ( container.getDecodeBytes() > container.getMaxPDUSize() )
        {
            String message = I18n.err( I18n.ERR_00042_PDU_SIZE_TOO_LONG, container.getDecodeBytes(), container
                .getMaxPDUSize() );
            LOG.error( message );
            throw new DecoderException( message );
        }

        if ( IS_DEBUG )
        {
            LOG.debug( ">>>==========================================" );
View Full Code Here

     */
    public void setMaxLengthLength( int maxLengthLength ) throws DecoderException
    {
        if ( ( this.indefiniteLengthAllowed ) && ( maxLengthLength > 126 ) )
        {
            throw new DecoderException( I18n.err( I18n.ERR_00011_LENGTH_TOO_LONG_FOR_DEFINITE_FORM ) );
        }

        this.maxLengthLength = maxLengthLength;
    }
View Full Code Here

                        }
                        catch ( IntegerDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04050 );
                            LOG.error( msg, e );
                            throw new DecoderException( msg );
                        }
                    }
                } );

        /**
 
View Full Code Here

        {
            String msg = I18n.err( I18n.ERR_04075 );
            LOG.error( msg );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( msg );
        }

        try
        {
            int abandonnedMessageId = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );

            abandonRequest.setAbandoned( abandonnedMessageId );

            if ( IS_DEBUG )
            {
                LOG
                    .debug( "AbandonMessage Id has been decoded : {}", Integer
                        .valueOf( abandonnedMessageId ) );
            }

            container.setGrammarEndAllowed( true );

            return;
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n
                .err( I18n.ERR_04076, Strings.dumpBytes( value.getData() ), ide.getMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( ide.getMessage(), ide );
        }
    }
View Full Code Here

        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04068 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04069 ) );
        }

        Value value = tlv.getValue();

        try
        {
            int messageId = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );

            container.setMessageId( messageId );

            if ( IS_DEBUG )
            {
                LOG.debug( "Ldap Message Id has been decoded : " + messageId );
            }
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ), ide
                .getLocalizedMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( ide.getMessage() );
        }
    }
View Full Code Here

        {
            LOG.error( I18n
                .err( I18n.ERR_04091, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( bde.getMessage() );
        }

        // We can have an END transition
        container.setGrammarEndAllowed( true );
View Full Code Here

        {
            LOG.error( I18n
                .err( I18n.ERR_04100, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( bde.getMessage() );
        }

        // We can have an END transition
        container.setGrammarEndAllowed( true );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.AbstractAsn1Object

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.