Strophe
0.10
XMPP client library
|
Data Structures | |
struct | xmpp_handlist_t |
handlers More... | |
struct | _xmpp_connlist_t |
struct | xmpp_ctx_t |
struct | xmpp_send_queue_t |
struct | xmpp_conn_t |
struct | xmpp_stanza_t |
Macros | |
#define | UNUSED(x) ((void)(x)) |
#define | MAX_DOMAIN_LEN 256 |
#define | SASL_MASK_PLAIN (1 << 0) |
#define | SASL_MASK_DIGESTMD5 (1 << 1) |
#define | SASL_MASK_ANONYMOUS (1 << 2) |
#define | SASL_MASK_SCRAMSHA1 (1 << 3) |
#define | SASL_MASK_SCRAMSHA256 (1 << 4) |
#define | SASL_MASK_SCRAMSHA512 (1 << 5) |
#define | SASL_MASK_SCRAM (SASL_MASK_SCRAMSHA1 | SASL_MASK_SCRAMSHA256 | SASL_MASK_SCRAMSHA512) |
Typedefs | |
typedef void(* | xmpp_open_handler) (xmpp_conn_t *const conn) |
Enumerations | |
enum | xmpp_loop_status_t { XMPP_LOOP_NOTSTARTED, XMPP_LOOP_RUNNING, XMPP_LOOP_QUIT } |
run-time context More... | |
enum | xmpp_conn_state_t { XMPP_STATE_DISCONNECTED, XMPP_STATE_CONNECTING, XMPP_STATE_CONNECTED } |
connection More... | |
enum | { XMPP_PORT_CLIENT = 5222, XMPP_PORT_CLIENT_LEGACY_SSL = 5223, XMPP_PORT_COMPONENT = 5347 } |
enum | xmpp_stanza_type_t { XMPP_STANZA_UNKNOWN, XMPP_STANZA_TEXT, XMPP_STANZA_TAG } |
Functions | |
void * | xmpp_alloc (const xmpp_ctx_t *const ctx, const size_t size) |
Allocate memory in a Strophe context. More... | |
void * | xmpp_realloc (const xmpp_ctx_t *const ctx, void *p, const size_t size) |
Reallocate memory in a Strophe context. More... | |
char * | xmpp_strdup (const xmpp_ctx_t *const ctx, const char *const s) |
implement our own strdup that uses the ctx allocator More... | |
void | xmpp_log (const xmpp_ctx_t *const ctx, const xmpp_log_level_t level, const char *const area, const char *const fmt, va_list ap) |
Write a log message to the logger. More... | |
void | xmpp_error (const xmpp_ctx_t *const ctx, const char *const area, const char *const fmt,...) |
Write to the log at the ERROR level. More... | |
void | xmpp_warn (const xmpp_ctx_t *const ctx, const char *const area, const char *const fmt,...) |
Write to the log at the WARN level. More... | |
void | xmpp_info (const xmpp_ctx_t *const ctx, const char *const area, const char *const fmt,...) |
Write to the log at the INFO level. More... | |
void | xmpp_debug (const xmpp_ctx_t *const ctx, const char *const area, const char *const fmt,...) |
Write to the log at the DEBUG level. More... | |
void | conn_disconnect (xmpp_conn_t *const conn) |
Disconnect from the XMPP server. More... | |
void | conn_disconnect_clean (xmpp_conn_t *const conn) |
Cleanly disconnect the connection. More... | |
void | conn_established (xmpp_conn_t *const conn) |
void | conn_open_stream (xmpp_conn_t *const conn) |
Send the opening <stream:stream> tag to the server. More... | |
int | conn_tls_start (xmpp_conn_t *const conn) |
void | conn_prepare_reset (xmpp_conn_t *const conn, xmpp_open_handler handler) |
void | conn_parser_reset (xmpp_conn_t *const conn) |
void | handler_fire_stanza (xmpp_conn_t *const conn, xmpp_stanza_t *const stanza) |
Fire off all stanza handlers that match. More... | |
uint64_t | handler_fire_timed (xmpp_ctx_t *const ctx) |
Fire off all timed handlers that are ready. More... | |
void | handler_reset_timed (xmpp_conn_t *conn, int user_only) |
Reset all timed handlers. More... | |
void | handler_add_timed (xmpp_conn_t *const conn, xmpp_timed_handler handler, const unsigned long period, void *const userdata) |
Add a timed system handler. More... | |
void | handler_add_id (xmpp_conn_t *const conn, xmpp_handler handler, const char *const id, void *const userdata) |
Add an id based system stanza handler. More... | |
void | handler_add (xmpp_conn_t *const conn, xmpp_handler handler, const char *const ns, const char *const name, const char *const type, void *const userdata) |
Add a system stanza handler. More... | |
void | handler_system_delete_all (xmpp_conn_t *conn) |
Delete all system handlers. More... | |
void | disconnect_mem_error (xmpp_conn_t *const conn) |
Disconnect the stream with a memory error. More... | |
void | auth_handle_open (xmpp_conn_t *const conn) |
Set up handlers at stream start. More... | |
void | auth_handle_component_open (xmpp_conn_t *const conn) |
void | auth_handle_open_raw (xmpp_conn_t *const conn) |
void | auth_handle_open_stub (xmpp_conn_t *const conn) |
Internally used functions and structures.
#define UNUSED | ( | x | ) | ((void)(x)) |
#define MAX_DOMAIN_LEN 256 |
#define SASL_MASK_PLAIN (1 << 0) |
#define SASL_MASK_DIGESTMD5 (1 << 1) |
#define SASL_MASK_ANONYMOUS (1 << 2) |
#define SASL_MASK_SCRAMSHA1 (1 << 3) |
#define SASL_MASK_SCRAMSHA256 (1 << 4) |
#define SASL_MASK_SCRAMSHA512 (1 << 5) |
#define SASL_MASK_SCRAM (SASL_MASK_SCRAMSHA1 | SASL_MASK_SCRAMSHA256 | SASL_MASK_SCRAMSHA512) |
typedef void(* xmpp_open_handler) (xmpp_conn_t *const conn) |
enum xmpp_loop_status_t |
enum xmpp_conn_state_t |
enum xmpp_stanza_type_t |
void* xmpp_alloc | ( | const xmpp_ctx_t *const | ctx, |
const size_t | size | ||
) |
Allocate memory in a Strophe context.
All Strophe functions will use this to allocate memory.
ctx | a Strophe context object |
size | the number of bytes to allocate |
void* xmpp_realloc | ( | const xmpp_ctx_t *const | ctx, |
void * | p, | ||
const size_t | size | ||
) |
Reallocate memory in a Strophe context.
All Strophe functions will use this to reallocate memory.
ctx | a Strophe context object |
p | a pointer to previously allocated memory |
size | the new size in bytes to allocate |
char* xmpp_strdup | ( | const xmpp_ctx_t *const | ctx, |
const char *const | s | ||
) |
implement our own strdup that uses the ctx allocator
Duplicate a string. This function replaces the standard strdup library call with a version that uses the Strophe context object's allocator.
ctx | a Strophe context object |
s | a string |
void xmpp_log | ( | const xmpp_ctx_t *const | ctx, |
const xmpp_log_level_t | level, | ||
const char *const | area, | ||
const char *const | fmt, | ||
va_list | ap | ||
) |
Write a log message to the logger.
Write a log message to the logger for the context for the specified level and area. This function takes a printf-style format string and a variable argument list (in va_list) format. This function is not meant to be called directly, but is used via xmpp_error, xmpp_warn, xmpp_info, and xmpp_debug.
ctx | a Strophe context object |
level | the level at which to log |
area | the area to log for |
fmt | a printf-style format string for the message |
ap | variable argument list supplied for the format string |
void xmpp_error | ( | const xmpp_ctx_t *const | ctx, |
const char *const | area, | ||
const char *const | fmt, | ||
... | |||
) |
Write to the log at the ERROR level.
This is a convenience function for writing to the log at the ERROR level. It takes a printf-style format string followed by a variable list of arguments for formatting.
ctx | a Strophe context object |
area | the area to log for |
fmt | a printf-style format string followed by a variable list of arguments to format |
void xmpp_warn | ( | const xmpp_ctx_t *const | ctx, |
const char *const | area, | ||
const char *const | fmt, | ||
... | |||
) |
Write to the log at the WARN level.
This is a convenience function for writing to the log at the WARN level. It takes a printf-style format string followed by a variable list of arguments for formatting.
ctx | a Strophe context object |
area | the area to log for |
fmt | a printf-style format string followed by a variable list of arguments to format |
void xmpp_info | ( | const xmpp_ctx_t *const | ctx, |
const char *const | area, | ||
const char *const | fmt, | ||
... | |||
) |
Write to the log at the INFO level.
This is a convenience function for writing to the log at the INFO level. It takes a printf-style format string followed by a variable list of arguments for formatting.
ctx | a Strophe context object |
area | the area to log for |
fmt | a printf-style format string followed by a variable list of arguments to format |
void xmpp_debug | ( | const xmpp_ctx_t *const | ctx, |
const char *const | area, | ||
const char *const | fmt, | ||
... | |||
) |
Write to the log at the DEBUG level.
This is a convenience function for writing to the log at the DEBUG level. It takes a printf-style format string followed by a variable list of arguments for formatting.
ctx | a Strophe context object |
area | the area to log for |
fmt | a printf-style format string followed by a variable list of arguments to format |
void conn_disconnect | ( | xmpp_conn_t *const | conn | ) |
Disconnect from the XMPP server.
This function immediately disconnects from the XMPP server, and should not be used outside of the Strophe library.
conn | a Strophe connection object |
void conn_disconnect_clean | ( | xmpp_conn_t *const | conn | ) |
Cleanly disconnect the connection.
This function is only called by the stream parser when </stream:stream> is received, and it not intended to be called by code outside of Strophe.
conn | a Strophe connection object |
void conn_established | ( | xmpp_conn_t *const | conn | ) |
void conn_open_stream | ( | xmpp_conn_t *const | conn | ) |
Send the opening <stream:stream> tag to the server.
This function is used by Strophe to begin an XMPP stream. It should not be used outside of the library.
conn | a Strophe connection object |
int conn_tls_start | ( | xmpp_conn_t *const | conn | ) |
void conn_prepare_reset | ( | xmpp_conn_t *const | conn, |
xmpp_open_handler | handler | ||
) |
void conn_parser_reset | ( | xmpp_conn_t *const | conn | ) |
void handler_fire_stanza | ( | xmpp_conn_t *const | conn, |
xmpp_stanza_t *const | stanza | ||
) |
Fire off all stanza handlers that match.
This function is called internally by the event loop whenever stanzas are received from the XMPP server.
conn | a Strophe connection object |
stanza | a Strophe stanza object |
uint64_t handler_fire_timed | ( | xmpp_ctx_t *const | ctx | ) |
Fire off all timed handlers that are ready.
This function is called internally by the event loop.
ctx | a Strophe context object |
void handler_reset_timed | ( | xmpp_conn_t * | conn, |
int | user_only | ||
) |
Reset all timed handlers.
This function is called internally when a connection is successful.
conn | a Strophe connection object |
user_only | whether to reset all handlers or only user ones |
void handler_add_timed | ( | xmpp_conn_t *const | conn, |
xmpp_timed_handler | handler, | ||
const unsigned long | period, | ||
void *const | userdata | ||
) |
Add a timed system handler.
This function is used to add internal timed handlers and should not be used outside of the library.
conn | a Strophe connection object |
handler | a function pointer to a timed handler |
period | the time in milliseconds between firings |
userdata | an opaque data pointer that will be passed to the handler |
void handler_add_id | ( | xmpp_conn_t *const | conn, |
xmpp_handler | handler, | ||
const char *const | id, | ||
void *const | userdata | ||
) |
Add an id based system stanza handler.
This function is used to add internal id based stanza handlers and should not be used outside of the library.
conn | a Strophe connection object |
handler | a function pointer to a stanza handler |
id | a string with the id |
userdata | an opaque data pointer that will be passed to the handler |
void handler_add | ( | xmpp_conn_t *const | conn, |
xmpp_handler | handler, | ||
const char *const | ns, | ||
const char *const | name, | ||
const char *const | type, | ||
void *const | userdata | ||
) |
Add a system stanza handler.
This function is used to add internal stanza handlers and should not be used outside of the library.
conn | a Strophe connection object |
handler | a function pointer to a stanza handler |
ns | a string with the namespace to match |
name | a string with the stanza name to match |
type | a string with the 'type' attribute value to match |
userdata | an opaque data pointer that will be passed to the handler |
void handler_system_delete_all | ( | xmpp_conn_t * | conn | ) |
Delete all system handlers.
This function is used to reset conn object before re-connecting.
conn | a Strophe connection object |
void disconnect_mem_error | ( | xmpp_conn_t *const | conn | ) |
Disconnect the stream with a memory error.
This is a convenience function used internally by various parts of the Strophe library for terminating the connection because of a memory error.
conn | a Strophe connection object |
void auth_handle_open | ( | xmpp_conn_t *const | conn | ) |
Set up handlers at stream start.
This function is called internally to Strophe for handling the opening of an XMPP stream. It's called by the parser when a stream is opened or reset, and adds the initial handlers for <stream:error/> and <stream:features/>. This function is not intended for use outside of Strophe.
conn | a Strophe connection object |
void auth_handle_component_open | ( | xmpp_conn_t *const | conn | ) |
void auth_handle_open_raw | ( | xmpp_conn_t *const | conn | ) |
void auth_handle_open_stub | ( | xmpp_conn_t *const | conn | ) |