Strophe 0.12
XMPP client library
|
These functions create and manipulate Strophe context objects. More...
Functions | |
xmpp_log_t * | xmpp_get_default_logger (xmpp_log_level_t level) |
Get a default logger with filtering. More... | |
xmpp_ctx_t * | xmpp_ctx_new (const xmpp_mem_t *mem, const xmpp_log_t *log) |
Create and initialize a Strophe context object. More... | |
void | xmpp_ctx_free (xmpp_ctx_t *ctx) |
Free a Strophe context object that is no longer in use. More... | |
void | xmpp_ctx_set_verbosity (xmpp_ctx_t *ctx, int level) |
Set the verbosity level of a Strophe context. More... | |
These functions create and manipulate Strophe context objects.
In order to support usage in a variety of environments, the Strophe library uses a runtime context object. This object contains the information on how to do memory allocation and logging. This allows the user to control how memory is allocated and what do to with log messages.
These issues do not affect programs in the common case, but many environments require special treatment. Abstracting these into a runtime context object makes it easy to use Strophe on embedded platforms.
Objects in Strophe are reference counted to ease memory management issues, but the context objects are not.
xmpp_log_t * xmpp_get_default_logger | ( | xmpp_log_level_t | level | ) |
Get a default logger with filtering.
The default logger provides a basic logging setup which writes log messages to stderr. Only messages where level is greater than or equal to the filter level will be logged.
level | the highest level the logger will log at |
xmpp_ctx_t * xmpp_ctx_new | ( | const xmpp_mem_t * | mem, |
const xmpp_log_t * | log | ||
) |
Create and initialize a Strophe context object.
If mem is NULL, a default allocation setup will be used which wraps malloc(), free(), and realloc() from the standard library. If log is NULL, a default logger will be used which does no logging. Basic filtered logging to stderr can be done with the xmpp_get_default_logger() convenience function.
mem | a pointer to an xmpp_mem_t structure or NULL |
log | a pointer to an xmpp_log_t structure or NULL |
void xmpp_ctx_free | ( | xmpp_ctx_t * | ctx | ) |
Free a Strophe context object that is no longer in use.
ctx | a Strophe context object |
void xmpp_ctx_set_verbosity | ( | xmpp_ctx_t * | ctx, |
int | level | ||
) |
Set the verbosity level of a Strophe context.
ctx | a Strophe context object |
level | the verbosity level |