30 #include <boost/intrusive/link_mode.hpp>
31 #include <boost/intrusive/list_hook.hpp>
49 public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
91 int fd,
int uid,
int num);
110 bool Write(
const void *data,
size_t length);
115 bool Write(
const char *data);
138 permission = _permission;
164 return subscriptions.find(channel_name) != subscriptions.end();
202 virtual InputResult OnSocketInput(
void *data,
size_t length)
override;
203 void OnSocketError(std::exception_ptr ep)
override;
204 virtual void OnSocketClosed()
override;
207 virtual void OnTimeout()
override;
SubscribeResult Subscribe(const char *channel)
struct PlayerControl & player_control
unsigned GetPermission() const
unsigned idle_flags
idle flags pending on this client, to be sent as soon as the client enters "idle" ...
std::list< ClientMessage > messages
A list of messages this client has received.
This class monitors a timeout.
An OO wrapper for struct sockaddr.
Client(EventLoop &loop, Partition &partition, int fd, int uid, int num)
bool Unsubscribe(const char *channel)
An event loop that polls for events on file/socket descriptors.
A partition of the Music Player Daemon.
void IdleAdd(unsigned flags)
gcc_printf(2, 3) void client_printf(Client &client
Write a printf-like formatted string to the client.
void SetPermission(unsigned _permission)
CommandListBuilder cmd_list
void client_vprintf(Client &client, const char *fmt, va_list args)
Write a printf-like formatted string to the client.
int GetUID() const
returns the uid of the client process, or a negative value if the uid is unknown
void client_manager_init()
unsigned idle_subscriptions
idle flags that the client wants to receive
gcc_pure bool IsSubscribed(const char *channel_name) const
void client_new(EventLoop &loop, Partition &partition, int fd, SocketAddress address, int uid)
void AllowFile(Path path_fs) const
Is this client allowed to use the specified local file?
A client-to-client message.
A path name in the native file system character set.
gcc_pure const Database * GetDatabase() const
Wrapper for Instance::GetDatabase().
gcc_pure bool IsExpired() const
gcc_pure const Storage * GetStorage() const
unsigned num_subscriptions
The number of subscriptions in subscriptions.
already subscribed to this channel
gcc_pure const Database & GetDatabaseOrThrow() const
Wrapper for Instance::GetDatabaseOrThrow().
void client_puts(Client &client, const char *s)
Write a C string to the client.
bool Write(const void *data, size_t length)
std::set< std::string > subscriptions
A list of channel names this client is subscribed to.
bool PushMessage(const ClientMessage &msg)
bool IsLocal() const
Is this client running on the same machine, connected with a local (UNIX domain) socket?
struct playlist & playlist
A BufferedSocket specialization that adds an output buffer.
int uid
the uid of the client process, or -1 if unknown
bool IdleWait(unsigned flags)
bool idle_waiting
is this client waiting for an "idle" response?
void IdleNotify()
Send "idle" response to this client.
const Partition & partition