MPD
0.20.18
|
#include <Client.hxx>
Public Types | |
enum | SubscribeResult { SubscribeResult::OK, SubscribeResult::INVALID, SubscribeResult::ALREADY, SubscribeResult::FULL } |
Public Member Functions | |
Client (EventLoop &loop, Partition &partition, int fd, int uid, int num) | |
~Client () | |
bool | IsConnected () const |
gcc_pure bool | IsExpired () const noexcept |
void | Close () |
void | SetExpired () |
bool | Write (const void *data, size_t length) |
bool | Write (const char *data) |
Write a null-terminated string. More... | |
int | GetUID () const |
returns the uid of the client process, or a negative value if the uid is unknown More... | |
bool | IsLocal () const |
Is this client running on the same machine, connected with a local (UNIX domain) socket? More... | |
unsigned | GetPermission () const |
void | SetPermission (unsigned _permission) |
void | IdleNotify () |
Send "idle" response to this client. More... | |
void | IdleAdd (unsigned flags) |
bool | IdleWait (unsigned flags) |
gcc_pure bool | IsSubscribed (const char *channel_name) const noexcept |
SubscribeResult | Subscribe (const char *channel) |
bool | Unsubscribe (const char *channel) |
void | UnsubscribeAll () |
bool | PushMessage (const ClientMessage &msg) |
void | AllowFile (Path path_fs) const |
Is this client allowed to use the specified local file? More... | |
gcc_pure const Database * | GetDatabase () const noexcept |
Wrapper for Instance::GetDatabase(). More... | |
const Database & | GetDatabaseOrThrow () const |
Wrapper for Instance::GetDatabaseOrThrow(). More... | |
gcc_pure const Storage * | GetStorage () const noexcept |
Data Fields | |
Partition & | partition |
struct playlist & | playlist |
struct PlayerControl & | player_control |
unsigned | permission |
int | uid |
the uid of the client process, or -1 if unknown More... | |
CommandListBuilder | cmd_list |
unsigned int | num |
bool | idle_waiting |
is this client waiting for an "idle" response? More... | |
unsigned | idle_flags |
idle flags pending on this client, to be sent as soon as the client enters "idle" More... | |
unsigned | idle_subscriptions |
idle flags that the client wants to receive More... | |
std::set< std::string > | subscriptions |
A list of channel names this client is subscribed to. More... | |
unsigned | num_subscriptions |
The number of subscriptions in subscriptions. More... | |
std::list< ClientMessage > | messages |
A list of messages this client has received. More... | |
Definition at line 47 of file Client.hxx.
|
strong |
Enumerator | |
---|---|
OK |
success |
INVALID |
invalid channel name |
ALREADY |
already subscribed to this channel |
FULL |
too many subscriptions |
Definition at line 148 of file Client.hxx.
|
inline |
Definition at line 93 of file Client.hxx.
void Client::AllowFile | ( | Path | path_fs | ) | const |
Is this client allowed to use the specified local file?
Note that this function is vulnerable to timing/symlink attacks. We cannot fix this as long as there are plugins that open a file by its name, and not by file descriptor / callbacks.
Throws #std::runtime_error on error.
path_fs | the absolute path name in filesystem encoding |
void Client::Close | ( | ) |
Wrapper for Instance::GetDatabase().
const Database& Client::GetDatabaseOrThrow | ( | ) | const |
Wrapper for Instance::GetDatabaseOrThrow().
|
inline |
Definition at line 133 of file Client.hxx.
|
inline |
returns the uid of the client process, or a negative value if the uid is unknown
Definition at line 121 of file Client.hxx.
void Client::IdleAdd | ( | unsigned | flags | ) |
void Client::IdleNotify | ( | ) |
Send "idle" response to this client.
bool Client::IdleWait | ( | unsigned | flags | ) |
|
inline |
Definition at line 98 of file Client.hxx.
|
inlinenoexcept |
Definition at line 103 of file Client.hxx.
|
inline |
Is this client running on the same machine, connected with a local (UNIX domain) socket?
Definition at line 129 of file Client.hxx.
|
inlinenoexcept |
Definition at line 163 of file Client.hxx.
bool Client::PushMessage | ( | const ClientMessage & | msg | ) |
void Client::SetExpired | ( | ) |
|
inline |
Definition at line 137 of file Client.hxx.
SubscribeResult Client::Subscribe | ( | const char * | channel | ) |
bool Client::Unsubscribe | ( | const char * | channel | ) |
void Client::UnsubscribeAll | ( | ) |
bool Client::Write | ( | const void * | data, |
size_t | length | ||
) |
bool Client::Write | ( | const char * | data | ) |
Write a null-terminated string.
CommandListBuilder Client::cmd_list |
Definition at line 60 of file Client.hxx.
unsigned Client::idle_flags |
idle flags pending on this client, to be sent as soon as the client enters "idle"
Definition at line 69 of file Client.hxx.
unsigned Client::idle_subscriptions |
idle flags that the client wants to receive
Definition at line 72 of file Client.hxx.
bool Client::idle_waiting |
is this client waiting for an "idle" response?
Definition at line 65 of file Client.hxx.
std::list<ClientMessage> Client::messages |
A list of messages this client has received.
Definition at line 88 of file Client.hxx.
unsigned int Client::num |
Definition at line 62 of file Client.hxx.
unsigned Client::num_subscriptions |
The number of subscriptions in subscriptions.
Used to limit the number of subscriptions.
Definition at line 83 of file Client.hxx.
Partition& Client::partition |
Definition at line 51 of file Client.hxx.
unsigned Client::permission |
Definition at line 55 of file Client.hxx.
struct PlayerControl& Client::player_control |
Definition at line 53 of file Client.hxx.
struct playlist& Client::playlist |
Definition at line 52 of file Client.hxx.
std::set<std::string> Client::subscriptions |
A list of channel names this client is subscribed to.
Definition at line 77 of file Client.hxx.
int Client::uid |
the uid of the client process, or -1 if unknown
Definition at line 58 of file Client.hxx.