#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "../../sr_module.h"
#include "../../mem/mem.h"
#include "../../data_lump_rpl.h"
#include "../../parser/msg_parser.h"
#include "../../parser/parse_content.h"
#include "../../parser/parse_from.h"
#include "../tm/tm_load.h"
#include "xode.h"
#include "xmpp.h"
#include "network.h"
#include "xmpp_api.h"
#include <arpa/inet.h>

Go to the source code of this file.
Defines | |
| #define | DB_KEY "this-be-a-random-key" |
| #define | DEFAULT_COMPONENT_PORT 5347 |
| #define | DEFAULT_SERVER_PORT 5269 |
Functions | |
| static int | cmd_send_message (struct sip_msg *msg, char *_foo, char *_bar) |
| static int | mod_init (void) |
| static char * | shm_strdup (str *src) |
| void | xmpp_free_pipe_cmd (struct xmpp_pipe_cmd *cmd) |
| static void | xmpp_process (int rank) |
| static int | xmpp_send_pipe_cmd (enum xmpp_pipe_cmd_type type, str *from, str *to, str *body, str *id) |
| int | xmpp_send_sip_msg (char *from, char *to, char *msg) |
| Relay a MESSAGE to a SIP client. | |
| int | xmpp_send_xmessage (str *from, str *to, str *msg, str *id) |
| int | xmpp_send_xnotify (str *from, str *to, str *msg, str *id) |
| int | xmpp_send_xpacket (str *from, str *to, str *msg, str *id) |
| int | xmpp_send_xsubscribe (str *from, str *to, str *msg, str *id) |
Variables | |
| char * | backend = "component" |
| static cmd_export_t | cmds [] |
| char * | domain_sep_str = NULL |
| char | domain_separator = '*' |
| struct module_exports | exports |
| char * | gateway_domain = "sip2xmpp.example.net" |
| str | outbound_proxy = {0, 0} |
| static param_export_t | params [] |
| static int | pipe_fds [2] = {-1,-1} |
| static proc_export_t | procs [] |
| MODULE_VERSION struct tm_binds | tmb |
| char * | xmpp_domain = "xmpp2sip.example.net" |
| char * | xmpp_host = "xmpp.example.com" |
| char * | xmpp_password = "secret" |
| int | xmpp_port = 0 |
Definition in file xmpp.c.
| #define DEFAULT_COMPONENT_PORT 5347 |
| #define DEFAULT_SERVER_PORT 5269 |
| static int cmd_send_message | ( | struct sip_msg * | msg, | |
| char * | _foo, | |||
| char * | _bar | |||
| ) | [static] |
Definition at line 341 of file xmpp.c.
References xmpp_pipe_cmd::body, sip_msg::content_length, sip_msg::first_line, sip_msg::from, get_body(), get_content_length, HDR_FROM_F, HDR_TO_F, _str::len, LM_DBG, LM_ERR, sip_msg::new_uri, parse_content_type_hdr(), parse_from_header(), parse_headers(), hdr_field::parsed, msg_start::request, _str::s, SUBTYPE_CPIM, SUBTYPE_PLAIN, sip_msg::to, TYPE_MESSAGE, TYPE_TEXT, msg_start::u, XMPP_PIPE_SEND_MESSAGE, and xmpp_send_pipe_cmd().
| static int mod_init | ( | void | ) | [static] |
Definition at line 197 of file xmpp.c.
References backend, DEFAULT_COMPONENT_PORT, DEFAULT_SERVER_PORT, domain_sep_str, domain_separator, init_xmpp_cb_list(), _str::len, LM_ERR, load_tm_api(), pipe_fds, _str::s, tmb, and xmpp_port.
| static char* shm_strdup | ( | str * | src | ) | [static] |
| void xmpp_free_pipe_cmd | ( | struct xmpp_pipe_cmd * | cmd | ) |
Definition at line 305 of file xmpp.c.
References xmpp_pipe_cmd::body, xmpp_pipe_cmd::from, xmpp_pipe_cmd::id, shm_free, and xmpp_pipe_cmd::to.
Referenced by xmpp_component_child_process(), xmpp_send_pipe_cmd(), and xmpp_server_child_process().
| static void xmpp_process | ( | int | rank | ) | [static] |
Definition at line 237 of file xmpp.c.
References backend, LM_DBG, pipe_fds, xmpp_component_child_process(), and xmpp_server_child_process().
| static int xmpp_send_pipe_cmd | ( | enum xmpp_pipe_cmd_type | type, | |
| str * | from, | |||
| str * | to, | |||
| str * | body, | |||
| str * | id | |||
| ) | [static] |
Definition at line 318 of file xmpp.c.
References xmpp_pipe_cmd::body, xmpp_pipe_cmd::from, xmpp_pipe_cmd::id, LM_ERR, pipe_fds, shm_malloc(), shm_strdup(), xmpp_pipe_cmd::to, xmpp_pipe_cmd::type, and xmpp_free_pipe_cmd().
Referenced by cmd_send_message(), xmpp_send_xmessage(), xmpp_send_xnotify(), xmpp_send_xpacket(), and xmpp_send_xsubscribe().
| int xmpp_send_sip_msg | ( | char * | from, | |
| char * | to, | |||
| char * | msg | |||
| ) |
Relay a MESSAGE to a SIP client.
< Type of the message
< Request-URI
< To
< From
< Optional headers
< Message body
< Callback function
< Callback parameter
Definition at line 259 of file xmpp.c.
References buf, CRLF, _str::len, msg_type, NULL, _str::s, snprintf, tm_binds::t_request, and tmb.
Referenced by in_stream_node_callback(), and stream_node_callback().
Definition at line 419 of file xmpp.c.
References NULL, XMPP_PIPE_SEND_MESSAGE, and xmpp_send_pipe_cmd().
Referenced by bind_xmpp().
Definition at line 439 of file xmpp.c.
References NULL, XMPP_PIPE_SEND_PNOTIFY, and xmpp_send_pipe_cmd().
Referenced by bind_xmpp().
Definition at line 409 of file xmpp.c.
References NULL, XMPP_PIPE_SEND_PACKET, and xmpp_send_pipe_cmd().
Referenced by bind_xmpp().
Definition at line 429 of file xmpp.c.
References NULL, XMPP_PIPE_SEND_PSUBSCRIBE, and xmpp_send_pipe_cmd().
Referenced by bind_xmpp().
| char* backend = "component" |
cmd_export_t cmds[] [static] |
Initial value:
{
{"xmpp_send_message", (cmd_function)cmd_send_message, 0, 0, 0, REQUEST_ROUTE},
{"bind_xmpp", (cmd_function)bind_xmpp, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}
}
| char* domain_sep_str = NULL |
| char domain_separator = '*' |
Definition at line 135 of file xmpp.c.
Referenced by decode_uri_sip_xmpp(), decode_uri_xmpp_sip(), encode_uri_sip_xmpp(), encode_uri_xmpp_sip(), and mod_init().
| struct module_exports exports |
| char* gateway_domain = "sip2xmpp.example.net" |
| str outbound_proxy = {0, 0} |
param_export_t params[] [static] |
int pipe_fds[2] = {-1,-1} [static] |
Definition at line 128 of file xmpp.c.
Referenced by mod_init(), xmpp_process(), and xmpp_send_pipe_cmd().
proc_export_t procs[] [static] |
Initial value:
{
{"XMPP receiver", 0, 0, xmpp_process, 1 },
{0,0,0,0,0}
}
TM bind
Definition at line 122 of file xmpp.c.
Referenced by acc_onreq(), ds_check_timer(), get_reply_totag(), global_init(), imc_handle_help(), imc_handle_invite(), imc_handle_unknown(), imc_inv_callback(), imc_send_message(), init(), m_dump(), m_send_ontimer(), m_store(), mod_init(), purple_send_sip_msg(), pv_get_uac_req(), pv_set_uac_req(), rls_send_notify(), send_notify_request(), send_publish(), send_reply(), send_sip_msg_request(), send_sip_options_request(), send_subscribe(), trace_onreq_in(), uac_req_init(), uac_req_send(), update_pua(), xj_send_sip_msg(), and xmpp_send_sip_msg().
| char* xmpp_domain = "xmpp2sip.example.net" |
Definition at line 137 of file xmpp.c.
Referenced by encode_uri_sip_xmpp(), in_stream_node_callback(), out_stream_node_callback(), xmpp_component_child_process(), and xmpp_server_child_process().
| char* xmpp_host = "xmpp.example.com" |
| char* xmpp_password = "secret" |
| int xmpp_port = 0 |
Definition at line 139 of file xmpp.c.
Referenced by mod_init(), xmpp_component_child_process(), and xmpp_server_child_process().
1.5.6