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

Last change on this file since 3185 was 3185, checked in by jrpelegrina, 3 years ago

Update new version: 3.15.02

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(fz::event_handler* 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(CRateLimiter::rate_direction direction) = 0;
21
22protected:
23        fz::event_handler* const m_pEvtHandler;
24};
25
26class CSocket;
27class CSocketBackend final : public CBackend
28{
29public:
30        CSocketBackend(fz::event_handler* 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(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.