/** * Makes a AddRequest encodable. * * @param codec The LDAP service instance * @param decoratedMessage the decorated AddRequest */ public ResponseDecorator( LdapApiService codec, M decoratedMessage ) { super( codec, decoratedMessage ); ldapResultDecorator = new LdapResultDecorator( codec, decoratedMessage.getLdapResult() ); }
/** * Compute the ModifyResponse length * <br> * ModifyResponse : * <pre> * 0x67 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * Length(ModifyResponse) = Length(0x67) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { modifyResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( modifyResponseLength ) + modifyResponseLength; }
/** * Encode the ModifyDnResponse message to a PDU. * * @param buffer The buffer where to put the PDU */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The ModifyResponse Tag buffer.put( LdapCodecConstants.MODIFY_DN_RESPONSE_TAG ); buffer.put( TLV.getBytes( modifyDnResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } return buffer; } }
ldapResultLength = 1 + 1 + BerValue.getNbBytes( getResultCode().getValue() ); if ( getMatchedDn() == null ) matchedDnBytes = Strings.getBytesUtf8Ascii( Strings.trimLeft( getMatchedDn().getName() ) ); ldapResultLength += 1 + TLV.getNbBytes( matchedDnBytes.length ) + matchedDnBytes.length; errorMessageBytes = Strings.getBytesUtf8Ascii( getDiagnosticMessage() ); ldapResultLength += 1 + TLV.getNbBytes( errorMessageBytes.length ) + errorMessageBytes.length; int referralLength = LdapEncoder.computeReferralLength( getReferral() );
/** * Compute the AddResponse length * <br> * AddResponse : * <pre> * 0x69 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * * Length(AddResponse) = Length(0x69) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { AddResponse addResponse = getAddResponse(); setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) ); addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( addResponseLength ) + addResponseLength; }
BerValue.encodeEnumerated( buffer, getResultCode().getValue() ); Referral referral = getReferral();
ldapResultLength = 1 + 1 + BerValue.getNbBytes( getResultCode().getValue() ); if ( getMatchedDn() == null ) matchedDnBytes = Strings.getBytesUtf8Ascii( Strings.trimLeft( getMatchedDn().getName() ) ); ldapResultLength += 1 + TLV.getNbBytes( matchedDnBytes.length ) + matchedDnBytes.length; errorMessageBytes = Strings.getBytesUtf8Ascii( getDiagnosticMessage() ); ldapResultLength += 1 + TLV.getNbBytes( errorMessageBytes.length ) + errorMessageBytes.length; int referralLength = LdapEncoder.computeReferralLength( getReferral() );
/** * Compute the AddResponse length * <br> * AddResponse : * <pre> * 0x69 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * * Length(AddResponse) = Length(0x69) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { AddResponse addResponse = getAddResponse(); setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) ); addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( addResponseLength ) + addResponseLength; }
BerValue.encodeEnumerated( buffer, getResultCode().getValue() ); Referral referral = getReferral();
ldapResultLength = 1 + 1 + BerValue.getNbBytes( getResultCode().getValue() ); if ( getMatchedDn() == null ) matchedDnBytes = Strings.getBytesUtf8Ascii( Strings.trimLeft( getMatchedDn().getName() ) ); ldapResultLength += 1 + TLV.getNbBytes( matchedDnBytes.length ) + matchedDnBytes.length; errorMessageBytes = Strings.getBytesUtf8Ascii( getDiagnosticMessage() ); ldapResultLength += 1 + TLV.getNbBytes( errorMessageBytes.length ) + errorMessageBytes.length; int referralLength = LdapEncoder.computeReferralLength( getReferral() );
/** * Encode the ModifyDnResponse message to a PDU. * * @param buffer The buffer where to put the PDU */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The ModifyResponse Tag buffer.put( LdapCodecConstants.MODIFY_DN_RESPONSE_TAG ); buffer.put( TLV.getBytes( modifyDnResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } return buffer; } }
/** * Compute the ModifyDNResponse length * <br> * ModifyDNResponse : * <pre> * 0x6D L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * Length(ModifyDNResponse) = Length(0x6D) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { modifyDnResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( modifyDnResponseLength ) + modifyDnResponseLength; }
/** * Compute the AddResponse length * <br> * AddResponse : * <pre> * 0x69 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * * Length(AddResponse) = Length(0x69) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { AddResponse addResponse = getAddResponse(); setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) ); addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( addResponseLength ) + addResponseLength; }
BerValue.encodeEnumerated( buffer, getResultCode().getValue() ); Referral referral = getReferral();
/** * Makes a AddRequest encodable. * * @param codec The LDAP service instance * @param decoratedMessage the decorated AddRequest */ public ResponseDecorator( LdapApiService codec, M decoratedMessage ) { super( codec, decoratedMessage ); ldapResultDecorator = new LdapResultDecorator( codec, decoratedMessage.getLdapResult() ); }
/** * Encode the CompareResponse message to a PDU. * * @param buffer The buffer where to put the PDU */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The CompareResponse Tag buffer.put( LdapCodecConstants.COMPARE_RESPONSE_TAG ); buffer.put( TLV.getBytes( compareResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } return buffer; } }
/** * Compute the SearchResultDone length * <br> * SearchResultDone : * <pre> * 0x65 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * Length(SearchResultDone) = Length(0x65) + Length(L1) + L1 * </pre> * */ @Override public int computeLength() { searchResultDoneLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( searchResultDoneLength ) + searchResultDoneLength; }
/** * Makes a AddRequest encodable. * * @param codec The LDAP service instance * @param decoratedMessage the decorated AddRequest */ public ResponseDecorator( LdapApiService codec, M decoratedMessage ) { super( codec, decoratedMessage ); ldapResultDecorator = new LdapResultDecorator( codec, decoratedMessage.getLdapResult() ); }
/** * Encode the CompareResponse message to a PDU. * * @param buffer The buffer where to put the PDU */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The CompareResponse Tag buffer.put( LdapCodecConstants.COMPARE_RESPONSE_TAG ); buffer.put( TLV.getBytes( compareResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } return buffer; } }
/** * Compute the SearchResultDone length * <br> * SearchResultDone : * <pre> * 0x65 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * Length(SearchResultDone) = Length(0x65) + Length(L1) + L1 * </pre> * */ @Override public int computeLength() { searchResultDoneLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( searchResultDoneLength ) + searchResultDoneLength; }