/** * @return The TLV Id */ public int getTlvId() { return tlv.getId(); }
/** * Reset the TLV, so it can be reused for the next PDU decoding. */ public void reset() { tag = 0; length = 0; lengthNbBytes = 0; value.reset(); expectedLength = 0; }
/** * Compute the Cancel length * * 0x30 L1 * | * +--> 0x02 0x0(1-4) [0..2^31-1] */ public int computeLength() { // The messageId length cancelSequenceLength = 1 + 1 + Value.getNbBytes( cancelId ); // Add the sequence and the length return 1 + 1 + cancelSequenceLength; }
public void action( IAsn1Container container ) throws DecoderException { PagedResultsControlContainer pagedSearchContainer = ( PagedResultsControlContainer ) container; Value value = pagedSearchContainer.getCurrentTLV().getValue(); if ( pagedSearchContainer.getCurrentTLV().getLength() == 0 ) { pagedSearchContainer.getPagedSearchControl().setCookie( StringTools.EMPTY_BYTES ); } else { pagedSearchContainer.getPagedSearchControl().setCookie( value.getData() ); } // We can have an END transition pagedSearchContainer.grammarEndAllowed( true ); } } );
public void action( SyncStateValueContainer container ) throws DecoderException { Value value = container.getCurrentTLV().getValue(); byte[] cookie = value.getData(); if ( IS_DEBUG ) { LOG.debug( "cookie = {}", cookie ); } container.getSyncStateValueControl().setCookie( cookie ); // terminal state container.setGrammarEndAllowed( true ); } } );
/** * Compute the NotFilter length * NotFilter : * 0xA2 L1 super.computeLength() * * Length(NotFilter) = Length(0xA2) + Length(super.computeLength()) + * super.computeLength() */ public int computeLength() { filtersLength = super.computeLength(); return 1 + TLV.getNbBytes( filtersLength ) + filtersLength; }
public ByteBuffer encode() throws EncoderException { ByteBuffer bb = ByteBuffer.allocate( computeLength() ); bb.put( UniversalTag.SEQUENCE.getValue() ); bb.put( Value.getBytes( requestLength ) ); Value.encode( bb, targetDN ); Value.encode( bb, issuerDN ); Value.encode( bb, subjectDN ); Value.encode( bb, keyAlgorithm ); return bb; }
/** * Encodes the cancel extended operation. * * @return A ByteBuffer that contains the encoded PDU * @throws org.apache.directory.shared.asn1.EncoderException If anything goes wrong. */ public ByteBuffer encode() throws EncoderException { // Allocate the bytes buffer. ByteBuffer bb = ByteBuffer.allocate( computeLength() ); // The sequence bb.put( UniversalTag.SEQUENCE.getValue() ); bb.put( TLV.getBytes( cancelSequenceLength ) ); // The messageId Value.encode( bb, cancelId ); return bb; }
/** * Creates a new TLV object. * * @param id the TLV's id */ public TLV( int id ) { tag = 0; length = 0; lengthNbBytes = 0; value = new Value(); this.id = id; expectedLength = 0; }
public void action( PagedResultsContainer container ) throws DecoderException { Value value = container.getCurrentTLV().getValue(); if ( container.getCurrentTLV().getLength() == 0 ) { container.getDecorator().setCookie( StringConstants.EMPTY_BYTES ); } else { container.getDecorator().setCookie( value.getData() ); } // We can have an END transition container.setGrammarEndAllowed( true ); } } );
public void action( SyncInfoValueContainer container ) { SyncInfoValueDecorator control = container.getSyncInfoValueControl(); Value value = container.getCurrentTLV().getValue(); byte[] cookie = value.getData(); if ( IS_DEBUG ) { LOG.debug( "cookie = " + Strings.dumpBytes(cookie) ); } container.getSyncInfoValueControl().setCookie( cookie ); container.setSyncInfoValueControl( control ); } } );
/** * Compute the NotFilter length * NotFilter : * 0xA2 L1 super.computeLength() * * Length(NotFilter) = Length(0xA2) + Length(super.computeLength()) + * super.computeLength() */ public int computeLength() { filtersLength = super.computeLength(); return 1 + TLV.getNbBytes( filtersLength ) + filtersLength; }
/** * Compute the Cancel length * * 0x30 L1 * | * +--> 0x02 0x0(1-4) [0..2^31-1] */ public int computeLength() { // The messageId length cancelSequenceLength = 1 + 1 + Value.getNbBytes( cancelId ); // Add the sequence and the length return 1 + 1 + cancelSequenceLength; }
/** * Compute the PresentFilter length * PresentFilter : * 0x87 L1 present * * Length(PresentFilter) = Length(0x87) + Length(super.computeLength()) + * super.computeLength() */ public int computeLength() { attributeDescriptionBytes = StringTools.getBytesUtf8( attributeDescription ); return 1 + TLV.getNbBytes( attributeDescriptionBytes.length ) + attributeDescriptionBytes.length; }
@Override public int computeLength() { int len = StringTools.getBytesUtf8( targetDN ).length; requestLength = 1 + Value.getNbBytes( len ) + len; len = StringTools.getBytesUtf8( issuerDN ).length; requestLength += 1 + Value.getNbBytes( len ) + len; len = StringTools.getBytesUtf8( subjectDN ).length; requestLength += 1 + Value.getNbBytes( len ) + len; len = StringTools.getBytesUtf8( keyAlgorithm ).length; requestLength += 1 + Value.getNbBytes( len ) + len; return 1 + Value.getNbBytes( requestLength ) + requestLength; }
/** * Compute the PresentFilter length * PresentFilter : * 0x87 L1 present * * Length(PresentFilter) = Length(0x87) + Length(super.computeLength()) + * super.computeLength() */ public int computeLength() { attributeDescriptionBytes = Strings.getBytesUtf8(attributeDescription); return 1 + TLV.getNbBytes( attributeDescriptionBytes.length ) + attributeDescriptionBytes.length; }
@Override public int computeLength() { int len = Strings.getBytesUtf8(targetDN).length; requestLength = 1 + Value.getNbBytes( len ) + len; len = Strings.getBytesUtf8(issuerDN).length; requestLength += 1 + Value.getNbBytes( len ) + len; len = Strings.getBytesUtf8(subjectDN).length; requestLength += 1 + Value.getNbBytes( len ) + len; len = Strings.getBytesUtf8(keyAlgorithm).length; requestLength += 1 + Value.getNbBytes( len ) + len; return 1 + Value.getNbBytes( requestLength ) + requestLength; }
/** * Compute the OrFilter length * * OrFilter : * 0xA1 L1 super.computeLength() * * Length(OrFilter) = Length(0xA1) + Length(super.computeLength()) + * super.computeLength() */ public int computeLength() { filtersLength = super.computeLength(); return 1 + TLV.getNbBytes( filtersLength ) + filtersLength; }
/** * Compute the AndFilter length * * AndFilter : * 0xA0 L1 super.computeLength() * * Length(AndFilter) = Length(0xA0) + Length(super.computeLength()) + * super.computeLength() */ public int computeLength() { filtersLength = super.computeLength(); return 1 + TLV.getNbBytes( filtersLength ) + filtersLength; }
/** * Compute the DelRequest length * * DelRequest : * 0x4A L1 entry * * L1 = Length(entry) * Length(DelRequest) = Length(0x4A) + Length(L1) + L1 */ protected int computeLengthProtocolOp() { // The entry return 1 + TLV.getNbBytes( DN.getNbBytes( entry ) ) + DN.getNbBytes( entry ); }