diff options
author | Max Kellermann <max@duempel.org> | 2013-10-19 19:35:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-19 19:35:37 +0200 |
commit | 32645b80c4c6792140e312b5b9fe9f96b48c6ec7 (patch) | |
tree | a3e229576fc0b5572f7f05d930222a3dd2b436b1 /src/ClientInternal.hxx | |
parent | ff626ac76357940b2f0ac5cb243a68ac13df0f8a (diff) | |
download | mpd-32645b80c4c6792140e312b5b9fe9f96b48c6ec7.tar.gz mpd-32645b80c4c6792140e312b5b9fe9f96b48c6ec7.tar.xz mpd-32645b80c4c6792140e312b5b9fe9f96b48c6ec7.zip |
ClientInternal: move class Client to Client.hxx
Publish the Client API, preparing to move more code into the Client
class.
Diffstat (limited to '')
-rw-r--r-- | src/ClientInternal.hxx | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/ClientInternal.hxx b/src/ClientInternal.hxx index 4e252a24c..4df58eee6 100644 --- a/src/ClientInternal.hxx +++ b/src/ClientInternal.hxx @@ -22,103 +22,13 @@ #include "check.h" #include "Client.hxx" -#include "ClientMessage.hxx" -#include "CommandListBuilder.hxx" -#include "event/FullyBufferedSocket.hxx" -#include "event/TimeoutMonitor.hxx" #include "command.h" -#include <set> -#include <string> -#include <list> - enum { CLIENT_MAX_SUBSCRIPTIONS = 16, CLIENT_MAX_MESSAGES = 64, }; -struct Partition; - -class Client final : private FullyBufferedSocket, TimeoutMonitor { -public: - Partition &partition; - struct playlist &playlist; - struct player_control &player_control; - - unsigned permission; - - /** the uid of the client process, or -1 if unknown */ - int uid; - - CommandListBuilder cmd_list; - - unsigned int num; /* client number */ - - /** is this client waiting for an "idle" response? */ - bool idle_waiting; - - /** idle flags pending on this client, to be sent as soon as - the client enters "idle" */ - unsigned idle_flags; - - /** idle flags that the client wants to receive */ - unsigned idle_subscriptions; - - /** - * A list of channel names this client is subscribed to. - */ - std::set<std::string> subscriptions; - - /** - * The number of subscriptions in #subscriptions. Used to - * limit the number of subscriptions. - */ - unsigned num_subscriptions; - - /** - * A list of messages this client has received. - */ - std::list<ClientMessage> messages; - - Client(EventLoop &loop, Partition &partition, - int fd, int uid, int num); - - bool IsConnected() const { - return FullyBufferedSocket::IsDefined(); - } - - gcc_pure - bool IsSubscribed(const char *channel_name) const { - return subscriptions.find(channel_name) != subscriptions.end(); - } - - gcc_pure - bool IsExpired() const { - return !FullyBufferedSocket::IsDefined(); - } - - void Close(); - void SetExpired(); - - using FullyBufferedSocket::Write; - - /** - * Send "idle" response to this client. - */ - void IdleNotify(); - void IdleAdd(unsigned flags); - bool IdleWait(unsigned flags); - -private: - /* virtual methods from class BufferedSocket */ - virtual InputResult OnSocketInput(void *data, size_t length) override; - virtual void OnSocketError(Error &&error) override; - virtual void OnSocketClosed() override; - - /* virtual methods from class TimeoutMonitor */ - virtual void OnTimeout() override; -}; - extern const class Domain client_domain; extern int client_timeout; |