11 #include "interfaces/json-rpc/IClient.h"    12 #include "interfaces/json-rpc/IJSONRPCAnnouncer.h"    13 #include "interfaces/json-rpc/ITransportLayer.h"    14 #include "threads/CriticalSection.h"    15 #include "threads/Thread.h"    16 #include "websocket/WebSocket.h"    20 #include <sys/socket.h>    22 #include "PlatformDefs.h"    31     static bool StartServer(
int port, 
bool nonlocal);
    32     static void StopServer(
bool bWait);
    33     static bool IsRunning();
    35     bool PrepareDownload(
const char *path, 
CVariant &details, std::string &protocol) 
override;
    36     bool Download(
const char *path, 
CVariant &result) 
override;
    37     int GetCapabilities() 
override;
    39     void Announce(ANNOUNCEMENT::AnnouncementFlag flag,
    40                   const std::string& sender,
    41                   const std::string& message,
    45     void Process() 
override;
    49     bool InitializeBlue();
    53     class CTCPClient : 
public IClient    59       CTCPClient(
const CTCPClient& client);
    60       CTCPClient& operator=(
const CTCPClient& client);
    61       ~CTCPClient() 
override = 
default;
    63       int GetPermissionFlags() 
override;
    64       int GetAnnouncementFlags() 
override;
    65       bool SetAnnouncementFlags(
int flags) 
override;
    67       virtual void Send(
const char *data, 
unsigned int size);
    68       virtual void PushBuffer(
CTCPServer *host, 
const char *buffer, 
int length);
    69       virtual void Disconnect();
    71       virtual bool IsNew()
 const { 
return m_new; }
    72       virtual bool Closing()
 const { 
return false; }
    75       sockaddr_storage m_cliaddr;
    77       CCriticalSection m_critSection;
    80       void Copy(
const CTCPClient& client);
    83       int m_announcementflags;
    84       int m_beginBrackets, m_endBrackets;
    85       char m_beginChar, m_endChar;
    89     class CWebSocketClient : 
public CTCPClient
    92       explicit CWebSocketClient(
CWebSocket *websocket);
    93       CWebSocketClient(
const CWebSocketClient& client);
    94       CWebSocketClient(
CWebSocket *websocket, 
const CTCPClient& client);
    95       CWebSocketClient& operator=(
const CWebSocketClient& client);
    96       ~CWebSocketClient() 
override;
    98       void Send(
const char *data, 
unsigned int size) 
override;
    99       void PushBuffer(
CTCPServer *host, 
const char *buffer, 
int length) 
override;
   100       void Disconnect() 
override;
   102       bool IsNew()
 const override { 
return m_websocket == NULL; }
   103       bool Closing()
 const override { 
return m_websocket != NULL && m_websocket->GetState() == WebSocketStateClosed; }
   107       std::string m_buffer;
   110     std::vector<CTCPClient*> m_connections;
   111     std::vector<SOCKET> m_servers;
 
Definition: TCPServer.h:28
Definition: WebSocket.h:107
Definition: AddonsOperations.h:23
Definition: IJSONRPCAnnouncer.h:17
Definition: ITransportLayer.h:27