RCFProto
 All Classes Functions Typedefs
XorFilter.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_XORFILTER_HPP
20 #define INCLUDE_RCF_XORFILTER_HPP
21 
22 #include <vector>
23 
24 #include <RCF/ByteBuffer.hpp>
25 #include <RCF/Filter.hpp>
26 
27 namespace RCF {
28 
29  class XorFilter : public IdentityFilter
30  {
31  public:
32  int getFilterId() const;
33 
34  XorFilter();
35  void read(const ByteBuffer &byteBuffer, std::size_t bytesRequested);
36  void write(const std::vector<ByteBuffer> &byteBuffers);
37  void onReadCompleted(const ByteBuffer &byteBuffer);
38  void onWriteCompleted(std::size_t bytesTransferred);
39 
40  private:
41  std::size_t mTotalBytes;
42  std::vector<ByteBuffer> mByteBuffers;
43  std::vector<ByteBuffer> mTempByteBuffers;
44  char mMask;
45  };
46 
47 } // namespace RCF
48 
49 #endif // ! INCLUDE_RCF_XORFILTER_HPP