#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "../../sr_module.h"
#include "xmpp.h"
#include "xmpp_api.h"
#include "network.h"
#include "xode.h"
#include <arpa/inet.h>

Go to the source code of this file.
Data Structures | |
| struct | xmpp_connection |
| struct | xmpp_private_data |
Defines | |
| #define | CONN_DEAD 0 |
| #define | CONN_INBOUND 1 |
| #define | CONN_OUTBOUND 2 |
| #define | DB_KEY "this-be-a-random-key" |
Functions | |
| static struct xmpp_connection * | conn_find_domain (char *domain, int type) |
| static void | conn_free (struct xmpp_connection *conn) |
| static struct xmpp_connection * | conn_new (int type, int fd, char *domain) |
| static void | do_send_message_server (struct xmpp_pipe_cmd *cmd) |
| static void | in_stream_node_callback (int type, xode node, void *arg) |
| static void | out_stream_node_callback (int type, xode node, void *arg) |
| int | xmpp_server_child_process (int data_pipe) |
| static int | xode_send (int fd, xode x) |
| static int | xode_send_domain (char *domain, xode x) |
Variables | |
| static struct xmpp_connection * | conn_list = NULL |
| static char | local_secret [64] = { 0, } |
Definition in file xmpp_server.c.
| #define CONN_DEAD 0 |
Definition at line 105 of file xmpp_server.c.
Referenced by in_stream_node_callback(), out_stream_node_callback(), and xmpp_server_child_process().
| #define CONN_INBOUND 1 |
Definition at line 106 of file xmpp_server.c.
Referenced by conn_new(), out_stream_node_callback(), and xmpp_server_child_process().
| #define CONN_OUTBOUND 2 |
Definition at line 107 of file xmpp_server.c.
Referenced by xmpp_server_child_process(), and xode_send_domain().
| #define DB_KEY "this-be-a-random-key" |
Definition at line 103 of file xmpp_server.c.
| static struct xmpp_connection* conn_find_domain | ( | char * | domain, | |
| int | type | |||
| ) | [static, read] |
Definition at line 188 of file xmpp_server.c.
References xmpp_connection::domain, xmpp_connection::next, NULL, and xmpp_connection::type.
Referenced by out_stream_node_callback(), and xode_send_domain().
| static void conn_free | ( | struct xmpp_connection * | conn | ) | [static] |
Definition at line 163 of file xmpp_server.c.
References xmpp_connection::domain, xmpp_connection::fd, xmpp_connection::next, xmpp_connection::pool, xmpp_connection::stream_id, xmpp_connection::todo, xode_free(), and xode_pool_free().
Referenced by xmpp_server_child_process().
| static struct xmpp_connection* conn_new | ( | int | type, | |
| int | fd, | |||
| char * | domain | |||
| ) | [static, read] |
Definition at line 135 of file xmpp_server.c.
References CONN_INBOUND, xmpp_connection::domain, xmpp_connection::fd, in_stream_node_callback(), LM_ERR, xmpp_connection::next, NULL, out_stream_node_callback(), xmpp_connection::pool, xmpp_connection::stream, xmpp_connection::todo, xmpp_connection::type, xode_new_tag(), xode_pool_new(), and xode_stream_new().
Referenced by xmpp_server_child_process(), and xode_send_domain().
| static void do_send_message_server | ( | struct xmpp_pipe_cmd * | cmd | ) | [static] |
Definition at line 431 of file xmpp_server.c.
References xmpp_pipe_cmd::body, decode_uri_sip_xmpp(), domain, encode_uri_sip_xmpp(), extract_domain(), xmpp_pipe_cmd::from, xmpp_pipe_cmd::id, LM_DBG, xmpp_pipe_cmd::to, xode_insert_cdata(), xode_insert_tag(), xode_new_tag(), xode_put_attrib(), and xode_send_domain().
Referenced by xmpp_server_child_process().
| static void in_stream_node_callback | ( | int | type, | |
| xode | node, | |||
| void * | arg | |||
| ) | [static] |
Definition at line 319 of file xmpp_server.c.
References CONN_DEAD, db_key(), decode_uri_xmpp_sip(), xmpp_connection::domain, encode_uri_xmpp_sip(), xmpp_connection::fd, LM_DBG, LM_ERR, local_secret, net_printf(), random_secret(), xmpp_connection::stream_id, xmpp_connection::type, xmpp_domain, xmpp_send_sip_msg(), xode_free(), xode_get_attrib(), xode_get_data(), xode_get_name(), xode_get_tag(), xode_insert_cdata(), xode_new_tag(), xode_put_attrib(), xode_send(), xode_send_domain(), XODE_STREAM_CLOSE, XODE_STREAM_ERROR, XODE_STREAM_NODE, and XODE_STREAM_ROOT.
Referenced by conn_new().
| static void out_stream_node_callback | ( | int | type, | |
| xode | node, | |||
| void * | arg | |||
| ) | [static] |
Definition at line 242 of file xmpp_server.c.
References CONN_DEAD, conn_find_domain(), CONN_INBOUND, db_key(), xmpp_connection::domain, xmpp_connection::fd, LM_DBG, LM_ERR, local_secret, NULL, xmpp_connection::todo, xmpp_connection::type, xmpp_domain, xode_free(), xode_get_attrib(), xode_get_firstchild(), xode_get_name(), xode_get_nextsibling(), xode_insert_cdata(), xode_new_tag(), xode_put_attrib(), xode_send(), XODE_STREAM_CLOSE, XODE_STREAM_ERROR, XODE_STREAM_NODE, and XODE_STREAM_ROOT.
Referenced by conn_new().
| int xmpp_server_child_process | ( | int | data_pipe | ) |
Definition at line 450 of file xmpp_server.c.
References buf, CONN_DEAD, conn_free(), CONN_INBOUND, conn_new(), CONN_OUTBOUND, do_send_message_server(), xmpp_connection::domain, xmpp_connection::fd, len, LM_DBG, LM_ERR, local_secret, net_connect(), net_listen(), net_printf(), net_read_static(), xmpp_connection::next, NULL, random_secret(), snprintf, xmpp_connection::stream, xmpp_pipe_cmd::type, xmpp_connection::type, xmpp_domain, xmpp_free_pipe_cmd(), XMPP_PIPE_SEND_MESSAGE, XMPP_PIPE_SEND_PACKET, XMPP_PIPE_SEND_PNOTIFY, XMPP_PIPE_SEND_PSUBSCRIBE, xmpp_port, and xode_stream_eat().
Referenced by xmpp_process().
| static int xode_send | ( | int | fd, | |
| xode | x | |||
| ) | [static] |
Definition at line 213 of file xmpp_server.c.
References len, LM_DBG, LM_ERR, net_send(), and xode_to_str().
| static int xode_send_domain | ( | char * | domain, | |
| xode | x | |||
| ) | [static] |
Definition at line 227 of file xmpp_server.c.
References conn_find_domain(), conn_new(), CONN_OUTBOUND, xmpp_connection::fd, xmpp_connection::todo, xode_free(), xode_insert_node(), and xode_send().
Referenced by do_send_message_server(), and in_stream_node_callback().
struct xmpp_connection* conn_list = NULL [static] |
Definition at line 133 of file xmpp_server.c.
char local_secret[64] = { 0, } [static] |
Definition at line 128 of file xmpp_server.c.
Referenced by in_stream_node_callback(), out_stream_node_callback(), and xmpp_server_child_process().
1.5.6