Remote Call Framework 3.3
HttpSessionFilter.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://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 under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_HTTPSESSIONFILTER_HPP
19 #define INCLUDE_RCF_HTTPSESSIONFILTER_HPP
20 
21 #include <RCF/Filter.hpp>
22 #include <RCF/ByteBuffer.hpp>
23 
24 #include <cstdint>
25 
26 namespace RCF {
27 
28  class AsioNetworkSession;
29 
30  class RcfSession;
31  typedef std::shared_ptr<RcfSession> RcfSessionPtr;
32 
33  class HttpSession
34  {
35  public:
36 
37  HttpSession(const std::string & httpSessionId);
38  ~HttpSession();
39 
40  RcfSessionPtr mRcfSessionPtr;
41 
42  bool mRequestInProgress;
43  std::uint32_t mLastTouchMs;
44 
45  std::string mHttpSessionId;
46  std::uint32_t mHttpSessionIndex;
47  std::vector<FilterPtr> mTransportFilters;
48 
49  ByteBuffer mCachedReadBuffer;
50  std::size_t mCachedReadBytesRequested;
51  };
52 
53  typedef std::shared_ptr<HttpSession> HttpSessionPtr;
54 
55  class HttpSessionFilter : public Filter
56  {
57  public:
58 
59  HttpSessionFilter(AsioNetworkSession& networkSession);
60  ~HttpSessionFilter();
61 
62  virtual void resetState();
63 
64  virtual void read(
65  const ByteBuffer &byteBuffer,
66  std::size_t bytesRequested);
67 
68  virtual void onReadCompleted(const ByteBuffer &byteBuffer);
69 
70  virtual void write(const std::vector<ByteBuffer> &byteBuffers);
71 
72  virtual void onWriteCompleted(std::size_t bytesTransferred);
73 
74  virtual int getFilterId() const;
75 
76  ByteBuffer mReadBuffer;
77 
78  std::vector<ByteBuffer> mWriteBuffers;
79 
80  AsioNetworkSession & mNetworkSession;
81  HttpSessionPtr mHttpSessionPtr;
82 
83  const std::vector<FilterPtr> mNoFilters;
84 
85  char mDummy;
86  };
87 
88 } // namespace RCF
89 
90 #endif // ! INCLUDE_RCF_HTTPSESSIONFILTER_HPP
Definition: AmiIoHandler.hpp:23