2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#pragma once
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "base/Event.h"
|
|
|
|
|
#include "base/EventTypes.h"
|
2025-03-19 21:27:14 +00:00
|
|
|
#include "deskflow/OptionTypes.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2025-01-06 00:55:07 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2014-11-11 13:51:47 +00:00
|
|
|
class ClientProxy;
|
|
|
|
|
class EventQueueTimer;
|
2024-09-17 19:00:25 +00:00
|
|
|
namespace deskflow {
|
2024-07-02 19:07:06 +00:00
|
|
|
class IStream;
|
|
|
|
|
}
|
2014-11-11 13:51:47 +00:00
|
|
|
class Server;
|
2013-06-29 14:17:49 +00:00
|
|
|
class IEventQueue;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
class ClientProxyUnknown
|
|
|
|
|
{
|
2012-06-10 16:50:54 +00:00
|
|
|
public:
|
2024-10-17 18:04:35 +00:00
|
|
|
ClientProxyUnknown(deskflow::IStream *stream, double timeout, Server *server, IEventQueue *events);
|
2024-07-02 19:07:06 +00:00
|
|
|
ClientProxyUnknown(ClientProxyUnknown const &) = delete;
|
|
|
|
|
ClientProxyUnknown(ClientProxyUnknown &&) = delete;
|
|
|
|
|
~ClientProxyUnknown();
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
ClientProxyUnknown &operator=(ClientProxyUnknown const &) = delete;
|
|
|
|
|
ClientProxyUnknown &operator=(ClientProxyUnknown &&) = delete;
|
2020-11-03 10:52:56 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! @name manipulators
|
|
|
|
|
//@{
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Get the client proxy
|
|
|
|
|
/*!
|
|
|
|
|
Returns the client proxy created after a successful handshake
|
2025-04-27 19:39:23 +00:00
|
|
|
(i.e. when this object sends a success event). Returns nullptr
|
2024-07-02 19:07:06 +00:00
|
|
|
if the handshake is unsuccessful or incomplete.
|
|
|
|
|
*/
|
|
|
|
|
ClientProxy *orphanClientProxy();
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Get the stream
|
2024-10-17 18:04:35 +00:00
|
|
|
deskflow::IStream *getStream()
|
|
|
|
|
{
|
|
|
|
|
return m_stream;
|
|
|
|
|
}
|
2015-02-02 14:18:34 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//@}
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
void sendSuccess();
|
|
|
|
|
void sendFailure();
|
|
|
|
|
void addStreamHandlers();
|
|
|
|
|
void addProxyHandlers();
|
|
|
|
|
void removeHandlers();
|
2025-01-06 00:55:07 +00:00
|
|
|
void initProxy(const std::string &name, int major, int minor);
|
2024-07-02 19:07:06 +00:00
|
|
|
void removeTimer();
|
|
|
|
|
void handleData(const Event &, void *);
|
|
|
|
|
void handleWriteError(const Event &, void *);
|
|
|
|
|
void handleTimeout(const Event &, void *);
|
|
|
|
|
void handleDisconnect(const Event &, void *);
|
|
|
|
|
void handleReady(const Event &, void *);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
private:
|
2025-05-22 22:22:20 +00:00
|
|
|
deskflow::IStream *m_stream = nullptr;
|
|
|
|
|
EventQueueTimer *m_timer = nullptr;
|
|
|
|
|
ClientProxy *m_proxy = nullptr;
|
|
|
|
|
bool m_ready = false;
|
|
|
|
|
Server *m_server = nullptr;
|
|
|
|
|
IEventQueue *m_events = nullptr;
|
2012-06-10 16:50:54 +00:00
|
|
|
};
|