Strophe 0.13
XMPP client library
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
strophe.h File Reference

Strophe public C API definitions. More...

Data Structures

struct  xmpp_mem_t
 
struct  xmpp_log_t
 
struct  xmpp_stream_error_t
 

Macros

#define XMPP_NS_CLIENT   "jabber:client"
 Namespace definition for 'jabber:client'.
 
#define XMPP_NS_COMPONENT   "jabber:component:accept"
 Namespace definition for 'jabber:component:accept'.
 
#define XMPP_NS_STREAMS   "http://etherx.jabber.org/streams"
 Namespace definition for 'http://etherx.jabber.org/streams'.
 
#define XMPP_NS_STREAMS_IETF   "urn:ietf:params:xml:ns:xmpp-streams"
 Namespace definition for 'urn:ietf:params:xml:ns:xmpp-streams'.
 
#define XMPP_NS_STANZAS_IETF   "urn:ietf:params:xml:ns:xmpp-stanzas"
 Namespace definition for 'urn:ietf:params:xml:ns:xmpp-stanzas'.
 
#define XMPP_NS_TLS   "urn:ietf:params:xml:ns:xmpp-tls"
 Namespace definition for 'url:ietf:params:xml:ns:xmpp-tls'.
 
#define XMPP_NS_SASL   "urn:ietf:params:xml:ns:xmpp-sasl"
 Namespace definition for 'urn:ietf:params:xml:ns:xmpp-sasl'.
 
#define XMPP_NS_BIND   "urn:ietf:params:xml:ns:xmpp-bind"
 Namespace definition for 'urn:ietf:params:xml:ns:xmpp-bind'.
 
#define XMPP_NS_SESSION   "urn:ietf:params:xml:ns:xmpp-session"
 Namespace definition for 'urn:ietf:params:xml:ns:xmpp-session'.
 
#define XMPP_NS_AUTH   "jabber:iq:auth"
 Namespace definition for 'jabber:iq:auth'.
 
#define XMPP_NS_DISCO_INFO   "http://jabber.org/protocol/disco#info"
 Namespace definition for 'http://jabber.org/protocol/disco#info'.
 
#define XMPP_NS_DISCO_ITEMS   "http://jabber.org/protocol/disco#items"
 Namespace definition for 'http://jabber.org/protocol/disco#items'.
 
#define XMPP_NS_ROSTER   "jabber:iq:roster"
 Namespace definition for 'jabber:iq:roster'.
 
#define XMPP_NS_REGISTER   "jabber:iq:register"
 Namespace definition for 'jabber:iq:register'.
 
#define XMPP_NS_SM   "urn:xmpp:sm:3"
 Namespace definition for Stream Management.
 
#define XMPP_NS_COMPRESSION   "http://jabber.org/protocol/compress"
 Namespace definition for Stream Compression.
 
#define XMPP_NS_FEATURE_COMPRESSION   "http://jabber.org/features/compress"
 Namespace definition for Stream Compression.
 
#define XMPP_EOK   0
 Success error code.
 
#define XMPP_EMEM   -1
 Memory related failure error code.
 
#define XMPP_EINVOP   -2
 Invalid operation error code.
 
#define XMPP_EINT   -3
 Internal failure error code.
 
#define XMPP_CONN_FLAG_DISABLE_TLS   (1UL << 0)
 
#define XMPP_CONN_FLAG_MANDATORY_TLS   (1UL << 1)
 
#define XMPP_CONN_FLAG_LEGACY_SSL   (1UL << 2)
 
#define XMPP_CONN_FLAG_TRUST_TLS   (1UL << 3)
 Trust server's certificate even if it is invalid.
 
#define XMPP_CONN_FLAG_LEGACY_AUTH   (1UL << 4)
 Enable legacy authentication support.
 
#define XMPP_CONN_FLAG_DISABLE_SM   (1UL << 5)
 Disable Stream-Management XEP-0198.
 
#define XMPP_CONN_FLAG_ENABLE_COMPRESSION   (1UL << 6)
 Enable Stream-Compression XEP-0138.
 
#define XMPP_CONN_FLAG_COMPRESSION_DONT_RESET   (1UL << 7)
 Don't reset the compressed stream after each stanza.
 
#define XMPP_STANZA_NAME_IN_NS(name, ns)   name "[@ns='" ns "']"
 
#define XMPP_SHA1_DIGEST_SIZE   20
 Size of the SHA1 message digest.
 
#define XMPP_DEPRECATED(x)
 Formerly "private but exported" functions made public for now to announce deprecation.
 

Typedefs

typedef void(* xmpp_log_handler) (void *userdata, xmpp_log_level_t level, const char *area, const char *msg)
 
typedef void(* xmpp_conn_handler) (xmpp_conn_t *conn, xmpp_conn_event_t event, int error, xmpp_stream_error_t *stream_error, void *userdata)
 
typedef int(* xmpp_certfail_handler) (const xmpp_tlscert_t *cert, const char *const errormsg)
 The Handler function which will be called when the TLS stack can't verify the authenticity of a Certificate that gets presented by the server we're trying to connect to.
 
typedef int(* xmpp_password_callback) (char *pw, size_t pw_max, xmpp_conn_t *conn, void *userdata)
 The Handler function which will be called when the TLS stack can't decrypt a password protected key file.
 
typedef int(* xmpp_sockopt_callback) (xmpp_conn_t *conn, void *sock)
 The function which will be called when Strophe creates a new socket.
 
typedef int(* xmpp_timed_handler) (xmpp_conn_t *conn, void *userdata)
 
typedef int(* xmpp_global_timed_handler) (xmpp_ctx_t *ctx, void *userdata)
 
typedef int(* xmpp_handler) (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
 

Enumerations

enum  xmpp_log_level_t { XMPP_LEVEL_DEBUG , XMPP_LEVEL_INFO , XMPP_LEVEL_WARN , XMPP_LEVEL_ERROR }
 
enum  xmpp_conn_type_t { XMPP_UNKNOWN , XMPP_CLIENT , XMPP_COMPONENT }
 
enum  xmpp_conn_event_t { XMPP_CONN_CONNECT , XMPP_CONN_RAW_CONNECT , XMPP_CONN_DISCONNECT , XMPP_CONN_FAIL }
 
enum  xmpp_error_type_t {
  XMPP_SE_BAD_FORMAT , XMPP_SE_BAD_NS_PREFIX , XMPP_SE_CONFLICT , XMPP_SE_CONN_TIMEOUT ,
  XMPP_SE_HOST_GONE , XMPP_SE_HOST_UNKNOWN , XMPP_SE_IMPROPER_ADDR , XMPP_SE_INTERNAL_SERVER_ERROR ,
  XMPP_SE_INVALID_FROM , XMPP_SE_INVALID_ID , XMPP_SE_INVALID_NS , XMPP_SE_INVALID_XML ,
  XMPP_SE_NOT_AUTHORIZED , XMPP_SE_POLICY_VIOLATION , XMPP_SE_REMOTE_CONN_FAILED , XMPP_SE_RESOURCE_CONSTRAINT ,
  XMPP_SE_RESTRICTED_XML , XMPP_SE_SEE_OTHER_HOST , XMPP_SE_SYSTEM_SHUTDOWN , XMPP_SE_UNDEFINED_CONDITION ,
  XMPP_SE_UNSUPPORTED_ENCODING , XMPP_SE_UNSUPPORTED_STANZA_TYPE , XMPP_SE_UNSUPPORTED_VERSION , XMPP_SE_XML_NOT_WELL_FORMED
}
 
enum  xmpp_cert_element_t {
  XMPP_CERT_VERSION , XMPP_CERT_SERIALNUMBER , XMPP_CERT_SUBJECT , XMPP_CERT_ISSUER ,
  XMPP_CERT_NOTBEFORE , XMPP_CERT_NOTAFTER , XMPP_CERT_KEYALG , XMPP_CERT_SIGALG ,
  XMPP_CERT_FINGERPRINT_SHA1 , XMPP_CERT_FINGERPRINT_SHA256 , XMPP_CERT_ELEMENT_MAX
}
 Certificate Elements. More...
 
enum  xmpp_queue_element_t { XMPP_QUEUE_OLDEST = -1 , XMPP_QUEUE_YOUNGEST = -2 }
 

Functions

void xmpp_initialize (void)
 Initialize the Strophe library.
 
void xmpp_shutdown (void)
 Shutdown the Strophe library.
 
int xmpp_version_check (int major, int minor)
 Check that Strophe supports a specific API version.
 
xmpp_ctx_t * xmpp_ctx_new (const xmpp_mem_t *mem, const xmpp_log_t *log)
 Create and initialize a Strophe context object.
 
void xmpp_ctx_free (xmpp_ctx_t *ctx)
 Free a Strophe context object that is no longer in use.
 
void xmpp_ctx_set_verbosity (xmpp_ctx_t *ctx, int level)
 Set the verbosity level of a Strophe context.
 
void xmpp_free (const xmpp_ctx_t *ctx, void *p)
 Trampoline to strophe_free.
 
xmpp_log_t * xmpp_get_default_logger (xmpp_log_level_t level)
 Get a default logger with filtering.
 
int xmpp_sockopt_cb_keepalive (xmpp_conn_t *conn, void *sock)
 Example sockopt callback function An example function that can be used to set reasonable default keepalive options on sockets when registered for a connection with xmpp_conn_set_sockopt_callback()
 
void xmpp_send_error (xmpp_conn_t *conn, xmpp_error_type_t type, char *text)
 
xmpp_conn_t * xmpp_conn_new (xmpp_ctx_t *ctx)
 Create a new Strophe connection object.
 
xmpp_conn_t * xmpp_conn_clone (xmpp_conn_t *conn)
 Clone a Strophe connection object.
 
int xmpp_conn_release (xmpp_conn_t *conn)
 Release a Strophe connection object.
 
long xmpp_conn_get_flags (const xmpp_conn_t *conn)
 Return applied flags for the connection.
 
int xmpp_conn_set_flags (xmpp_conn_t *conn, long flags)
 Set flags for the connection.
 
const char * xmpp_conn_get_jid (const xmpp_conn_t *conn)
 Get the JID which is or will be bound to the connection.
 
const char * xmpp_conn_get_bound_jid (const xmpp_conn_t *conn)
 Get the JID discovered during binding time.
 
void xmpp_conn_set_jid (xmpp_conn_t *conn, const char *jid)
 Set the JID of the user that will be bound to the connection.
 
void xmpp_conn_set_cafile (xmpp_conn_t *const conn, const char *path)
 Set the CAfile.
 
void xmpp_conn_set_capath (xmpp_conn_t *const conn, const char *path)
 Set the CApath.
 
void xmpp_conn_set_certfail_handler (xmpp_conn_t *const conn, xmpp_certfail_handler hndl)
 Set the Handler function which will be called when the TLS stack can't verify the CA of the server we're trying to connect to.
 
xmpp_tlscert_t * xmpp_conn_get_peer_cert (xmpp_conn_t *const conn)
 Retrieve the peer certificate.
 
void xmpp_conn_set_password_callback (xmpp_conn_t *conn, xmpp_password_callback cb, void *userdata)
 Set the Callback function which will be called when the TLS stack can't decrypt a password protected key file.
 
void xmpp_conn_set_password_retries (xmpp_conn_t *conn, unsigned int retries)
 Set the number of retry attempts to decrypt a private key file.
 
const char * xmpp_conn_get_keyfile (const xmpp_conn_t *conn)
 Retrieve the path of the key file that shall be unlocked.
 
void xmpp_conn_set_client_cert (xmpp_conn_t *conn, const char *cert, const char *key)
 Set the Client Certificate and Private Key or PKCS#12 encoded file that will be bound to the connection.
 
unsigned int xmpp_conn_cert_xmppaddr_num (xmpp_conn_t *conn)
 Get the number of xmppAddr entries in the client certificate.
 
char * xmpp_conn_cert_xmppaddr (xmpp_conn_t *conn, unsigned int n)
 Get a specific xmppAddr entry.
 
const char * xmpp_conn_get_pass (const xmpp_conn_t *conn)
 Get the password used for authentication of a connection.
 
void xmpp_conn_set_pass (xmpp_conn_t *conn, const char *pass)
 Set the password used to authenticate the connection.
 
xmpp_ctx_t * xmpp_conn_get_context (xmpp_conn_t *conn)
 Get the strophe context that the connection is associated with.
 
int xmpp_conn_is_secured (xmpp_conn_t *conn)
 Return whether TLS session is established or not.
 
void xmpp_conn_set_sockopt_callback (xmpp_conn_t *conn, xmpp_sockopt_callback callback)
 Register sockopt callback Set function to be called when a new socket is created to allow setting socket options before connection is started.
 
int xmpp_conn_is_connecting (xmpp_conn_t *conn)
 
int xmpp_conn_is_connected (xmpp_conn_t *conn)
 
int xmpp_conn_is_disconnected (xmpp_conn_t *conn)
 
int xmpp_conn_send_queue_len (const xmpp_conn_t *conn)
 
char * xmpp_conn_send_queue_drop_element (xmpp_conn_t *conn, xmpp_queue_element_t which)
 Drop an element of the send queue.
 
xmpp_sm_state_t * xmpp_conn_get_sm_state (xmpp_conn_t *conn)
 This returns the Stream Management state of a connection object after it has been disconnected.
 
int xmpp_conn_set_sm_state (xmpp_conn_t *conn, xmpp_sm_state_t *sm_state)
 
void xmpp_free_sm_state (xmpp_sm_state_t *sm_state)
 c.f.
 
int xmpp_connect_client (xmpp_conn_t *conn, const char *altdomain, unsigned short altport, xmpp_conn_handler callback, void *userdata)
 Initiate a connection to the XMPP server.
 
int xmpp_connect_component (xmpp_conn_t *conn, const char *server, unsigned short port, xmpp_conn_handler callback, void *userdata)
 Initiate a component connection to server.
 
int xmpp_connect_raw (xmpp_conn_t *conn, const char *altdomain, unsigned short altport, xmpp_conn_handler callback, void *userdata)
 Initiate a raw connection to the XMPP server.
 
int xmpp_conn_open_stream_default (xmpp_conn_t *conn)
 Send the default opening stream tag.
 
int xmpp_conn_open_stream (xmpp_conn_t *conn, char **attributes, size_t attributes_len)
 Send an opening stream tag.
 
int xmpp_conn_tls_start (xmpp_conn_t *conn)
 Start synchronous TLS handshake with the server.
 
void xmpp_disconnect (xmpp_conn_t *conn)
 Initiate termination of the connection to the XMPP server.
 
void xmpp_send (xmpp_conn_t *conn, xmpp_stanza_t *stanza)
 Send an XML stanza to the XMPP server.
 
void xmpp_send_raw_string (xmpp_conn_t *conn, const char *fmt,...)
 Send a raw string to the XMPP server.
 
void xmpp_send_raw (xmpp_conn_t *conn, const char *data, size_t len)
 Send raw bytes to the XMPP server.
 
void xmpp_timed_handler_add (xmpp_conn_t *conn, xmpp_timed_handler handler, unsigned long period, void *userdata)
 Add a timed handler.
 
void xmpp_timed_handler_delete (xmpp_conn_t *conn, xmpp_timed_handler handler)
 Delete a timed handler.
 
void xmpp_global_timed_handler_add (xmpp_ctx_t *ctx, xmpp_global_timed_handler handler, unsigned long period, void *userdata)
 Add a global timed handler.
 
void xmpp_global_timed_handler_delete (xmpp_ctx_t *ctx, xmpp_global_timed_handler handler)
 Delete a global timed handler.
 
void xmpp_handler_add (xmpp_conn_t *conn, xmpp_handler handler, const char *ns, const char *name, const char *type, void *userdata)
 Add a stanza handler.
 
void xmpp_handler_delete (xmpp_conn_t *conn, xmpp_handler handler)
 Delete a stanza handler.
 
void xmpp_id_handler_add (xmpp_conn_t *conn, xmpp_handler handler, const char *id, void *userdata)
 Add an id based stanza handler.
 
void xmpp_id_handler_delete (xmpp_conn_t *conn, xmpp_handler handler, const char *id)
 Delete an id based stanza handler.
 
xmpp_stanza_t * xmpp_stanza_new (xmpp_ctx_t *ctx)
 Create a stanza object.
 
xmpp_stanza_t * xmpp_stanza_new_from_string (xmpp_ctx_t *ctx, const char *str)
 Create a stanza object from the string.
 
xmpp_stanza_t * xmpp_stanza_clone (xmpp_stanza_t *stanza)
 Clone a stanza object.
 
xmpp_stanza_t * xmpp_stanza_copy (const xmpp_stanza_t *stanza)
 Copy a stanza and its children.
 
int xmpp_stanza_release (xmpp_stanza_t *stanza)
 Release a stanza object and all of its children.
 
xmpp_ctx_t * xmpp_stanza_get_context (const xmpp_stanza_t *stanza)
 Get the strophe context that the stanza is associated with.
 
int xmpp_stanza_is_text (xmpp_stanza_t *stanza)
 Determine if a stanza is a text node.
 
int xmpp_stanza_is_tag (xmpp_stanza_t *stanza)
 Determine if a stanza is a tag node.
 
int xmpp_stanza_to_text (xmpp_stanza_t *stanza, char **buf, size_t *buflen)
 Render a stanza object to text.
 
xmpp_stanza_t * xmpp_stanza_get_children (xmpp_stanza_t *stanza)
 Get the list of children.
 
xmpp_stanza_t * xmpp_stanza_get_child_by_name (xmpp_stanza_t *stanza, const char *name)
 Get the first child of stanza with name.
 
xmpp_stanza_t * xmpp_stanza_get_child_by_ns (xmpp_stanza_t *stanza, const char *ns)
 Get the first child of a stanza with a given namespace.
 
xmpp_stanza_t * xmpp_stanza_get_child_by_name_and_ns (xmpp_stanza_t *stanza, const char *name, const char *ns)
 Get the first child of stanza with name and a given namespace.
 
xmpp_stanza_t * xmpp_stanza_get_child_by_path (xmpp_stanza_t *stanza,...)
 Get the first child of stanza following a path-like list of names.
 
xmpp_stanza_t * xmpp_stanza_get_next (xmpp_stanza_t *stanza)
 Get the next sibling of a stanza.
 
int xmpp_stanza_add_child (xmpp_stanza_t *stanza, xmpp_stanza_t *child)
 Add a child stanza to a stanza object.
 
int xmpp_stanza_add_child_ex (xmpp_stanza_t *stanza, xmpp_stanza_t *child, int do_clone)
 Add a child stanza to a stanza object.
 
const char * xmpp_stanza_get_attribute (xmpp_stanza_t *stanza, const char *name)
 Get an attribute from a stanza.
 
int xmpp_stanza_get_attribute_count (xmpp_stanza_t *stanza)
 Count the attributes in a stanza object.
 
int xmpp_stanza_get_attributes (xmpp_stanza_t *stanza, const char **attr, int attrlen)
 Get all attributes for a stanza object.
 
char * xmpp_stanza_get_text (xmpp_stanza_t *stanza)
 Get the text data for a text stanza.
 
const char * xmpp_stanza_get_text_ptr (xmpp_stanza_t *stanza)
 Get the text data pointer for a text stanza.
 
const char * xmpp_stanza_get_name (xmpp_stanza_t *stanza)
 Get the stanza name.
 
int xmpp_stanza_set_attribute (xmpp_stanza_t *stanza, const char *key, const char *value)
 Set an attribute for a stanza object.
 
int xmpp_stanza_set_name (xmpp_stanza_t *stanza, const char *name)
 Set the name of a stanza.
 
int xmpp_stanza_set_text (xmpp_stanza_t *stanza, const char *text)
 Set the text data for a text stanza.
 
int xmpp_stanza_set_text_with_size (xmpp_stanza_t *stanza, const char *text, size_t size)
 Set the text data for a text stanza.
 
int xmpp_stanza_del_attribute (xmpp_stanza_t *stanza, const char *name)
 Delete an attribute from a stanza.
 
const char * xmpp_stanza_get_ns (xmpp_stanza_t *stanza)
 Get the namespace attribute of the stanza object.
 
const char * xmpp_stanza_get_type (xmpp_stanza_t *stanza)
 Get the 'type' attribute of the stanza object.
 
const char * xmpp_stanza_get_id (xmpp_stanza_t *stanza)
 Get the 'id' attribute of the stanza object.
 
const char * xmpp_stanza_get_to (xmpp_stanza_t *stanza)
 Get the 'to' attribute of the stanza object.
 
const char * xmpp_stanza_get_from (xmpp_stanza_t *stanza)
 Get the 'from' attribute of the stanza object.
 
int xmpp_stanza_set_ns (xmpp_stanza_t *stanza, const char *ns)
 Set the stanza namespace.
 
int xmpp_stanza_set_id (xmpp_stanza_t *stanza, const char *id)
 Set the 'id' attribute of a stanza.
 
int xmpp_stanza_set_type (xmpp_stanza_t *stanza, const char *type)
 Set the 'type' attribute of a stanza.
 
int xmpp_stanza_set_to (xmpp_stanza_t *stanza, const char *to)
 Set the 'to' attribute of a stanza.
 
int xmpp_stanza_set_from (xmpp_stanza_t *stanza, const char *from)
 Set the 'from' attribute of a stanza.
 
xmpp_stanza_t * xmpp_stanza_reply (xmpp_stanza_t *stanza)
 Create a stanza object in reply to another.
 
xmpp_stanza_t * xmpp_stanza_reply_error (xmpp_stanza_t *stanza, const char *error_type, const char *condition, const char *text)
 Create an error stanza in reply to the provided stanza.
 
xmpp_stanza_t * xmpp_message_new (xmpp_ctx_t *ctx, const char *type, const char *to, const char *id)
 Create a <message/> stanza object with given attributes.
 
char * xmpp_message_get_body (xmpp_stanza_t *msg)
 Get text from <body/> child element.
 
int xmpp_message_set_body (xmpp_stanza_t *msg, const char *text)
 Add <body/> child element to a <message/> stanza with the given text.
 
xmpp_stanza_t * xmpp_iq_new (xmpp_ctx_t *ctx, const char *type, const char *id)
 Create an <iq/> stanza object with given attributes.
 
xmpp_stanza_t * xmpp_presence_new (xmpp_ctx_t *ctx)
 Create a <presence/> stanza object.
 
xmpp_stanza_t * xmpp_error_new (xmpp_ctx_t *ctx, xmpp_error_type_t type, const char *text)
 Create an <stream:error/> stanza object with given type and error text.
 
char * xmpp_jid_new (xmpp_ctx_t *ctx, const char *node, const char *domain, const char *resource)
 Create a JID string from component parts node, domain, and resource.
 
char * xmpp_jid_bare (xmpp_ctx_t *ctx, const char *jid)
 Create a bare JID from a JID.
 
char * xmpp_jid_node (xmpp_ctx_t *ctx, const char *jid)
 Create a node string from a JID.
 
char * xmpp_jid_domain (xmpp_ctx_t *ctx, const char *jid)
 Create a domain string from a JID.
 
char * xmpp_jid_resource (xmpp_ctx_t *ctx, const char *jid)
 Create a resource string from a JID.
 
void xmpp_run_once (xmpp_ctx_t *ctx, unsigned long timeout)
 Run the event loop once.
 
void xmpp_run (xmpp_ctx_t *ctx)
 Start the event loop.
 
void xmpp_stop (xmpp_ctx_t *ctx)
 Stop the event loop.
 
void xmpp_ctx_set_timeout (xmpp_ctx_t *ctx, unsigned long timeout)
 Set the timeout to use when calling xmpp_run().
 
xmpp_ctx_t * xmpp_tlscert_get_ctx (const xmpp_tlscert_t *cert)
 Get the Strophe context which is assigned to this certificate.
 
xmpp_conn_t * xmpp_tlscert_get_conn (const xmpp_tlscert_t *cert)
 Get the Strophe connection which is assigned to this certificate.
 
const char * xmpp_tlscert_get_pem (const xmpp_tlscert_t *cert)
 Get the complete PEM of this certificate.
 
const char * xmpp_tlscert_get_dnsname (const xmpp_tlscert_t *cert, size_t n)
 Get the dnsName entries out of the SubjectAlternativeNames.
 
const char * xmpp_tlscert_get_string (const xmpp_tlscert_t *cert, xmpp_cert_element_t elmnt)
 Get various parts of the certificate as String.
 
const char * xmpp_tlscert_get_description (xmpp_cert_element_t elmnt)
 Get a descriptive string for each xmpp_cert_element_t.
 
void xmpp_tlscert_free (xmpp_tlscert_t *cert)
 Free a certificate object.
 
char * xmpp_uuid_gen (xmpp_ctx_t *ctx)
 Generate UUID version 4.
 
char * xmpp_sha1 (xmpp_ctx_t *ctx, const unsigned char *data, size_t len)
 Compute SHA1 message digest.
 
void xmpp_sha1_digest (const unsigned char *data, size_t len, unsigned char *digest)
 Compute SHA1 message digest.
 
xmpp_sha1_t * xmpp_sha1_new (xmpp_ctx_t *ctx)
 Create new SHA1 object.
 
void xmpp_sha1_free (xmpp_sha1_t *sha1)
 Destroy SHA1 object.
 
void xmpp_sha1_update (xmpp_sha1_t *sha1, const unsigned char *data, size_t len)
 Update SHA1 context with the next portion of data.
 
void xmpp_sha1_final (xmpp_sha1_t *sha1)
 Finish SHA1 computation.
 
char * xmpp_sha1_to_string (xmpp_sha1_t *sha1, char *s, size_t slen)
 Return message digest rendered as a string.
 
char * xmpp_sha1_to_string_alloc (xmpp_sha1_t *sha1)
 Return message digest rendered as a string.
 
void xmpp_sha1_to_digest (xmpp_sha1_t *sha1, unsigned char *digest)
 Stores message digest to a user's buffer.
 
char * xmpp_base64_encode (xmpp_ctx_t *ctx, const unsigned char *data, size_t len)
 Base64 encoding routine.
 
char * xmpp_base64_decode_str (xmpp_ctx_t *ctx, const char *base64, size_t len)
 Base64 decoding routine.
 
void xmpp_base64_decode_bin (xmpp_ctx_t *ctx, const char *base64, size_t len, unsigned char **out, size_t *outlen)
 Base64 decoding routine.
 
xmpp_rand_t * xmpp_rand_new (xmpp_ctx_t *ctx)
 Create new xmpp_rand_t object.
 
void xmpp_rand_free (xmpp_ctx_t *ctx, xmpp_rand_t *rand)
 Destroy an xmpp_rand_t object.
 
int xmpp_rand (xmpp_rand_t *rand)
 Generate random integer.
 
void xmpp_rand_bytes (xmpp_rand_t *rand, unsigned char *output, size_t len)
 Generate random bytes.
 
void xmpp_rand_nonce (xmpp_rand_t *rand, char *output, size_t len)
 Generate a nonce that is printable randomized string.
 
 XMPP_DEPRECATED (internal) void *xmpp_alloc(const xmpp_ctx_t *ctx
 
void * xmpp_realloc (const xmpp_ctx_t *ctx, void *p, size_t size)
 Reallocate memory in a Strophe context.
 
char * xmpp_strdup (const xmpp_ctx_t *ctx, const char *s)
 implement our own strdup that uses the ctx allocator
 
char * xmpp_strndup (const xmpp_ctx_t *ctx, const char *s, size_t len)
 Duplicate a string with a maximum length.
 
char * xmpp_strtok_r (char *s, const char *delim, char **saveptr)
 strtok_r(3) implementation.
 
int xmpp_snprintf (char *str, size_t count, const char *fmt,...)
 
int xmpp_vsnprintf (char *str, size_t count, const char *fmt, va_list arg)
 
void xmpp_log (const xmpp_ctx_t *ctx, xmpp_log_level_t level, const char *area, const char *fmt, va_list ap)
 
void xmpp_error (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the ERROR level.
 
void xmpp_warn (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the WARN level.
 
void xmpp_info (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the INFO level.
 
void xmpp_debug (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the DEBUG level.
 
void xmpp_debug_verbose (int level, const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the DEBUG level if verbosity is enabled.
 
void xmpp_conn_set_keepalive (xmpp_conn_t *conn, int timeout, int interval)
 Set TCP keepalive parameters Turn on TCP keepalive and set timeout and interval.
 
void xmpp_conn_disable_tls (xmpp_conn_t *conn)
 Disable TLS for this connection, called by users of the library.
 

Variables

size_t size
 

Detailed Description

Strophe public C API definitions.

Macro Definition Documentation

◆ XMPP_NS_CLIENT

#define XMPP_NS_CLIENT   "jabber:client"

Namespace definition for 'jabber:client'.

◆ XMPP_NS_COMPONENT

#define XMPP_NS_COMPONENT   "jabber:component:accept"

Namespace definition for 'jabber:component:accept'.

◆ XMPP_NS_STREAMS

#define XMPP_NS_STREAMS   "http://etherx.jabber.org/streams"

Namespace definition for 'http://etherx.jabber.org/streams'.

◆ XMPP_NS_STREAMS_IETF

#define XMPP_NS_STREAMS_IETF   "urn:ietf:params:xml:ns:xmpp-streams"

Namespace definition for 'urn:ietf:params:xml:ns:xmpp-streams'.

◆ XMPP_NS_STANZAS_IETF

#define XMPP_NS_STANZAS_IETF   "urn:ietf:params:xml:ns:xmpp-stanzas"

Namespace definition for 'urn:ietf:params:xml:ns:xmpp-stanzas'.

◆ XMPP_NS_TLS

#define XMPP_NS_TLS   "urn:ietf:params:xml:ns:xmpp-tls"

Namespace definition for 'url:ietf:params:xml:ns:xmpp-tls'.

◆ XMPP_NS_SASL

#define XMPP_NS_SASL   "urn:ietf:params:xml:ns:xmpp-sasl"

Namespace definition for 'urn:ietf:params:xml:ns:xmpp-sasl'.

◆ XMPP_NS_BIND

#define XMPP_NS_BIND   "urn:ietf:params:xml:ns:xmpp-bind"

Namespace definition for 'urn:ietf:params:xml:ns:xmpp-bind'.

◆ XMPP_NS_SESSION

#define XMPP_NS_SESSION   "urn:ietf:params:xml:ns:xmpp-session"

Namespace definition for 'urn:ietf:params:xml:ns:xmpp-session'.

◆ XMPP_NS_AUTH

#define XMPP_NS_AUTH   "jabber:iq:auth"

Namespace definition for 'jabber:iq:auth'.

◆ XMPP_NS_DISCO_INFO

#define XMPP_NS_DISCO_INFO   "http://jabber.org/protocol/disco#info"

Namespace definition for 'http://jabber.org/protocol/disco#info'.

◆ XMPP_NS_DISCO_ITEMS

#define XMPP_NS_DISCO_ITEMS   "http://jabber.org/protocol/disco#items"

Namespace definition for 'http://jabber.org/protocol/disco#items'.

◆ XMPP_NS_ROSTER

#define XMPP_NS_ROSTER   "jabber:iq:roster"

Namespace definition for 'jabber:iq:roster'.

◆ XMPP_NS_REGISTER

#define XMPP_NS_REGISTER   "jabber:iq:register"

Namespace definition for 'jabber:iq:register'.

◆ XMPP_NS_SM

#define XMPP_NS_SM   "urn:xmpp:sm:3"

Namespace definition for Stream Management.

◆ XMPP_NS_COMPRESSION

#define XMPP_NS_COMPRESSION   "http://jabber.org/protocol/compress"

Namespace definition for Stream Compression.

◆ XMPP_NS_FEATURE_COMPRESSION

#define XMPP_NS_FEATURE_COMPRESSION   "http://jabber.org/features/compress"

Namespace definition for Stream Compression.

◆ XMPP_EOK

#define XMPP_EOK   0

Success error code.

◆ XMPP_EMEM

#define XMPP_EMEM   -1

Memory related failure error code.

This is returned on allocation errors and signals that the host may be out of memory.

◆ XMPP_EINVOP

#define XMPP_EINVOP   -2

Invalid operation error code.

This error code is returned when the operation was invalid and signals that the Strophe API is being used incorrectly.

◆ XMPP_EINT

#define XMPP_EINT   -3

Internal failure error code.

◆ XMPP_CONN_FLAG_DISABLE_TLS

#define XMPP_CONN_FLAG_DISABLE_TLS   (1UL << 0)

◆ XMPP_CONN_FLAG_MANDATORY_TLS

#define XMPP_CONN_FLAG_MANDATORY_TLS   (1UL << 1)

◆ XMPP_CONN_FLAG_LEGACY_SSL

#define XMPP_CONN_FLAG_LEGACY_SSL   (1UL << 2)

◆ XMPP_CONN_FLAG_TRUST_TLS

#define XMPP_CONN_FLAG_TRUST_TLS   (1UL << 3)

Trust server's certificate even if it is invalid.

◆ XMPP_CONN_FLAG_LEGACY_AUTH

#define XMPP_CONN_FLAG_LEGACY_AUTH   (1UL << 4)

Enable legacy authentication support.

◆ XMPP_CONN_FLAG_DISABLE_SM

#define XMPP_CONN_FLAG_DISABLE_SM   (1UL << 5)

Disable Stream-Management XEP-0198.

◆ XMPP_CONN_FLAG_ENABLE_COMPRESSION

#define XMPP_CONN_FLAG_ENABLE_COMPRESSION   (1UL << 6)

Enable Stream-Compression XEP-0138.

◆ XMPP_CONN_FLAG_COMPRESSION_DONT_RESET

#define XMPP_CONN_FLAG_COMPRESSION_DONT_RESET   (1UL << 7)

Don't reset the compressed stream after each stanza.

Only enable this flag if you know what you're doing.

◆ XMPP_STANZA_NAME_IN_NS

#define XMPP_STANZA_NAME_IN_NS (   name,
  ns 
)    name "[@ns='" ns "']"

◆ XMPP_SHA1_DIGEST_SIZE

#define XMPP_SHA1_DIGEST_SIZE   20

Size of the SHA1 message digest.

◆ XMPP_DEPRECATED

#define XMPP_DEPRECATED (   x)

Formerly "private but exported" functions made public for now to announce deprecation.

Typedef Documentation

◆ xmpp_log_handler

typedef void(* xmpp_log_handler) (void *userdata, xmpp_log_level_t level, const char *area, const char *msg)

◆ xmpp_conn_handler

typedef void(* xmpp_conn_handler) (xmpp_conn_t *conn, xmpp_conn_event_t event, int error, xmpp_stream_error_t *stream_error, void *userdata)

◆ xmpp_timed_handler

typedef int(* xmpp_timed_handler) (xmpp_conn_t *conn, void *userdata)

◆ xmpp_global_timed_handler

typedef int(* xmpp_global_timed_handler) (xmpp_ctx_t *ctx, void *userdata)

◆ xmpp_handler

typedef int(* xmpp_handler) (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)

Enumeration Type Documentation

◆ xmpp_log_level_t

Enumerator
XMPP_LEVEL_DEBUG 
XMPP_LEVEL_INFO 
XMPP_LEVEL_WARN 
XMPP_LEVEL_ERROR 

◆ xmpp_conn_type_t

Enumerator
XMPP_UNKNOWN 
XMPP_CLIENT 
XMPP_COMPONENT 

◆ xmpp_conn_event_t

Enumerator
XMPP_CONN_CONNECT 
XMPP_CONN_RAW_CONNECT 
XMPP_CONN_DISCONNECT 
XMPP_CONN_FAIL 

◆ xmpp_error_type_t

Enumerator
XMPP_SE_BAD_FORMAT 
XMPP_SE_BAD_NS_PREFIX 
XMPP_SE_CONFLICT 
XMPP_SE_CONN_TIMEOUT 
XMPP_SE_HOST_GONE 
XMPP_SE_HOST_UNKNOWN 
XMPP_SE_IMPROPER_ADDR 
XMPP_SE_INTERNAL_SERVER_ERROR 
XMPP_SE_INVALID_FROM 
XMPP_SE_INVALID_ID 
XMPP_SE_INVALID_NS 
XMPP_SE_INVALID_XML 
XMPP_SE_NOT_AUTHORIZED 
XMPP_SE_POLICY_VIOLATION 
XMPP_SE_REMOTE_CONN_FAILED 
XMPP_SE_RESOURCE_CONSTRAINT 
XMPP_SE_RESTRICTED_XML 
XMPP_SE_SEE_OTHER_HOST 
XMPP_SE_SYSTEM_SHUTDOWN 
XMPP_SE_UNDEFINED_CONDITION 
XMPP_SE_UNSUPPORTED_ENCODING 
XMPP_SE_UNSUPPORTED_STANZA_TYPE 
XMPP_SE_UNSUPPORTED_VERSION 
XMPP_SE_XML_NOT_WELL_FORMED 

◆ xmpp_queue_element_t

Enumerator
XMPP_QUEUE_OLDEST 
XMPP_QUEUE_YOUNGEST 

Function Documentation

◆ xmpp_free()

void xmpp_free ( const xmpp_ctx_t *  ctx,
void *  p 
)

Trampoline to strophe_free.

Parameters
ctxstrophe_free
pstrophe_free

◆ xmpp_send_error()

void xmpp_send_error ( xmpp_conn_t *  conn,
xmpp_error_type_t  type,
char *  text 
)

◆ xmpp_jid_new()

char * xmpp_jid_new ( xmpp_ctx_t *  ctx,
const char *  node,
const char *  domain,
const char *  resource 
)

Create a JID string from component parts node, domain, and resource.

Parameters
ctxthe Strophe context object
nodea string representing the node
domaina string representing the domain. Required.
resourcea string representing the resource
Returns
an allocated string with the full JID or NULL if no domain is specified

◆ xmpp_jid_bare()

char * xmpp_jid_bare ( xmpp_ctx_t *  ctx,
const char *  jid 
)

Create a bare JID from a JID.

Parameters
ctxthe Strophe context object
jidthe JID
Returns
an allocated string with the bare JID or NULL on an error

◆ xmpp_jid_node()

char * xmpp_jid_node ( xmpp_ctx_t *  ctx,
const char *  jid 
)

Create a node string from a JID.

Parameters
ctxa Strophe context object
jidthe JID
Returns
an allocated string with the node or NULL if no node is found or an error occurs

◆ xmpp_jid_domain()

char * xmpp_jid_domain ( xmpp_ctx_t *  ctx,
const char *  jid 
)

Create a domain string from a JID.

Parameters
ctxthe Strophe context object
jidthe JID
Returns
an allocated string with the domain or NULL on an error

◆ xmpp_jid_resource()

char * xmpp_jid_resource ( xmpp_ctx_t *  ctx,
const char *  jid 
)

Create a resource string from a JID.

Parameters
ctxa Strophe context object
jidthe JID
Returns
an allocated string with the resource or NULL if no resource is found or an error occurs

◆ xmpp_uuid_gen()

char * xmpp_uuid_gen ( xmpp_ctx_t *  ctx)

Generate UUID version 4.

This function allocates memory for the resulting string and must be freed with xmpp_free().

Parameters
ctxa Strophe context object
Returns
ASCIIZ string

◆ XMPP_DEPRECATED()

XMPP_DEPRECATED ( internal  ) const

◆ xmpp_snprintf()

int xmpp_snprintf ( char *  str,
size_t  count,
const char *  fmt,
  ... 
)

◆ xmpp_vsnprintf()

int xmpp_vsnprintf ( char *  str,
size_t  count,
const char *  fmt,
va_list  arg 
)

◆ xmpp_log()

void xmpp_log ( const xmpp_ctx_t *  ctx,
xmpp_log_level_t  level,
const char *  area,
const char *  fmt,
va_list  ap 
)

Variable Documentation

◆ size

size_t size