source: filezilla/trunk/fuentes/src/engine/backend.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 1.2 KB
Line 
1#ifndef __BACKEND_H__
2#define __BACKEND_H__
3
4#include "ratelimiter.h"
5#include "socket.h"
6
7class CBackend : public CRateLimiterObject, public CSocketEventSource
8{
9public:
10        CBackend(CEventHandler* pEvtHandler);
11        virtual ~CBackend();
12
13        CBackend(CBackend const&) = delete;
14        CBackend& operator=(CBackend const&) = delete;
15
16        virtual int Read(void *buffer, unsigned int size, int& error) = 0;
17        virtual int Peek(void *buffer, unsigned int size, int& error) = 0;
18        virtual int Write(const void *buffer, unsigned int size, int& error) = 0;
19
20        virtual void OnRateAvailable(enum CRateLimiter::rate_direction direction) = 0;
21
22protected:
23        CEventHandler* const m_pEvtHandler;
24};
25
26class CSocket;
27class CSocketBackend final : public CBackend
28{
29public:
30        CSocketBackend(CEventHandler* pEvtHandler, CSocket & socket, CRateLimiter& rateLimiter);
31        virtual ~CSocketBackend();
32        // Backend definitions
33        virtual int Read(void *buffer, unsigned int size, int& error);
34        virtual int Peek(void *buffer, unsigned int size, int& error);
35        virtual int Write(const void *buffer, unsigned int size, int& error);
36
37protected:
38        virtual void OnRateAvailable(enum CRateLimiter::rate_direction direction);
39
40        CSocket &socket_;
41        CRateLimiter& m_rateLimiter;
42};
43
44#endif //__BACKEND_H__
Note: See TracBrowser for help on using the repository browser.