xmpp.c File Reference

Kamailio XMPP module ::. More...

#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>

Include dependency graph for xmpp.c:

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


Detailed Description

Kamailio XMPP module ::.

Definition in file xmpp.c.


Define Documentation

#define DB_KEY   "this-be-a-random-key"

Definition at line 118 of file xmpp.c.

#define DEFAULT_COMPONENT_PORT   5347

Definition at line 143 of file xmpp.c.

Referenced by mod_init().

#define DEFAULT_SERVER_PORT   5269

Definition at line 144 of file xmpp.c.

Referenced by mod_init().


Function Documentation

static int cmd_send_message ( struct sip_msg msg,
char *  _foo,
char *  _bar 
) [static]

static int mod_init ( void   )  [static]

static char* shm_strdup ( str src  )  [static]

Definition at line 292 of file xmpp.c.

References _str::len, NULL, _str::s, and shm_malloc().

void xmpp_free_pipe_cmd ( struct xmpp_pipe_cmd cmd  ) 

static void xmpp_process ( int  rank  )  [static]

static int xmpp_send_pipe_cmd ( enum xmpp_pipe_cmd_type  type,
str from,
str to,
str body,
str id 
) [static]

int xmpp_send_sip_msg ( char *  from,
char *  to,
char *  msg 
)

Relay a MESSAGE to a SIP client.

Todo:
This assumes that a message is text/plain, which is not always the case with XMPP messages. We should propably also set the character set, as all SIP clients doesn't assume utf8 for text/plain

< 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().

int xmpp_send_xmessage ( str from,
str to,
str msg,
str id 
)

Definition at line 419 of file xmpp.c.

References NULL, XMPP_PIPE_SEND_MESSAGE, and xmpp_send_pipe_cmd().

Referenced by bind_xmpp().

int xmpp_send_xnotify ( str from,
str to,
str msg,
str id 
)

Definition at line 439 of file xmpp.c.

References NULL, XMPP_PIPE_SEND_PNOTIFY, and xmpp_send_pipe_cmd().

Referenced by bind_xmpp().

int xmpp_send_xpacket ( str from,
str to,
str msg,
str id 
)

Definition at line 409 of file xmpp.c.

References NULL, XMPP_PIPE_SEND_PACKET, and xmpp_send_pipe_cmd().

Referenced by bind_xmpp().

int xmpp_send_xsubscribe ( str from,
str to,
str msg,
str id 
)

Definition at line 429 of file xmpp.c.

References NULL, XMPP_PIPE_SEND_PSUBSCRIBE, and xmpp_send_pipe_cmd().

Referenced by bind_xmpp().


Variable Documentation

char* backend = "component"

Definition at line 133 of file xmpp.c.

Referenced by mod_init(), and xmpp_process().

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}
}

Definition at line 155 of file xmpp.c.

char* domain_sep_str = NULL

Definition at line 134 of file xmpp.c.

Referenced by mod_init().

char domain_separator = '*'

Definition at line 179 of file xmpp.c.

char* gateway_domain = "sip2xmpp.example.net"

Definition at line 136 of file xmpp.c.

Referenced by encode_uri_xmpp_sip().

str outbound_proxy = {0, 0}

Definition at line 141 of file xmpp.c.

param_export_t params[] [static]

Definition at line 164 of file xmpp.c.

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}
}

Definition at line 146 of file xmpp.c.

MODULE_VERSION struct tm_binds tmb

char* xmpp_domain = "xmpp2sip.example.net"

char* xmpp_host = "xmpp.example.com"

Definition at line 138 of file xmpp.c.

Referenced by xmpp_component_child_process().

char* xmpp_password = "secret"

Definition at line 140 of file xmpp.c.

Referenced by stream_node_callback().

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().


Generated on Fri May 25 00:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6