Strophe
0.8
XMPP client library
|
Connection management. More...
Defines | |
#define | DEFAULT_SEND_QUEUE_MAX 64 |
The default maximum send queue size. | |
#define | DISCONNECT_TIMEOUT 2000 /* 2 seconds */ |
The time to wait (in milliseconds) for graceful disconnection to complete before the connection is reset. | |
#define | CONNECT_TIMEOUT 5000 /* 5 seconds */ |
The time to wait (in milliseconds) for a connection attempt to succeed or error. | |
Functions | |
static int | _disconnect_cleanup (xmpp_conn_t *const conn, void *const userdata) |
static void | _handle_stream_start (char *name, char **attrs, void *const userdata) |
static void | _handle_stream_end (char *name, void *const userdata) |
static void | _handle_stream_stanza (xmpp_stanza_t *stanza, void *const userdata) |
xmpp_conn_t * | xmpp_conn_new (xmpp_ctx_t *const ctx) |
Create a new Strophe connection object. | |
xmpp_conn_t * | xmpp_conn_clone (xmpp_conn_t *const conn) |
Clone a Strophe connection object. | |
int | xmpp_conn_release (xmpp_conn_t *const conn) |
Release a Strophe connection object. | |
const char * | xmpp_conn_get_jid (const xmpp_conn_t *const conn) |
Get the JID which is or will be bound to the connection. | |
const char * | xmpp_conn_get_bound_jid (const xmpp_conn_t *const conn) |
Get the JID discovered during binding time. | |
void | xmpp_conn_set_jid (xmpp_conn_t *const conn, const char *const jid) |
Set the JID of the user that will be bound to the connection. | |
const char * | xmpp_conn_get_pass (const xmpp_conn_t *const conn) |
Get the password used for authentication of a connection. | |
void | xmpp_conn_set_pass (xmpp_conn_t *const conn, const char *const pass) |
Set the password used to authenticate the connection. | |
xmpp_ctx_t * | xmpp_conn_get_context (xmpp_conn_t *const conn) |
Get the strophe context that the connection is associated with. | |
int | xmpp_connect_client (xmpp_conn_t *const conn, const char *const altdomain, unsigned short altport, xmpp_conn_handler callback, void *const userdata) |
Initiate a connection to the XMPP server. | |
void | conn_disconnect_clean (xmpp_conn_t *const conn) |
Cleanly disconnect the connection. | |
void | conn_disconnect (xmpp_conn_t *const conn) |
Disconnect from the XMPP server. | |
void | conn_prepare_reset (xmpp_conn_t *const conn, xmpp_open_handler handler) |
void | conn_parser_reset (xmpp_conn_t *const conn) |
void | xmpp_disconnect (xmpp_conn_t *const conn) |
Initiate termination of the connection to the XMPP server. | |
void | xmpp_send_raw_string (xmpp_conn_t *const conn, const char *const fmt,...) |
Send a raw string to the XMPP server. | |
void | xmpp_send_raw (xmpp_conn_t *const conn, const char *const data, const size_t len) |
Send raw bytes to the XMPP server. | |
void | xmpp_send (xmpp_conn_t *const conn, xmpp_stanza_t *const stanza) |
Send an XML stanza to the XMPP server. | |
void | conn_open_stream (xmpp_conn_t *const conn) |
Send the opening <stream:stream> tag to the server. | |
void | xmpp_conn_disable_tls (xmpp_conn_t *const conn) |
Disable TLS for this connection, called by users of the library. | |
static void | _log_open_tag (xmpp_conn_t *conn, char **attrs) |
static char * | _get_stream_attribute (char **attrs, char *name) |
Connection management.
#define DEFAULT_SEND_QUEUE_MAX 64 |
The default maximum send queue size.
This is currently unused.
#define DISCONNECT_TIMEOUT 2000 /* 2 seconds */ |
The time to wait (in milliseconds) for graceful disconnection to complete before the connection is reset.
The default is 2 seconds.
#define CONNECT_TIMEOUT 5000 /* 5 seconds */ |
The time to wait (in milliseconds) for a connection attempt to succeed or error.
The default is 5 seconds.
static int _disconnect_cleanup | ( | xmpp_conn_t *const | conn, |
void *const | userdata | ||
) | [static] |
static void _handle_stream_start | ( | char * | name, |
char ** | attrs, | ||
void *const | userdata | ||
) | [static] |
static void _handle_stream_end | ( | char * | name, |
void *const | userdata | ||
) | [static] |
static void _handle_stream_stanza | ( | xmpp_stanza_t * | stanza, |
void *const | userdata | ||
) | [static] |
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_disconnect | ( | 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 xmpp_send_raw_string | ( | xmpp_conn_t *const | conn, |
const char *const | fmt, | ||
... | |||
) |
Send a raw string to the XMPP server.
This function is a convenience function to send raw string data to the XMPP server. It is used by Strophe to send short messages instead of building up an XML stanza with DOM methods. This should be used with care as it does not validate the data; invalid data may result in immediate stream termination by the XMPP server.
conn | a Strophe connection object |
fmt | a printf-style format string followed by a variable list of arguments to format |
void xmpp_send_raw | ( | xmpp_conn_t *const | conn, |
const char *const | data, | ||
const size_t | len | ||
) |
Send raw bytes to the XMPP server.
This function is a convenience function to send raw bytes to the XMPP server. It is usedly primarly by xmpp_send_raw_string. This function should be used with care as it does not validate the bytes and invalid data may result in stream termination by the XMPP server.
conn | a Strophe connection object |
data | a buffer of raw bytes |
len | the length of the data in the buffer |
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 |
void xmpp_conn_disable_tls | ( | xmpp_conn_t *const | conn | ) |
Disable TLS for this connection, called by users of the library.
Occasionally a server will be misconfigured to send the starttls feature, but wil not support the handshake.
conn | a Strophe connection object |
static void _log_open_tag | ( | xmpp_conn_t * | conn, |
char ** | attrs | ||
) | [static] |
static char* _get_stream_attribute | ( | char ** | attrs, |
char * | name | ||
) | [static] |