Example #1
0
        void write(const std::vector<ByteBuffer> &byteBuffers)
        {
            std::copy(
                byteBuffers.begin(),
                byteBuffers.end(),
                std::back_inserter(mByteBuffers));

            std::size_t bytesTransferred = lengthByteBuffers(byteBuffers);
            getPreFilter().onWriteCompleted(bytesTransferred);
        }
 void XorFilter::onReadCompleted(const ByteBuffer &byteBuffer, int error)
 {
     RCF_UNUSED_VARIABLE(error);
     // TODO: error handling
     for (std::size_t i=0; i<byteBuffer.getLength() ; ++i)
     {
         byteBuffer.getPtr() [i] ^= mMask;
     }
     getPreFilter().onReadCompleted(byteBuffer, 0);
 }
Example #3
0
        void read(const ByteBuffer &byteBuffer, std::size_t bytesRequested)
        {
            RCF_ASSERT(byteBuffer.isEmpty())(byteBuffer.getLength());

            RCF_ASSERT_LT(mInByteBufferPos, mInByteBuffer.getLength());

            std::size_t bytesRemaining = mInByteBuffer.getLength() - mInByteBufferPos;
            std::size_t bytesToRead = RCF_MIN(bytesRemaining, bytesRequested);
            ByteBuffer myByteBuffer(mInByteBuffer, mInByteBufferPos, bytesToRead);
            mInByteBufferPos += bytesToRead;
            getPreFilter().onReadCompleted(myByteBuffer);
        }
Example #4
0
 void IdentityFilter::onWriteCompleted(std::size_t bytesTransferred)
 {
     getPreFilter().onWriteCompleted(bytesTransferred);
 }
Example #5
0
 void IdentityFilter::onReadCompleted(const ByteBuffer &byteBuffer)
 {
     getPreFilter().onReadCompleted(byteBuffer);
 }
 void XorFilter::onWriteCompleted(std::size_t bytesTransferred, int error)
 {
     RCF_UNUSED_VARIABLE(error);
     // TODO: error handling
     getPreFilter().onWriteCompleted(bytesTransferred, 0);
 }