summaryrefslogtreecommitdiff
path: root/src/error.h
blob: 58c303d80eef230407fea9e63626c235b9614b11 (plain)
1
2
3
4
5
6
7
8
9
10
11
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * gabble-error.h - Header for Gabble's error handling API
 * Copyright (C) 2006-2007 Collabora Ltd.
 * Copyright (C) 2006 Nokia Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __GABBLE_ERROR_H__
#define __GABBLE_ERROR_H__

#include <gabble/gabble.h>

#include <glib.h>
#include <loudmouth/loudmouth.h>

typedef enum {
    XMPP_ERROR_TYPE_UNDEFINED = 0,
    XMPP_ERROR_TYPE_CANCEL,
    XMPP_ERROR_TYPE_CONTINUE,
    XMPP_ERROR_TYPE_MODIFY,
    XMPP_ERROR_TYPE_AUTH,
    XMPP_ERROR_TYPE_WAIT,
} GabbleXmppErrorType;

typedef enum {
    XMPP_ERROR_UNDEFINED_CONDITION = 0, /* 500 */
    XMPP_ERROR_REDIRECT,                /* 302 */
    XMPP_ERROR_GONE,                    /* 302 */

    XMPP_ERROR_BAD_REQUEST,             /* 400 */
    XMPP_ERROR_UNEXPECTED_REQUEST,      /* 400 */
    XMPP_ERROR_JID_MALFORMED,           /* 400 */

    XMPP_ERROR_NOT_AUTHORIZED,          /* 401 */

    XMPP_ERROR_PAYMENT_REQUIRED,        /* 402 */

    XMPP_ERROR_FORBIDDEN,               /* 403 */

    XMPP_ERROR_ITEM_NOT_FOUND,          /* 404 */
    XMPP_ERROR_RECIPIENT_UNAVAILABLE,   /* 404 */
    XMPP_ERROR_REMOTE_SERVER_NOT_FOUND, /* 404 */

    XMPP_ERROR_NOT_ALLOWED,             /* 405 */

    XMPP_ERROR_NOT_ACCEPTABLE,          /* 406 */

    XMPP_ERROR_REGISTRATION_REQUIRED,   /* 407 */
    XMPP_ERROR_SUBSCRIPTION_REQUIRED,   /* 407 */

    XMPP_ERROR_REMOTE_SERVER_TIMEOUT,   /* 408, 504 */

    XMPP_ERROR_CONFLICT,                /* 409 */

    XMPP_ERROR_INTERNAL_SERVER_ERROR,   /* 500 */
    XMPP_ERROR_RESOURCE_CONSTRAINT,     /* 500 */

    XMPP_ERROR_FEATURE_NOT_IMPLEMENTED, /* 501 */

    XMPP_ERROR_SERVICE_UNAVAILABLE,     /* 502, 503, 510 */

    XMPP_ERROR_JINGLE_OUT_OF_ORDER,
    XMPP_ERROR_JINGLE_UNKNOWN_SESSION,
    XMPP_ERROR_JINGLE_TIE_BREAK,
    XMPP_ERROR_JINGLE_UNSUPPORTED_INFO,

    XMPP_ERROR_SI_NO_VALID_STREAMS,
    XMPP_ERROR_SI_BAD_PROFILE,

    NUM_XMPP_ERRORS,
} GabbleXmppError;

GQuark gabble_xmpp_error_quark (void);
#define GABBLE_XMPP_ERROR (gabble_xmpp_error_quark ())

GabbleXmppError gabble_xmpp_error_from_node (LmMessageNode *error_node,
    GabbleXmppErrorType *type_out);
LmMessageNode *gabble_xmpp_error_to_node (GabbleXmppError error,
    LmMessageNode *parent_node, const gchar *errmsg);
const gchar *gabble_xmpp_error_string (GabbleXmppError error);
const gchar *gabble_xmpp_error_description (GabbleXmppError error);
GError *gabble_message_get_xmpp_error (LmMessage *msg);

GabbleXmppErrorType gabble_xmpp_error_type_to_enum (const gchar *error_type);

#endif /* __GABBLE_ERROR_H__ */