aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/Ack.cxx24
-rw-r--r--src/protocol/Ack.hxx43
-rw-r--r--src/protocol/ArgParser.cxx (renamed from src/protocol/argparser.c)18
-rw-r--r--src/protocol/ArgParser.hxx (renamed from src/protocol/argparser.h)21
-rw-r--r--src/protocol/Result.cxx (renamed from src/protocol/result.c)12
-rw-r--r--src/protocol/Result.hxx (renamed from src/protocol/result.h)21
6 files changed, 103 insertions, 36 deletions
diff --git a/src/protocol/Ack.cxx b/src/protocol/Ack.cxx
new file mode 100644
index 000000000..3c8185afd
--- /dev/null
+++ b/src/protocol/Ack.cxx
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+#include "Ack.hxx"
+#include "util/Domain.hxx"
+
+const Domain ack_domain("ack");
diff --git a/src/protocol/Ack.hxx b/src/protocol/Ack.hxx
new file mode 100644
index 000000000..a7f8e5e53
--- /dev/null
+++ b/src/protocol/Ack.hxx
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPD_ACK_H
+#define MPD_ACK_H
+
+class Domain;
+
+enum ack {
+ ACK_ERROR_NOT_LIST = 1,
+ ACK_ERROR_ARG = 2,
+ ACK_ERROR_PASSWORD = 3,
+ ACK_ERROR_PERMISSION = 4,
+ ACK_ERROR_UNKNOWN = 5,
+
+ ACK_ERROR_NO_EXIST = 50,
+ ACK_ERROR_PLAYLIST_MAX = 51,
+ ACK_ERROR_SYSTEM = 52,
+ ACK_ERROR_PLAYLIST_LOAD = 53,
+ ACK_ERROR_UPDATE_ALREADY = 54,
+ ACK_ERROR_PLAYER_SYNC = 55,
+ ACK_ERROR_EXIST = 56,
+};
+
+extern const Domain ack_domain;
+
+#endif
diff --git a/src/protocol/argparser.c b/src/protocol/ArgParser.cxx
index d20437cb7..6bd53a358 100644
--- a/src/protocol/argparser.c
+++ b/src/protocol/ArgParser.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2012 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,14 +18,14 @@
*/
#include "config.h"
-#include "argparser.h"
-#include "result.h"
+#include "ArgParser.hxx"
+#include "Result.hxx"
#include <glib.h>
#include <stdlib.h>
bool
-check_uint32(struct client *client, uint32_t *dst, const char *s)
+check_uint32(Client *client, uint32_t *dst, const char *s)
{
char *test;
@@ -39,7 +39,7 @@ check_uint32(struct client *client, uint32_t *dst, const char *s)
}
bool
-check_int(struct client *client, int *value_r, const char *s)
+check_int(Client *client, int *value_r, const char *s)
{
char *test;
long value;
@@ -64,7 +64,7 @@ check_int(struct client *client, int *value_r, const char *s)
}
bool
-check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
+check_range(Client *client, unsigned *value_r1, unsigned *value_r2,
const char *s)
{
char *test, *test2;
@@ -134,7 +134,7 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
}
bool
-check_unsigned(struct client *client, unsigned *value_r, const char *s)
+check_unsigned(Client *client, unsigned *value_r, const char *s)
{
unsigned long value;
char *endptr;
@@ -157,7 +157,7 @@ check_unsigned(struct client *client, unsigned *value_r, const char *s)
}
bool
-check_bool(struct client *client, bool *value_r, const char *s)
+check_bool(Client *client, bool *value_r, const char *s)
{
long value;
char *endptr;
@@ -174,7 +174,7 @@ check_bool(struct client *client, bool *value_r, const char *s)
}
bool
-check_float(struct client *client, float *value_r, const char *s)
+check_float(Client *client, float *value_r, const char *s)
{
float value;
char *endptr;
diff --git a/src/protocol/argparser.h b/src/protocol/ArgParser.hxx
index e88aea478..f69248d2d 100644
--- a/src/protocol/argparser.h
+++ b/src/protocol/ArgParser.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2012 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,33 +17,32 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_PROTOCOL_ARGPARSER_H
-#define MPD_PROTOCOL_ARGPARSER_H
+#ifndef MPD_PROTOCOL_ARGPARSER_HXX
+#define MPD_PROTOCOL_ARGPARSER_HXX
#include "check.h"
-#include <stdbool.h>
#include <stdint.h>
-struct client;
+class Client;
bool
-check_uint32(struct client *client, uint32_t *dst, const char *s);
+check_uint32(Client *client, uint32_t *dst, const char *s);
bool
-check_int(struct client *client, int *value_r, const char *s);
+check_int(Client *client, int *value_r, const char *s);
bool
-check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
+check_range(Client *client, unsigned *value_r1, unsigned *value_r2,
const char *s);
bool
-check_unsigned(struct client *client, unsigned *value_r, const char *s);
+check_unsigned(Client *client, unsigned *value_r, const char *s);
bool
-check_bool(struct client *client, bool *value_r, const char *s);
+check_bool(Client *client, bool *value_r, const char *s);
bool
-check_float(struct client *client, float *value_r, const char *s);
+check_float(Client *client, float *value_r, const char *s);
#endif
diff --git a/src/protocol/result.c b/src/protocol/Result.cxx
index 30cd0a266..e10a731cc 100644
--- a/src/protocol/result.c
+++ b/src/protocol/Result.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2012 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,8 @@
*/
#include "config.h"
-#include "result.h"
-#include "client.h"
+#include "Result.hxx"
+#include "Client.hxx"
#include <assert.h>
@@ -27,13 +27,13 @@ const char *current_command;
int command_list_num;
void
-command_success(struct client *client)
+command_success(Client *client)
{
client_puts(client, "OK\n");
}
void
-command_error_v(struct client *client, enum ack error,
+command_error_v(Client *client, enum ack error,
const char *fmt, va_list args)
{
assert(client != NULL);
@@ -48,7 +48,7 @@ command_error_v(struct client *client, enum ack error,
}
void
-command_error(struct client *client, enum ack error, const char *fmt, ...)
+command_error(Client *client, enum ack error, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
diff --git a/src/protocol/result.h b/src/protocol/Result.hxx
index 8b9e44bfd..0f953c62b 100644
--- a/src/protocol/result.h
+++ b/src/protocol/Result.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2012 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,28 +17,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_PROTOCOL_RESULT_H
-#define MPD_PROTOCOL_RESULT_H
+#ifndef MPD_PROTOCOL_RESULT_HXX
+#define MPD_PROTOCOL_RESULT_HXX
#include "check.h"
-#include "ack.h"
+#include "gcc.h"
+#include "Ack.hxx"
-#include <glib.h>
+#include <stdarg.h>
-struct client;
+class Client;
extern const char *current_command;
extern int command_list_num;
void
-command_success(struct client *client);
+command_success(Client *client);
void
-command_error_v(struct client *client, enum ack error,
+command_error_v(Client *client, enum ack error,
const char *fmt, va_list args);
-G_GNUC_PRINTF(3, 4)
+gcc_fprintf_
void
-command_error(struct client *client, enum ack error, const char *fmt, ...);
+command_error(Client *client, enum ack error, const char *fmt, ...);
#endif