summaryrefslogtreecommitdiff
path: root/libwaitress/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2010-03-31 11:32:39 +0200
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2010-04-06 16:48:14 +0200
commitbf79a91a3f6381cade8a9e0fd50c2897bfb316c9 (patch)
treeee785b6ae183c18837c5f8357444b88c51001f92 /libwaitress/src
parent37cee3b9d6d3f5fd7a477791ebfdb1e85e8faf9d (diff)
downloadpianobar-windows-bf79a91a3f6381cade8a9e0fd50c2897bfb316c9.tar.gz
pianobar-windows-bf79a91a3f6381cade8a9e0fd50c2897bfb316c9.tar.bz2
pianobar-windows-bf79a91a3f6381cade8a9e0fd50c2897bfb316c9.zip
Use new libpiano api
Adds error messages to libwaitress, too. Eventcmd implementation is quick&dirty, needs to be rewritten.
Diffstat (limited to 'libwaitress/src')
-rw-r--r--libwaitress/src/waitress.c64
-rw-r--r--libwaitress/src/waitress.h1
2 files changed, 65 insertions, 0 deletions
diff --git a/libwaitress/src/waitress.c b/libwaitress/src/waitress.c
index 72f5f0f..b3ef618 100644
--- a/libwaitress/src/waitress.c
+++ b/libwaitress/src/waitress.c
@@ -488,3 +488,67 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
#undef WRITE_RET
#undef READ_RET
+const char *WaitressErrorToStr (WaitressReturn_t wRet) {
+ switch (wRet) {
+ case WAITRESS_RET_OK:
+ return "Everything's fine :)";
+ break;
+
+ case WAITRESS_RET_ERR:
+ return "Unknown.";
+ break;
+
+ case WAITRESS_RET_STATUS_UNKNOWN:
+ return "Unknown HTTP status code.";
+ break;
+
+ case WAITRESS_RET_NOTFOUND:
+ return "File not found.";
+ break;
+
+ case WAITRESS_RET_FORBIDDEN:
+ return "Forbidden.";
+ break;
+
+ case WAITRESS_RET_CONNECT_REFUSED:
+ return "Connection refused.";
+ break;
+
+ case WAITRESS_RET_SOCK_ERR:
+ return "Socket error.";
+ break;
+
+ case WAITRESS_RET_GETADDR_ERR:
+ return "getaddr failed.";
+ break;
+
+ case WAITRESS_RET_CB_ABORT:
+ return "Callback aborted request.";
+ break;
+
+ case WAITRESS_RET_HDR_OVERFLOW:
+ return "HTTP header overflow.";
+ break;
+
+ case WAITRESS_RET_PARTIAL_FILE:
+ return "Partial file.";
+ break;
+
+ case WAITRESS_RET_TIMEOUT:
+ return "Timeout.";
+ break;
+
+ case WAITRESS_RET_READ_ERR:
+ return "Read error.";
+ break;
+
+ case WAITRESS_RET_CONNECTION_CLOSED:
+ return "Connection closed by remote host.";
+ break;
+
+ default:
+ return "No error message available.";
+ break;
+ }
+}
+
diff --git a/libwaitress/src/waitress.h b/libwaitress/src/waitress.h
index ed5679f..04333fb 100644
--- a/libwaitress/src/waitress.h
+++ b/libwaitress/src/waitress.h
@@ -72,6 +72,7 @@ void WaitressSetHPP (WaitressHandle_t *, const char *, const char *,
const char *);
WaitressReturn_t WaitressFetchBuf (WaitressHandle_t *, char **);
WaitressReturn_t WaitressFetchCall (WaitressHandle_t *);
+const char *WaitressErrorToStr (WaitressReturn_t);
#endif /* _WAITRESS_H */