Asterisk - The Open Source Telephony Project
18.5.0
|
XMPP Interface. More...
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <iksemel.h>
#include "asterisk/utils.h"
#include "asterisk/astobj2.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h"
#include "asterisk/pbx.h"
#include "asterisk/stasis.h"
Go to the source code of this file.
Data Structures | |
struct | ast_xmpp_buddy |
XMPP Buddy. More... | |
struct | ast_xmpp_capabilities |
Resource capabilities. More... | |
struct | ast_xmpp_client |
XMPP Client Connection. More... | |
struct | ast_xmpp_message |
XMPP Message. More... | |
struct | ast_xmpp_resource |
XMPP Resource. More... | |
Macros | |
#define | IKS_NET_EXPIRED 12 |
#define | NET_IO_BUF_SIZE 16384 |
#define | XMPP_MAX_ATTRLEN 256 |
Maximum size of an attribute. More... | |
#define | XMPP_MAX_JIDLEN 3071 |
#define | XMPP_MAX_RESJIDLEN 1023 |
Maximum size of a resource JID. More... | |
Enumerations | |
enum | xmpp_state { XMPP_STATE_DISCONNECTING, XMPP_STATE_DISCONNECTED, XMPP_STATE_CONNECTING, XMPP_STATE_REQUEST_TLS, XMPP_STATE_REQUESTED_TLS, XMPP_STATE_AUTHENTICATE, XMPP_STATE_AUTHENTICATING, XMPP_STATE_ROSTER, XMPP_STATE_CONNECTED } |
Client connection states. More... | |
Functions | |
int | ast_xmpp_chatroom_invite (struct ast_xmpp_client *client, const char *user, const char *room, const char *message) |
Invite a user to an XMPP multi-user chatroom. More... | |
int | ast_xmpp_chatroom_join (struct ast_xmpp_client *client, const char *room, const char *nickname) |
Join an XMPP multi-user chatroom. More... | |
int | ast_xmpp_chatroom_leave (struct ast_xmpp_client *client, const char *room, const char *nickname) |
Leave an XMPP multi-user chatroom. More... | |
int | ast_xmpp_chatroom_send (struct ast_xmpp_client *client, const char *nickname, const char *address, const char *message) |
Send a message to an XMPP multi-user chatroom. More... | |
int | ast_xmpp_client_disconnect (struct ast_xmpp_client *client) |
Disconnect an XMPP client connection. More... | |
struct ast_xmpp_client * | ast_xmpp_client_find (const char *name) |
Find an XMPP client connection using a given name. More... | |
void | ast_xmpp_client_lock (struct ast_xmpp_client *client) |
Lock an XMPP client connection. More... | |
int | ast_xmpp_client_send (struct ast_xmpp_client *client, iks *stanza) |
Send an XML stanza out using an established XMPP client connection. More... | |
int | ast_xmpp_client_send_message (struct ast_xmpp_client *client, const char *user, const char *message) |
Send a message to a given user using an established XMPP client connection. More... | |
void | ast_xmpp_client_unlock (struct ast_xmpp_client *client) |
Unlock an XMPP client connection. More... | |
void | ast_xmpp_client_unref (struct ast_xmpp_client *client) |
Release XMPP client connection reference. More... | |
void | ast_xmpp_increment_mid (char *mid) |
Helper function which increments the message identifier. More... | |
XMPP Interface.
Definition in file xmpp.h.
#define IKS_NET_EXPIRED 12 |
Definition at line 41 of file xmpp.h.
Referenced by xmpp_client_receive(), and xmpp_client_thread().
#define NET_IO_BUF_SIZE 16384 |
Definition at line 38 of file xmpp.h.
Referenced by xmpp_client_receive().
#define XMPP_MAX_ATTRLEN 256 |
Maximum size of an attribute.
Definition at line 68 of file xmpp.h.
Referenced by xmpp_action_hook().
#define XMPP_MAX_JIDLEN 3071 |
Definition at line 62 of file xmpp.h.
Referenced by acf_jabberreceive_read(), xmpp_client_send_message(), and xmpp_client_set_group_presence().
#define XMPP_MAX_RESJIDLEN 1023 |
Maximum size of a resource JID.
Definition at line 65 of file xmpp.h.
Referenced by xmpp_join_exec(), xmpp_leave_exec(), and xmpp_sendgroup_exec().
enum xmpp_state |
Client connection states.
int ast_xmpp_chatroom_invite | ( | struct ast_xmpp_client * | client, |
const char * | user, | ||
const char * | room, | ||
const char * | message | ||
) |
Invite a user to an XMPP multi-user chatroom.
client | Pointer to the client |
user | JID of the user |
room | Name of the chatroom |
message | Message to send with the invitation |
0 | on success |
-1 | on failure |
Definition at line 937 of file res_xmpp.c.
References ast_xmpp_client_lock(), ast_xmpp_client_send(), ast_xmpp_client_unlock(), ast_xmpp_increment_mid(), done, ast_xmpp_client::mid, and NULL.
int ast_xmpp_chatroom_join | ( | struct ast_xmpp_client * | client, |
const char * | room, | ||
const char * | nickname | ||
) |
Join an XMPP multi-user chatroom.
client | Pointer to the client |
room | Name of the chatroom |
nickname | Nickname to use |
0 | on success |
-1 | on failure |
Definition at line 1004 of file res_xmpp.c.
References xmpp_client_set_group_presence().
Referenced by xmpp_join_exec().
int ast_xmpp_chatroom_leave | ( | struct ast_xmpp_client * | client, |
const char * | room, | ||
const char * | nickname | ||
) |
Leave an XMPP multi-user chatroom.
client | Pointer to the client |
room | Name of the chatroom |
nickname | Nickname being used |
0 | on success |
-1 | on failure |
Definition at line 1014 of file res_xmpp.c.
References xmpp_client_set_group_presence().
Referenced by xmpp_leave_exec().
int ast_xmpp_chatroom_send | ( | struct ast_xmpp_client * | client, |
const char * | nickname, | ||
const char * | address, | ||
const char * | message | ||
) |
Send a message to an XMPP multi-user chatroom.
client | Pointer to the client |
nickname | Nickname to use |
address | Address of the room |
message | Message itself |
0 | on success |
-1 | on failure |
Definition at line 1009 of file res_xmpp.c.
References xmpp_client_send_message().
Referenced by xmpp_sendgroup_exec().
int ast_xmpp_client_disconnect | ( | struct ast_xmpp_client * | client | ) |
Disconnect an XMPP client connection.
client | Pointer to the client |
0 | on success |
-1 | on failure |
Definition at line 3528 of file res_xmpp.c.
References AST_PTHREADT_NULL, ast_xmpp_client::device_state_sub, ast_xmpp_client::mwi_sub, NULL, ast_xmpp_client::parser, ast_xmpp_client::ssl_context, ast_xmpp_client::ssl_session, stasis_unsubscribe_and_join(), ast_xmpp_client::stream_flags, ast_xmpp_client::thread, xmpp_client_change_state(), xmpp_pubsub_unsubscribe(), XMPP_STATE_DISCONNECTED, and XMPP_STATE_DISCONNECTING.
Referenced by xmpp_client_config_post_apply(), xmpp_client_destructor(), xmpp_client_reconnect(), and xmpp_client_thread().
struct ast_xmpp_client* ast_xmpp_client_find | ( | const char * | name | ) |
Find an XMPP client connection using a given name.
name | Name of the client connection |
non-NULL | on success |
NULL | on failure |
Definition at line 875 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_ref, globals, NULL, RAII_VAR, and xmpp_config_find().
Referenced by custom_connection_handler().
void ast_xmpp_client_lock | ( | struct ast_xmpp_client * | client | ) |
Lock an XMPP client connection.
client | Pointer to the client |
Definition at line 893 of file res_xmpp.c.
References ao2_lock.
Referenced by ast_xmpp_chatroom_invite(), xmpp_client_authenticate_digest(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_component_register_set_hook(), xmpp_pak_message(), xmpp_ping_request(), and xmpp_pubsub_iq_create().
int ast_xmpp_client_send | ( | struct ast_xmpp_client * | client, |
iks * | stanza | ||
) |
Send an XML stanza out using an established XMPP client connection.
client | Pointer to the client |
stanza | Pointer to the Iksemel stanza |
0 | on success |
-1 | on failure |
Definition at line 2537 of file res_xmpp.c.
References xmpp_client_send_raw_message().
Referenced by ast_xmpp_chatroom_invite(), jingle_send_error_response(), jingle_send_response(), jingle_send_session_action(), jingle_send_session_info(), jingle_send_session_terminate(), jingle_send_transport_info(), xmpp_client_authenticate_digest(), xmpp_client_authenticate_sasl(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_client_send_message(), xmpp_client_service_discovery_get_hook(), xmpp_client_set_group_presence(), xmpp_client_set_presence(), xmpp_client_subscribe_user(), xmpp_client_unsubscribe_user(), xmpp_component_register_get_hook(), xmpp_component_register_set_hook(), xmpp_component_service_discovery_get_hook(), xmpp_component_service_discovery_items_hook(), xmpp_connect_hook(), xmpp_pak_s10n(), xmpp_ping_request(), xmpp_pubsub_create_affiliations(), xmpp_pubsub_create_node(), xmpp_pubsub_delete_node(), xmpp_pubsub_handle_error(), xmpp_pubsub_publish_device_state(), xmpp_pubsub_publish_mwi(), xmpp_pubsub_purge_nodes(), xmpp_pubsub_request_nodes(), xmpp_pubsub_subscribe(), and xmpp_pubsub_unsubscribe().
int ast_xmpp_client_send_message | ( | struct ast_xmpp_client * | client, |
const char * | user, | ||
const char * | message | ||
) |
Send a message to a given user using an established XMPP client connection.
client | Pointer to the client |
user | User the message should be sent to |
message | The message to send |
0 | on success |
-1 | on failure |
Definition at line 932 of file res_xmpp.c.
References NULL, and xmpp_client_send_message().
Referenced by jingle_sendtext(), manager_jabber_send(), xmpp_send_cb(), and xmpp_send_exec().
void ast_xmpp_client_unlock | ( | struct ast_xmpp_client * | client | ) |
Unlock an XMPP client connection.
client | Pointer to the client |
Definition at line 898 of file res_xmpp.c.
References ao2_unlock.
Referenced by ast_xmpp_chatroom_invite(), xmpp_client_authenticate_digest(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_component_register_set_hook(), xmpp_pak_message(), xmpp_ping_request(), and xmpp_pubsub_iq_create().
void ast_xmpp_client_unref | ( | struct ast_xmpp_client * | client | ) |
Release XMPP client connection reference.
client | Pointer to the client |
Definition at line 888 of file res_xmpp.c.
References ao2_ref.
Referenced by jingle_endpoint_destructor(), and jingle_session_destructor().
void ast_xmpp_increment_mid | ( | char * | mid | ) |
Helper function which increments the message identifier.
mid | Pointer to a string containing the message identifier |
Definition at line 1019 of file res_xmpp.c.
Referenced by ast_xmpp_chatroom_invite(), jingle_send_session_action(), jingle_send_session_info(), jingle_send_session_terminate(), jingle_send_transport_info(), xmpp_client_authenticate_digest(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_component_register_set_hook(), xmpp_ping_request(), and xmpp_pubsub_iq_create().