WockyXmppWriter

WockyXmppWriter — Xmpp stanza to XML serializer

Synopsis

                    WockyXmppWriter;
                    WockyXmppWriterClass;
                    WockyXmppWriterPrivate;
WockyXmppWriter *   wocky_xmpp_writer_new               (void);
WockyXmppWriter *   wocky_xmpp_writer_new_no_stream     (void);
void                wocky_xmpp_writer_stream_open       (WockyXmppWriter *writer,
                                                         const gchar *to,
                                                         const gchar *from,
                                                         const gchar *version,
                                                         const gchar *lang,
                                                         const gchar *id,
                                                         const guint8 **data,
                                                         gsize *length);
void                wocky_xmpp_writer_stream_close      (WockyXmppWriter *writer,
                                                         const guint8 **data,
                                                         gsize *length);
void                wocky_xmpp_writer_write_stanza      (WockyXmppWriter *writer,
                                                         WockyStanza *stanza,
                                                         const guint8 **data,
                                                         gsize *length);
void                wocky_xmpp_writer_write_node_tree   (WockyXmppWriter *writer,
                                                         WockyNodeTree *tree,
                                                         const guint8 **data,
                                                         gsize *length);
void                wocky_xmpp_writer_flush             (WockyXmppWriter *writer);

Object Hierarchy

  GObject
   +----WockyXmppWriter

Properties

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

Description

The WockyXmppWriter serializes WockyStanzas and xmpp stream opening and closing to raw XML. The various functions provide a pointer to an internal buffer, which remains valid until the next call to the writer.

Details

WockyXmppWriter

typedef struct _WockyXmppWriter WockyXmppWriter;


WockyXmppWriterClass

typedef struct {
    GObjectClass parent_class;
} WockyXmppWriterClass;


WockyXmppWriterPrivate

typedef struct _WockyXmppWriterPrivate WockyXmppWriterPrivate;


wocky_xmpp_writer_new ()

WockyXmppWriter *   wocky_xmpp_writer_new               (void);

Convenience function to create a new WockyXmppWriter.

Returns :

a new WockyXmppWriter

wocky_xmpp_writer_new_no_stream ()

WockyXmppWriter *   wocky_xmpp_writer_new_no_stream     (void);

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

Returns :

a new WockyXmppWriter in non-streaming mode

wocky_xmpp_writer_stream_open ()

void                wocky_xmpp_writer_stream_open       (WockyXmppWriter *writer,
                                                         const gchar *to,
                                                         const gchar *from,
                                                         const gchar *version,
                                                         const gchar *lang,
                                                         const gchar *id,
                                                         const guint8 **data,
                                                         gsize *length);

Create the XML opening header of an XMPP stream. The result is available in the data buffer. The buffer is only valid until the next call to a function the writer.

This function can only be called in streaming mode.

writer :

a WockyXmppWriter

to :

the target of the stream opening (usually the xmpp server name)

from :

the sender of the stream opening (usually the jid of the client)

version :

XMPP version

lang :

default XMPP stream language

id :

XMPP Stream ID, if any, or NULL

data :

location to store a pointer to the data buffer

length :

length of the data buffer

wocky_xmpp_writer_stream_close ()

void                wocky_xmpp_writer_stream_close      (WockyXmppWriter *writer,
                                                         const guint8 **data,
                                                         gsize *length);

Create the XML closing footer of an XMPP stream . The result is available in the data buffer. The buffer is only valid until the next call to a function

This function can only be called in streaming mode.

writer :

a WockyXmppWriter

data :

location to store a pointer to the data buffer

length :

length of the data buffer

wocky_xmpp_writer_write_stanza ()

void                wocky_xmpp_writer_write_stanza      (WockyXmppWriter *writer,
                                                         WockyStanza *stanza,
                                                         const guint8 **data,
                                                         gsize *length);

Serialize the stanza to XML. The result is available in the data buffer. The buffer is only valid until the next call to a function

writer :

a WockyXmppWriter

stanza :

the stanza to serialize

data :

location to store a pointer to the data buffer

length :

length of the data buffer

wocky_xmpp_writer_write_node_tree ()

void                wocky_xmpp_writer_write_node_tree   (WockyXmppWriter *writer,
                                                         WockyNodeTree *tree,
                                                         const guint8 **data,
                                                         gsize *length);

Serialize the tree to XML. The result is available in the data buffer. The buffer is only valid until the next call to a function. This function may only be called in non-streaming mode.

writer :

a WockyXmppWriter

tree :

the node tree to serialize

data :

location to store a pointer to the data buffer

length :

length of the data buffer

wocky_xmpp_writer_flush ()

void                wocky_xmpp_writer_flush             (WockyXmppWriter *writer);

Flushes and frees the internal data buffer

writer :

a WockyXmppWriter

Property Details

The "streaming-mode" property

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

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

Default value: TRUE