2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-08-17 16:28:39 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2002 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 "arch/IArchNetwork.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
//! Socket multiplexer job
|
|
|
|
|
/*!
|
|
|
|
|
A socket multiplexer job handles events on a socket.
|
|
|
|
|
*/
|
2025-08-17 16:28:39 +00:00
|
|
|
class ISocketMultiplexerJob
|
2024-10-17 18:04:35 +00:00
|
|
|
{
|
2012-06-10 16:50:54 +00:00
|
|
|
public:
|
2025-08-17 16:28:39 +00:00
|
|
|
virtual ~ISocketMultiplexerJob() = default;
|
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
|
|
|
//! Handle socket event
|
|
|
|
|
/*!
|
|
|
|
|
Called by a socket multiplexer when the socket becomes readable,
|
|
|
|
|
writable, or has an error. It should return itself if the same
|
|
|
|
|
job can continue to service events, a new job if the socket must
|
2025-04-27 19:39:23 +00:00
|
|
|
be serviced differently, or nullptr if the socket should no longer
|
2024-07-02 19:07:06 +00:00
|
|
|
be serviced. The socket is readable if \p readable is true,
|
|
|
|
|
writable if \p writable is true, and in error if \p error is
|
|
|
|
|
true.
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
This call must not attempt to directly change the job for this
|
|
|
|
|
socket by calling \c addSocket() or \c removeSocket() on the
|
|
|
|
|
multiplexer. It must instead return the new job. It can,
|
|
|
|
|
however, add or remove jobs for other sockets.
|
|
|
|
|
*/
|
2024-10-17 18:04:35 +00:00
|
|
|
virtual ISocketMultiplexerJob *run(bool readable, bool writable, bool error) = 0;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//@}
|
|
|
|
|
//! @name accessors
|
|
|
|
|
//@{
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Get the socket
|
|
|
|
|
/*!
|
|
|
|
|
Return the socket to multiplex
|
|
|
|
|
*/
|
|
|
|
|
virtual ArchSocket getSocket() const = 0;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Check for interest in readability
|
|
|
|
|
/*!
|
|
|
|
|
Return true if the job is interested in being run if the socket
|
|
|
|
|
becomes readable.
|
|
|
|
|
*/
|
|
|
|
|
virtual bool isReadable() const = 0;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Check for interest in writability
|
|
|
|
|
/*!
|
|
|
|
|
Return true if the job is interested in being run if the socket
|
|
|
|
|
becomes writable.
|
|
|
|
|
*/
|
|
|
|
|
virtual bool isWritable() const = 0;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//@}
|
2012-06-10 16:50:54 +00:00
|
|
|
};
|