| 1 | /*
|
|---|
| 2 | * synergy -- mouse and keyboard sharing utility
|
|---|
| 3 | * Copyright (C) 2004 Chris Schoeneman
|
|---|
| 4 | *
|
|---|
| 5 | * This package is free software; you can redistribute it and/or
|
|---|
| 6 | * modify it under the terms of the GNU General Public License
|
|---|
| 7 | * found in the file COPYING that should have accompanied this file.
|
|---|
| 8 | *
|
|---|
| 9 | * This package is distributed in the hope that it will be useful,
|
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | * GNU General Public License for more details.
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | #ifndef ISOCKETMULTIPLEXERJOB_H
|
|---|
| 16 | #define ISOCKETMULTIPLEXERJOB_H
|
|---|
| 17 |
|
|---|
| 18 | #include "IArchNetwork.h"
|
|---|
| 19 | #include "IInterface.h"
|
|---|
| 20 |
|
|---|
| 21 | //! Socket multiplexer job
|
|---|
| 22 | /*!
|
|---|
| 23 | A socket multiplexer job handles events on a socket.
|
|---|
| 24 | */
|
|---|
| 25 | class ISocketMultiplexerJob : public IInterface {
|
|---|
| 26 | public:
|
|---|
| 27 | //! @name manipulators
|
|---|
| 28 | //@{
|
|---|
| 29 |
|
|---|
| 30 | //! Handle socket event
|
|---|
| 31 | /*!
|
|---|
| 32 | Called by a socket multiplexer when the socket becomes readable,
|
|---|
| 33 | writable, or has an error. It should return itself if the same
|
|---|
| 34 | job can continue to service events, a new job if the socket must
|
|---|
| 35 | be serviced differently, or NULL if the socket should no longer
|
|---|
| 36 | be serviced. The socket is readable if \p readable is true,
|
|---|
| 37 | writable if \p writable is true, and in error if \p error is
|
|---|
| 38 | true.
|
|---|
| 39 |
|
|---|
| 40 | This call must not attempt to directly change the job for this
|
|---|
| 41 | socket by calling \c addSocket() or \c removeSocket() on the
|
|---|
| 42 | multiplexer. It must instead return the new job. It can,
|
|---|
| 43 | however, add or remove jobs for other sockets.
|
|---|
| 44 | */
|
|---|
| 45 | virtual ISocketMultiplexerJob*
|
|---|
| 46 | run(bool readable, bool writable, bool error) = 0;
|
|---|
| 47 |
|
|---|
| 48 | //@}
|
|---|
| 49 | //! @name accessors
|
|---|
| 50 | //@{
|
|---|
| 51 |
|
|---|
| 52 | //! Get the socket
|
|---|
| 53 | /*!
|
|---|
| 54 | Return the socket to multiplex
|
|---|
| 55 | */
|
|---|
| 56 | virtual CArchSocket getSocket() const = 0;
|
|---|
| 57 |
|
|---|
| 58 | //! Check for interest in readability
|
|---|
| 59 | /*!
|
|---|
| 60 | Return true if the job is interested in being run if the socket
|
|---|
| 61 | becomes readable.
|
|---|
| 62 | */
|
|---|
| 63 | virtual bool isReadable() const = 0;
|
|---|
| 64 |
|
|---|
| 65 | //! Check for interest in writability
|
|---|
| 66 | /*!
|
|---|
| 67 | Return true if the job is interested in being run if the socket
|
|---|
| 68 | becomes writable.
|
|---|
| 69 | */
|
|---|
| 70 | virtual bool isWritable() const = 0;
|
|---|
| 71 |
|
|---|
| 72 | //@}
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 | #endif
|
|---|