aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-29 09:36:42 +0200
committerMax Kellermann <max@duempel.org>2008-08-29 09:36:42 +0200
commit8b1b82b36374e95bcef8195fcd15e4014e73567d (patch)
tree90efdb2f715a44e2ccc3387e479cf56512225e01 /src/client.c
parent2c8aa8efde879b6b9396aaa06edfa4506c55842e (diff)
downloadmpd-8b1b82b36374e95bcef8195fcd15e4014e73567d.tar.gz
mpd-8b1b82b36374e95bcef8195fcd15e4014e73567d.tar.xz
mpd-8b1b82b36374e95bcef8195fcd15e4014e73567d.zip
client: pass the client struct to processCommand()
Start exporting the client struct as an opaque struct. For now, pass it only to processCommand() and processListOfCommands(), and provide a function to extract the socket handle. Later, we will propagate the pointer to all command implementations, and of course to client_print() etc.
Diffstat (limited to '')
-rw-r--r--src/client.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c
index c0cca399e..7f47aacd4 100644
--- a/src/client.c
+++ b/src/client.c
@@ -324,6 +324,14 @@ void client_new(int fd, const struct sockaddr *addr)
sockaddr_to_tmp_string(addr));
}
+int client_get_fd(struct client *client)
+{
+ assert(client != NULL);
+ assert(client->fd >= 0);
+
+ return client->fd;
+}
+
static int client_process_line(struct client *client)
{
int ret = 1;
@@ -335,7 +343,7 @@ static int client_process_line(struct client *client)
"list\n", client->num);
global_expired = 0;
- ret = processListOfCommands(client->fd,
+ ret = processListOfCommands(client,
&(client->permission),
&global_expired,
client->cmd_list_OK,
@@ -384,7 +392,7 @@ static int client_process_line(struct client *client)
} else {
DEBUG("client %i: process command \"%s\"\n",
client->num, line);
- ret = processCommand(client->fd,
+ ret = processCommand(client,
&(client->permission), line);
DEBUG("client %i: command returned %i\n",
client->num, ret);