WockyXmppReader

WockyXmppReader — Xmpp XML to stanza deserializer

Synopsis

                    WockyXmppReader;
                    WockyXmppReaderClass;
                    WockyXmppReaderPrivate;
enum                WockyXmppReaderState;
enum                WockyXmppReaderError;
GQuark              wocky_xmpp_reader_error_quark       (void);
#define             WOCKY_XMPP_READER_ERROR
WockyXmppReader *   wocky_xmpp_reader_new               (void);
WockyXmppReader *   wocky_xmpp_reader_new_no_stream     (void);
WockyXmppReaderState  wocky_xmpp_reader_get_state       (WockyXmppReader *reader);
void                wocky_xmpp_reader_push              (WockyXmppReader *reader,
                                                         const guint8 *data,
                                                         gsize length);
WockyStanza *       wocky_xmpp_reader_pop_stanza        (WockyXmppReader *reader);
WockyStanza *       wocky_xmpp_reader_peek_stanza       (WockyXmppReader *reader);
GError *            wocky_xmpp_reader_get_error         (WockyXmppReader *reader);
void                wocky_xmpp_reader_reset             (WockyXmppReader *reader);

Object Hierarchy

  GObject
   +----WockyXmppReader

Properties

  "from"                     gchar*                : Read
  "id"                       gchar*                : Read
  "lang"                     gchar*                : Read
  "streaming-mode"           gboolean              : Read / Write / Construct Only
  "to"                       gchar*                : Read
  "version"                  gchar*                : Read

Description

The WockyXmppReader deserializes XML to WockyStanzas, misc, other

Details

WockyXmppReader

typedef struct _WockyXmppReader WockyXmppReader;


WockyXmppReaderClass

typedef struct {
    GObjectClass parent_class;
} WockyXmppReaderClass;


WockyXmppReaderPrivate

typedef struct _WockyXmppReaderPrivate WockyXmppReaderPrivate;


enum WockyXmppReaderState

typedef enum {
  WOCKY_XMPP_READER_STATE_INITIAL,
  WOCKY_XMPP_READER_STATE_OPENED,
  WOCKY_XMPP_READER_STATE_CLOSED,
  WOCKY_XMPP_READER_STATE_ERROR,
} WockyXmppReaderState;

The possible states a reader can be in.

WOCKY_XMPP_READER_STATE_INITIAL

initial state

WOCKY_XMPP_READER_STATE_OPENED

stream is open

WOCKY_XMPP_READER_STATE_CLOSED

stream has been closed

WOCKY_XMPP_READER_STATE_ERROR

stream reader hit an error

enum WockyXmppReaderError

typedef enum {
  WOCKY_XMPP_READER_ERROR_INVALID_STREAM_START,
  WOCKY_XMPP_READER_ERROR_PARSE_ERROR,
} WockyXmppReaderError;

The different errors that can occur while reading a stream

WOCKY_XMPP_READER_ERROR_INVALID_STREAM_START

invalid start of xmpp stream

WOCKY_XMPP_READER_ERROR_PARSE_ERROR

error in parsing the XML

wocky_xmpp_reader_error_quark ()

GQuark              wocky_xmpp_reader_error_quark       (void);

Get the error quark used by the reader.

Returns :

the quark for reader errors.

WOCKY_XMPP_READER_ERROR

#define WOCKY_XMPP_READER_ERROR (wocky_xmpp_reader_error_quark ())

Get access to the error quark of the reader.


wocky_xmpp_reader_new ()

WockyXmppReader *   wocky_xmpp_reader_new               (void);

Convenience function to create a new WockyXmppReader.

Returns :

a new WockyXmppReader

wocky_xmpp_reader_new_no_stream ()

WockyXmppReader *   wocky_xmpp_reader_new_no_stream     (void);

Convenience function to create a new WockyXmppReader that has streaming mode disabled.

Returns :

a new WockyXmppReader in non-streaming mode

wocky_xmpp_reader_get_state ()

WockyXmppReaderState  wocky_xmpp_reader_get_state       (WockyXmppReader *reader);

reader :

a WockyXmppReader

Returns :

The current state of the reader

wocky_xmpp_reader_push ()

void                wocky_xmpp_reader_push              (WockyXmppReader *reader,
                                                         const guint8 *data,
                                                         gsize length);

Push an amount of data to parse.

reader :

a WockyXmppReader

data :

Data to read

length :

Size of data

wocky_xmpp_reader_pop_stanza ()

WockyStanza *       wocky_xmpp_reader_pop_stanza        (WockyXmppReader *reader);

Gets one WockyStanza out of the reader or NULL if there are no available stanzas.

reader :

a WockyXmppReader

Returns :

One WockyStanza or NULL if there are no available stanzas. Caller owns the returned stanza.

wocky_xmpp_reader_peek_stanza ()

WockyStanza *       wocky_xmpp_reader_peek_stanza       (WockyXmppReader *reader);

Returns the first WockyStanza available from reader or NULL if there are no available stanzas. The stanza is not removed from the readers queue

reader :

a WockyXmppReader

Returns :

One WockyStanza or NULL if there are no available stanzas. The stanza is owned by the WockyXmppReader

wocky_xmpp_reader_get_error ()

GError *            wocky_xmpp_reader_get_error         (WockyXmppReader *reader);

Get the error from the reader

reader :

a WockyXmppReader

Returns :

A copy of the error as encountered by the reader or NULL if there was no error. Free after use.

wocky_xmpp_reader_reset ()

void                wocky_xmpp_reader_reset             (WockyXmppReader *reader);

Reset the xml parser.

reader :

a WockyXmppReader

Property Details

The "from" property

  "from"                     gchar*                : Read

from attribute in the xml stream opening.

Default value: NULL


The "id" property

  "id"                       gchar*                : Read

id attribute in the xml stream opening.

Default value: NULL


The "lang" property

  "lang"                     gchar*                : Read

xml:lang attribute in the xml stream opening.

Default value: NULL


The "streaming-mode" property

  "streaming-mode"           gboolean              : Read / Write / Construct Only

Whether the xml to be read is one big stream or separate documents.

Default value: TRUE


The "to" property

  "to"                       gchar*                : Read

to attribute in the xml stream opening.

Default value: NULL


The "version" property

  "version"                  gchar*                : Read

version attribute in the xml stream opening.

Default value: NULL