/** * 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; }
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 gracefulShutdown 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() ); bb.put( UniversalTag.SEQUENCE.getValue() ); bb.put( TLV.getBytes( gracefulSequenceLength ) ); if ( timeOffline != 0 ) { Value.encode( bb, timeOffline ); } if ( delay != 0 ) { bb.put( ( byte ) GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG ); bb.put( ( byte ) Value.getNbBytes( delay ) ); bb.put( Value.getBytes( delay ) ); } return bb; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( pscSeqLength ) ); Value.encode( buffer, getSize() ); Value.encode( buffer, getCookie() ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * {@inheritDoc} */ public byte[] getValue() { if ( value == null ) { try { computeLength(); ByteBuffer buffer = ByteBuffer.allocate( valueLength ); // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( psearchSeqLength ) ); Value.encode( buffer, getChangeTypes() ); Value.encode( buffer, isChangesOnly() ); Value.encode( buffer, isReturnECs() ); value = buffer.array(); } catch ( Exception e ) { return null; } } return value; }
/** * Encode the SyncStateValue control * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the SEQ buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( syncStateSeqLength ) ); // The mode buffer.put( UniversalTag.ENUMERATED.getValue() ); buffer.put( ( byte ) 0x01 ); buffer.put( Value.getBytes( getSyncStateType().getValue() ) ); // the entryUUID Value.encode( buffer, getEntryUUID() ); // The cookie if ( getCookie() != null ) { Value.encode( buffer, getCookie() ); } return buffer; }
/** * Encodes the entry change control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( eccSeqLength ) ); buffer.put( UniversalTag.ENUMERATED.getValue() ); buffer.put( ( byte ) 1 ); buffer.put( Value.getBytes( getChangeType().getValue() ) ); if ( getPreviousDn() != null ) { Value.encode( buffer, previousDnBytes ); } if ( getChangeNumber() != UNDEFINED_CHANGE_NUMBER ) { Value.encode( buffer, getChangeNumber() ); } return buffer; }
buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( syncDoneValueLength ) );
/** * Encodes the paged search control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( pscSeqLength ) ); Value.encode( buffer, getSize() ); Value.encode( buffer, getCookie() ); return buffer; }
/** * Encodes the persistent search control. * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong. */ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Now encode the PagedSearch specific part buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( psearchSeqLength ) ); Value.encode( buffer, getChangeTypes() ); Value.encode( buffer, isChangesOnly() ); Value.encode( buffer, isReturnECs() ); return buffer; }
/** * Encode the SyncDoneValue control * * @param buffer The encoded sink * @return A ByteBuffer that contains the encoded PDU * @throws EncoderException If anything goes wrong while encoding. */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { if ( buffer == null ) { throw new EncoderException( I18n.err( I18n.ERR_04023 ) ); } // Encode the SEQ buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( syncDoneValueLength ) ); if ( getCookie() != null ) { Value.encode( buffer, getCookie() ); } if ( isRefreshDeletes() ) { Value.encode( buffer, isRefreshDeletes() ); } return buffer; }
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( UniversalTag.ENUMERATED.getValue() ); buffer.put( ( byte ) 1 ); buffer.put( ( byte ) getResultCode().getValue() );
buffer.put( UniversalTag.SEQUENCE.getValue() ); buffer.put( TLV.getBytes( ppolicySeqLength ) );