errors.h 2.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/* Icecast
 *
 * This program is distributed under the GNU General Public License, version 2.
 * A copy of this license is included with this source.
 *
 * Copyright 2018,      Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
 */

#ifndef __ERRORS_H__
#define __ERRORS_H__

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
typedef enum {
    ICECAST_ERROR_ADMIN_DEST_NOT_RUNNING,
    ICECAST_ERROR_ADMIN_METADAT_BADCALL,
    ICECAST_ERROR_ADMIN_METADAT_NO_SUCH_ACTION,
    ICECAST_ERROR_ADMIN_MISSING_PARAMETER,
    ICECAST_ERROR_ADMIN_missing_parameter,                      /* what is this? */
    ICECAST_ERROR_ADMIN_MOUNT_NOT_ACCEPT_URL_UPDATES,
    ICECAST_ERROR_ADMIN_NO_SUCH_DESTINATION,
    ICECAST_ERROR_ADMIN_ROLEMGN_ADD_NOSYS,
    ICECAST_ERROR_ADMIN_ROLEMGN_DELETE_NOSYS,
    ICECAST_ERROR_ADMIN_ROLEMGN_ROLE_NOT_FOUND,
    ICECAST_ERROR_ADMIN_SOURCE_DOES_NOT_EXIST,
    ICECAST_ERROR_ADMIN_SOURCE_IS_NOT_AVAILABLE,
    ICECAST_ERROR_ADMIN_SUPPLIED_MOUNTPOINTS_ARE_IDENTICAL,
    ICECAST_ERROR_ADMIN_UNRECOGNISED_COMMAND,
    ICECAST_ERROR_AUTH_BUSY,
    ICECAST_ERROR_CON_CONTENT_TYPE_NOSYS,
    ICECAST_ERROR_CON_INTERNAL_FORMAT_ALLOC_ERROR,
    ICECAST_ERROR_CON_MISSING_PASS_PARAMETER,
    ICECAST_ERROR_CON_MOUNT_IN_USE,
    ICECAST_ERROR_CON_MOUNTPOINT_NOT_STARTING_WITH_SLASH,
    ICECAST_ERROR_CON_NO_CONTENT_TYPE_GIVEN,
    ICECAST_ERROR_CON_PER_CRED_CLIENT_LIMIT,
    ICECAST_ERROR_CON_rejecting_client_for_whatever_reason,     /* ??? */
    ICECAST_ERROR_CON_SOURCE_CLIENT_LIMIT,
    ICECAST_ERROR_CON_UNIMPLEMENTED,
    ICECAST_ERROR_CON_UNKNOWN_REQUEST,
    ICECAST_ERROR_CON_UPGRADE_ERROR,
    ICECAST_ERROR_FSERV_FILE_NOT_FOUND,
    ICECAST_ERROR_FSERV_FILE_NOT_READABLE,
    ICECAST_ERROR_FSERV_REQUEST_RANGE_NOT_SATISFIABLE,
    ICECAST_ERROR_GEN_BUFFER_REALLOC,
    ICECAST_ERROR_GEN_CLIENT_LIMIT,
    ICECAST_ERROR_GEN_CLIENT_NEEDS_TO_AUTHENTICATE,
    ICECAST_ERROR_GEN_HEADER_GEN_FAILED,
    ICECAST_ERROR_GEN_MEMORY_EXHAUSTED,
    ICECAST_ERROR_SOURCE_MOUNT_UNAVAILABLE,
    ICECAST_ERROR_SOURCE_STREAM_PREPARATION_ERROR,
    ICECAST_ERROR_XSLT_PARSE,
51 52
    ICECAST_ERROR_XSLT_problem,
    ICECAST_ERROR_RECURSIVE_ERROR
53
} icecast_error_id_t;
54 55

struct icecast_error_tag {
56
    const icecast_error_id_t id;
57
    const int http_status;
58
    const char *uuid;
59 60 61 62 63
    const char *message;
};

typedef struct icecast_error_tag icecast_error_t;

64
const icecast_error_t * error_get_by_id(icecast_error_id_t id);
65
const icecast_error_t * error_get_by_uuid(const char *uuid);
66 67

#endif  /* __ERRORS_H__ */