wocky-xmpp-error

wocky-xmpp-error

Synopsis

enum                WockyXmppErrorType;
enum                WockyXmppError;
GQuark              wocky_xmpp_error_quark              (void);
#define             WOCKY_XMPP_ERROR
                    WockyXmppErrorSpecialization;
                    WockyXmppErrorDomain;
void                wocky_xmpp_error_register_domain    (WockyXmppErrorDomain *domain);
enum                WockyJingleError;
GQuark              wocky_jingle_error_quark            (void);
#define             WOCKY_JINGLE_ERROR
enum                WockySIError;
GQuark              wocky_si_error_quark                (void);
#define             WOCKY_SI_ERROR
enum                WockyXmppStreamError;
GQuark              wocky_xmpp_stream_error_quark       (void);
#define             WOCKY_XMPP_STREAM_ERROR
const gchar *       wocky_xmpp_error_string             (WockyXmppError error);
const gchar *       wocky_xmpp_error_description        (WockyXmppError error);
GError *            wocky_xmpp_stream_error_from_node   (WockyNode *node);
WockyNode *         wocky_stanza_error_to_node          (const GError *error,
                                                         WockyNode *parent_node);
void                wocky_xmpp_error_extract            (WockyNode *error,
                                                         WockyXmppErrorType *type,
                                                         GError **core,
                                                         GError **specialized,
                                                         WockyNode **specialized_node);
void                wocky_xmpp_error_init               (void);
void                wocky_xmpp_error_deinit             (void);

Description

Details

enum WockyXmppErrorType

typedef enum {
    WOCKY_XMPP_ERROR_TYPE_CANCEL,
    WOCKY_XMPP_ERROR_TYPE_CONTINUE,
    WOCKY_XMPP_ERROR_TYPE_MODIFY,
    WOCKY_XMPP_ERROR_TYPE_AUTH,
    WOCKY_XMPP_ERROR_TYPE_WAIT
} WockyXmppErrorType;


enum WockyXmppError

typedef enum {
    WOCKY_XMPP_ERROR_UNDEFINED_CONDITION = 0, /* 500 */

    WOCKY_XMPP_ERROR_REDIRECT,                /* 302 */
    WOCKY_XMPP_ERROR_GONE,                    /* 302 */

    WOCKY_XMPP_ERROR_BAD_REQUEST,             /* 400 */
    WOCKY_XMPP_ERROR_UNEXPECTED_REQUEST,      /* 400 */
    WOCKY_XMPP_ERROR_JID_MALFORMED,           /* 400 */

    WOCKY_XMPP_ERROR_NOT_AUTHORIZED,          /* 401 */

    WOCKY_XMPP_ERROR_PAYMENT_REQUIRED,        /* 402 */

    WOCKY_XMPP_ERROR_FORBIDDEN,               /* 403 */

    WOCKY_XMPP_ERROR_ITEM_NOT_FOUND,          /* 404 */
    WOCKY_XMPP_ERROR_RECIPIENT_UNAVAILABLE,   /* 404 */
    WOCKY_XMPP_ERROR_REMOTE_SERVER_NOT_FOUND, /* 404 */

    WOCKY_XMPP_ERROR_NOT_ALLOWED,             /* 405 */

    WOCKY_XMPP_ERROR_NOT_ACCEPTABLE,          /* 406 */

    WOCKY_XMPP_ERROR_REGISTRATION_REQUIRED,   /* 407 */
    WOCKY_XMPP_ERROR_SUBSCRIPTION_REQUIRED,   /* 407 */

    WOCKY_XMPP_ERROR_REMOTE_SERVER_TIMEOUT,   /* 408, 504 */

    WOCKY_XMPP_ERROR_CONFLICT,                /* 409 */

    WOCKY_XMPP_ERROR_INTERNAL_SERVER_ERROR,   /* 500 */
    WOCKY_XMPP_ERROR_RESOURCE_CONSTRAINT,     /* 500 */

    WOCKY_XMPP_ERROR_FEATURE_NOT_IMPLEMENTED, /* 501 */

    WOCKY_XMPP_ERROR_SERVICE_UNAVAILABLE,     /* 502, 503, 510 */

    NUM_WOCKY_XMPP_ERRORS /*< skip >*/ /* don't want this in the GEnum */
} WockyXmppError;


wocky_xmpp_error_quark ()

GQuark              wocky_xmpp_error_quark              (void);

Returns :


WOCKY_XMPP_ERROR

#define WOCKY_XMPP_ERROR (wocky_xmpp_error_quark ())


WockyXmppErrorSpecialization

typedef struct {
    const gchar *description;
    WockyXmppError specializes;
    gboolean override_type;
    WockyXmppErrorType type;
} WockyXmppErrorSpecialization;


WockyXmppErrorDomain

typedef struct {
    GQuark domain;
    GType enum_type;
    WockyXmppErrorSpecialization *codes;
} WockyXmppErrorDomain;


wocky_xmpp_error_register_domain ()

void                wocky_xmpp_error_register_domain    (WockyXmppErrorDomain *domain);

Registers a new set of application-specific stanza errors. This allows GErrors in that domain to be passed to wocky_stanza_error_to_node(), and to be recognized and returned by wocky_xmpp_error_extract() (and wocky_stanza_extract_errors(), by extension).

domain :

a description of the error domain

enum WockyJingleError

typedef enum {
    WOCKY_JINGLE_ERROR_OUT_OF_ORDER,
    WOCKY_JINGLE_ERROR_TIE_BREAK,
    WOCKY_JINGLE_ERROR_UNKNOWN_SESSION,
    WOCKY_JINGLE_ERROR_UNSUPPORTED_INFO
} WockyJingleError;


wocky_jingle_error_quark ()

GQuark              wocky_jingle_error_quark            (void);

Returns :


WOCKY_JINGLE_ERROR

#define WOCKY_JINGLE_ERROR (wocky_jingle_error_quark ())


enum WockySIError

typedef enum {
    WOCKY_SI_ERROR_NO_VALID_STREAMS,
    WOCKY_SI_ERROR_BAD_PROFILE
} WockySIError;


wocky_si_error_quark ()

GQuark              wocky_si_error_quark                (void);

Returns :


WOCKY_SI_ERROR

#define WOCKY_SI_ERROR (wocky_si_error_quark ())


enum WockyXmppStreamError

typedef enum {
  WOCKY_XMPP_STREAM_ERROR_BAD_FORMAT,
  WOCKY_XMPP_STREAM_ERROR_BAD_NAMESPACE_PREFIX,
  WOCKY_XMPP_STREAM_ERROR_CONFLICT,
  WOCKY_XMPP_STREAM_ERROR_CONNECTION_TIMEOUT,
  WOCKY_XMPP_STREAM_ERROR_HOST_GONE,
  WOCKY_XMPP_STREAM_ERROR_HOST_UNKNOWN,
  WOCKY_XMPP_STREAM_ERROR_IMPROPER_ADDRESSING,
  WOCKY_XMPP_STREAM_ERROR_INTERNAL_SERVER_ERROR,
  WOCKY_XMPP_STREAM_ERROR_INVALID_FROM,
  WOCKY_XMPP_STREAM_ERROR_INVALID_ID,
  WOCKY_XMPP_STREAM_ERROR_INVALID_NAMESPACE,
  WOCKY_XMPP_STREAM_ERROR_INVALID_XML,
  WOCKY_XMPP_STREAM_ERROR_NOT_AUTHORIZED,
  WOCKY_XMPP_STREAM_ERROR_POLICY_VIOLATION,
  WOCKY_XMPP_STREAM_ERROR_REMOTE_CONNECTION_FAILED,
  WOCKY_XMPP_STREAM_ERROR_RESOURCE_CONSTRAINT,
  WOCKY_XMPP_STREAM_ERROR_RESTRICTED_XML,
  WOCKY_XMPP_STREAM_ERROR_SEE_OTHER_HOST,
  WOCKY_XMPP_STREAM_ERROR_SYSTEM_SHUTDOWN,
  WOCKY_XMPP_STREAM_ERROR_UNDEFINED_CONDITION,
  WOCKY_XMPP_STREAM_ERROR_UNSUPPORTED_ENCODING,
  WOCKY_XMPP_STREAM_ERROR_UNSUPPORTED_STANZA_TYPE,
  WOCKY_XMPP_STREAM_ERROR_UNSUPPORTED_VERSION,
  WOCKY_XMPP_STREAM_ERROR_XML_NOT_WELL_FORMED,
  WOCKY_XMPP_STREAM_ERROR_UNKNOWN,
} WockyXmppStreamError;

Possible XMPP stream errors, as defined by RFC 3920 §4.7.


wocky_xmpp_stream_error_quark ()

GQuark              wocky_xmpp_stream_error_quark       (void);

Get the error quark used for stream errors

Returns :

the quark for stream errors.

WOCKY_XMPP_STREAM_ERROR

#define WOCKY_XMPP_STREAM_ERROR (wocky_xmpp_stream_error_quark ())

Get access to the error quark of the xmpp stream errors.


wocky_xmpp_error_string ()

const gchar *       wocky_xmpp_error_string             (WockyXmppError error);

error :

a core stanza error

Returns :

the name of the tag corresponding to error

wocky_xmpp_error_description ()

const gchar *       wocky_xmpp_error_description        (WockyXmppError error);

error :

a core stanza error

Returns :

a description of the error, in English, as specified in XMPP Core

wocky_xmpp_stream_error_from_node ()

GError *            wocky_xmpp_stream_error_from_node   (WockyNode *node);

node :

Returns :

a GError in the WOCKY_XMPP_STREAM_ERROR domain.

wocky_stanza_error_to_node ()

WockyNode *         wocky_stanza_error_to_node          (const GError *error,
                                                         WockyNode *parent_node);

error :

parent_node :

Returns :


wocky_xmpp_error_extract ()

void                wocky_xmpp_error_extract            (WockyNode *error,
                                                         WockyXmppErrorType *type,
                                                         GError **core,
                                                         GError **specialized,
                                                         WockyNode **specialized_node);

Given an <error/> node, breaks it down into values describing the error. type and core are guaranteed to be set; specialized and specialized_node will be set if a recognised application-specific error is found, and the latter will be set to NULL if no application-specific error is found.

Any or all of the out parameters may be NULL to ignore the value. The value stored in specialized_node is borrowed from stanza, and is only valid as long as the latter is alive.

error :

the <error/> child of a stanza with type='error'

type :

location at which to store the error type

core :

location at which to store an error in the domain WOCKY_XMPP_ERROR

specialized :

location at which to store an error in an application-specific domain, if one is found

specialized_node :

location at which to store the node representing an application-specific error, if one is found

wocky_xmpp_error_init ()

void                wocky_xmpp_error_init               (void);


wocky_xmpp_error_deinit ()

void                wocky_xmpp_error_deinit             (void);