mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Update: Made error IDs an enum.
Thanks to ePirat for the suggestion.
This commit is contained in:
parent
a612d0c4a1
commit
097e62394f
@ -266,7 +266,7 @@ static inline void _client_send_error(client_t *client, int plain, const icecast
|
|||||||
fserve_add_client (client, NULL);
|
fserve_add_client (client, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_send_error_by_id(client_t *client, int id)
|
void client_send_error_by_id(client_t *client, icecast_error_id_t id)
|
||||||
{
|
{
|
||||||
const icecast_error_t *error = error_get_by_id(id);
|
const icecast_error_t *error = error_get_by_id(id);
|
||||||
const char *pref;
|
const char *pref;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#ifndef __CLIENT_H__
|
#ifndef __CLIENT_H__
|
||||||
#define __CLIENT_H__
|
#define __CLIENT_H__
|
||||||
|
|
||||||
|
#include "errors.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "refbuf.h"
|
#include "refbuf.h"
|
||||||
#include "acl.h"
|
#include "acl.h"
|
||||||
@ -109,7 +110,7 @@ typedef struct _client_tag
|
|||||||
|
|
||||||
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
|
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
|
||||||
void client_destroy(client_t *client);
|
void client_destroy(client_t *client);
|
||||||
void client_send_error_by_id(client_t *client, int id);
|
void client_send_error_by_id(client_t *client, icecast_error_id_t id);
|
||||||
void client_send_101(client_t *client, reuse_t reuse);
|
void client_send_101(client_t *client, reuse_t reuse);
|
||||||
void client_send_426(client_t *client, reuse_t reuse);
|
void client_send_426(client_t *client, reuse_t reuse);
|
||||||
int client_send_bytes (client_t *client, const void *buf, unsigned len);
|
int client_send_bytes (client_t *client, const void *buf, unsigned len);
|
||||||
|
@ -135,7 +135,7 @@ static const icecast_error_t __errors[] = {
|
|||||||
.message = "XSLT problem"}
|
.message = "XSLT problem"}
|
||||||
};
|
};
|
||||||
|
|
||||||
const icecast_error_t * error_get_by_id(int id) {
|
const icecast_error_t * error_get_by_id(icecast_error_id_t id) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < (sizeof(__errors)/sizeof(*__errors)); i++) {
|
for (i = 0; i < (sizeof(__errors)/sizeof(*__errors)); i++) {
|
||||||
|
84
src/errors.h
84
src/errors.h
@ -9,48 +9,50 @@
|
|||||||
#ifndef __ERRORS_H__
|
#ifndef __ERRORS_H__
|
||||||
#define __ERRORS_H__
|
#define __ERRORS_H__
|
||||||
|
|
||||||
#define ICECAST_ERROR_ADMIN_DEST_NOT_RUNNING 1
|
typedef enum {
|
||||||
#define ICECAST_ERROR_ADMIN_METADAT_BADCALL 2
|
ICECAST_ERROR_ADMIN_DEST_NOT_RUNNING,
|
||||||
#define ICECAST_ERROR_ADMIN_METADAT_NO_SUCH_ACTION 3
|
ICECAST_ERROR_ADMIN_METADAT_BADCALL,
|
||||||
#define ICECAST_ERROR_ADMIN_MISSING_PARAMETER 4
|
ICECAST_ERROR_ADMIN_METADAT_NO_SUCH_ACTION,
|
||||||
#define ICECAST_ERROR_ADMIN_missing_parameter 5 /* what is this? */
|
ICECAST_ERROR_ADMIN_MISSING_PARAMETER,
|
||||||
#define ICECAST_ERROR_ADMIN_MOUNT_NOT_ACCEPT_URL_UPDATES 6
|
ICECAST_ERROR_ADMIN_missing_parameter, /* what is this? */
|
||||||
#define ICECAST_ERROR_ADMIN_NO_SUCH_DESTINATION 7
|
ICECAST_ERROR_ADMIN_MOUNT_NOT_ACCEPT_URL_UPDATES,
|
||||||
#define ICECAST_ERROR_ADMIN_ROLEMGN_ADD_NOSYS 8
|
ICECAST_ERROR_ADMIN_NO_SUCH_DESTINATION,
|
||||||
#define ICECAST_ERROR_ADMIN_ROLEMGN_DELETE_NOSYS 9
|
ICECAST_ERROR_ADMIN_ROLEMGN_ADD_NOSYS,
|
||||||
#define ICECAST_ERROR_ADMIN_ROLEMGN_ROLE_NOT_FOUND 10
|
ICECAST_ERROR_ADMIN_ROLEMGN_DELETE_NOSYS,
|
||||||
#define ICECAST_ERROR_ADMIN_SOURCE_DOES_NOT_EXIST 11
|
ICECAST_ERROR_ADMIN_ROLEMGN_ROLE_NOT_FOUND,
|
||||||
#define ICECAST_ERROR_ADMIN_SOURCE_IS_NOT_AVAILABLE 12
|
ICECAST_ERROR_ADMIN_SOURCE_DOES_NOT_EXIST,
|
||||||
#define ICECAST_ERROR_ADMIN_SUPPLIED_MOUNTPOINTS_ARE_IDENTICAL 13
|
ICECAST_ERROR_ADMIN_SOURCE_IS_NOT_AVAILABLE,
|
||||||
#define ICECAST_ERROR_ADMIN_UNRECOGNISED_COMMAND 14
|
ICECAST_ERROR_ADMIN_SUPPLIED_MOUNTPOINTS_ARE_IDENTICAL,
|
||||||
#define ICECAST_ERROR_AUTH_BUSY 15
|
ICECAST_ERROR_ADMIN_UNRECOGNISED_COMMAND,
|
||||||
#define ICECAST_ERROR_CON_CONTENT_TYPE_NOSYS 16
|
ICECAST_ERROR_AUTH_BUSY,
|
||||||
#define ICECAST_ERROR_CON_INTERNAL_FORMAT_ALLOC_ERROR 17
|
ICECAST_ERROR_CON_CONTENT_TYPE_NOSYS,
|
||||||
#define ICECAST_ERROR_CON_MISSING_PASS_PARAMETER 18
|
ICECAST_ERROR_CON_INTERNAL_FORMAT_ALLOC_ERROR,
|
||||||
#define ICECAST_ERROR_CON_MOUNT_IN_USE 19
|
ICECAST_ERROR_CON_MISSING_PASS_PARAMETER,
|
||||||
#define ICECAST_ERROR_CON_MOUNTPOINT_NOT_STARTING_WITH_SLASH 20
|
ICECAST_ERROR_CON_MOUNT_IN_USE,
|
||||||
#define ICECAST_ERROR_CON_NO_CONTENT_TYPE_GIVEN 21
|
ICECAST_ERROR_CON_MOUNTPOINT_NOT_STARTING_WITH_SLASH,
|
||||||
#define ICECAST_ERROR_CON_PER_CRED_CLIENT_LIMIT 22
|
ICECAST_ERROR_CON_NO_CONTENT_TYPE_GIVEN,
|
||||||
#define ICECAST_ERROR_CON_rejecting_client_for_whatever_reason 23 /* ??? */
|
ICECAST_ERROR_CON_PER_CRED_CLIENT_LIMIT,
|
||||||
#define ICECAST_ERROR_CON_SOURCE_CLIENT_LIMIT 24
|
ICECAST_ERROR_CON_rejecting_client_for_whatever_reason, /* ??? */
|
||||||
#define ICECAST_ERROR_CON_UNIMPLEMENTED 25
|
ICECAST_ERROR_CON_SOURCE_CLIENT_LIMIT,
|
||||||
#define ICECAST_ERROR_CON_UNKNOWN_REQUEST 26
|
ICECAST_ERROR_CON_UNIMPLEMENTED,
|
||||||
#define ICECAST_ERROR_CON_UPGRADE_ERROR 27
|
ICECAST_ERROR_CON_UNKNOWN_REQUEST,
|
||||||
#define ICECAST_ERROR_FSERV_FILE_NOT_FOUND 28
|
ICECAST_ERROR_CON_UPGRADE_ERROR,
|
||||||
#define ICECAST_ERROR_FSERV_FILE_NOT_READABLE 29
|
ICECAST_ERROR_FSERV_FILE_NOT_FOUND,
|
||||||
#define ICECAST_ERROR_FSERV_REQUEST_RANGE_NOT_SATISFIABLE 30
|
ICECAST_ERROR_FSERV_FILE_NOT_READABLE,
|
||||||
#define ICECAST_ERROR_GEN_BUFFER_REALLOC 31
|
ICECAST_ERROR_FSERV_REQUEST_RANGE_NOT_SATISFIABLE,
|
||||||
#define ICECAST_ERROR_GEN_CLIENT_LIMIT 32
|
ICECAST_ERROR_GEN_BUFFER_REALLOC,
|
||||||
#define ICECAST_ERROR_GEN_CLIENT_NEEDS_TO_AUTHENTICATE 33
|
ICECAST_ERROR_GEN_CLIENT_LIMIT,
|
||||||
#define ICECAST_ERROR_GEN_HEADER_GEN_FAILED 34
|
ICECAST_ERROR_GEN_CLIENT_NEEDS_TO_AUTHENTICATE,
|
||||||
#define ICECAST_ERROR_GEN_MEMORY_EXHAUSTED 35
|
ICECAST_ERROR_GEN_HEADER_GEN_FAILED,
|
||||||
#define ICECAST_ERROR_SOURCE_MOUNT_UNAVAILABLE 36
|
ICECAST_ERROR_GEN_MEMORY_EXHAUSTED,
|
||||||
#define ICECAST_ERROR_SOURCE_STREAM_PREPARATION_ERROR 37
|
ICECAST_ERROR_SOURCE_MOUNT_UNAVAILABLE,
|
||||||
#define ICECAST_ERROR_XSLT_PARSE 38
|
ICECAST_ERROR_SOURCE_STREAM_PREPARATION_ERROR,
|
||||||
#define ICECAST_ERROR_XSLT_problem 39
|
ICECAST_ERROR_XSLT_PARSE,
|
||||||
|
ICECAST_ERROR_XSLT_problem
|
||||||
|
} icecast_error_id_t;
|
||||||
|
|
||||||
struct icecast_error_tag {
|
struct icecast_error_tag {
|
||||||
const int id;
|
const icecast_error_id_t id;
|
||||||
const int http_status;
|
const int http_status;
|
||||||
const char *uuid;
|
const char *uuid;
|
||||||
const char *message;
|
const char *message;
|
||||||
@ -58,6 +60,6 @@ struct icecast_error_tag {
|
|||||||
|
|
||||||
typedef struct icecast_error_tag icecast_error_t;
|
typedef struct icecast_error_tag icecast_error_t;
|
||||||
|
|
||||||
const icecast_error_t * error_get_by_id(int id);
|
const icecast_error_t * error_get_by_id(icecast_error_id_t id);
|
||||||
|
|
||||||
#endif /* __ERRORS_H__ */
|
#endif /* __ERRORS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user