xjab_util.c File Reference

#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include "../../dprint.h"
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "../../timer.h"
#include "xjab_util.h"
#include "xjab_jcon.h"
#include "mdefines.h"

Include dependency graph for xjab_util.c:

Go to the source code of this file.

Functions

int xj_jcon_pool_add (xj_jcon_pool jcp, xj_jcon jc)
int xj_jcon_pool_add_jmsg (xj_jcon_pool jcp, xj_sipmsg _jsm, xj_jcon _ojc)
int xj_jcon_pool_del (xj_jcon_pool jcp, xj_jkey jkey)
int xj_jcon_pool_del_jmsg (xj_jcon_pool jcp, int idx)
void xj_jcon_pool_free (xj_jcon_pool jcp)
xj_jcon xj_jcon_pool_get (xj_jcon_pool jcp, xj_jkey jkey)
xj_jcon_pool xj_jcon_pool_init (int size, int jlen, int ch)


Function Documentation

int xj_jcon_pool_add ( xj_jcon_pool  jcp,
xj_jcon  jc 
)

add a new connection in pool

  • jcp : pointer to the Jabber connections pool structure return : 0 on success or <0 on error

Definition at line 149 of file xjab_util.c.

References _xj_jcon_pool::len, len, LM_DBG, NULL, and _xj_jcon_pool::ojc.

Referenced by xj_worker_process().

int xj_jcon_pool_add_jmsg ( xj_jcon_pool  jcp,
xj_sipmsg  _jsm,
xj_jcon  _ojc 
)

add a new element in messages queue

  • jcp : pointer to the Jabber connections pool structure
  • _jsm : pointer to the message
  • _ojc : pointer to the Jabber connection that will be used for this message return : 0 on success or <0 on error

Definition at line 101 of file xjab_util.c.

References _xj_jmsg_queue::cache, _xj_jmsg_queue::expire, get_ticks(), _xj_jcon_pool::jmqueue, _xj_jmsg_queue::jsm, _xj_jmsg_queue::len, LM_DBG, NULL, _xj_jmsg_queue::ojc, and _xj_jmsg_queue::size.

Referenced by xj_worker_process().

int xj_jcon_pool_del ( xj_jcon_pool  jcp,
xj_jkey  jkey 
)

remove the connection associated with 'id' from pool

  • jcp : pointer to the Jabber connections pool structure
  • id : id of the Jabber connection return : 0 on success or <0 on error

Definition at line 205 of file xjab_util.c.

References _xj_jkey::hash, _xj_jkey::id, _xj_jcon::jkey, _str::len, len, LM_DBG, NULL, _xj_jcon_pool::ojc, _str::s, and xj_jcon_free().

int xj_jcon_pool_del_jmsg ( xj_jcon_pool  jcp,
int  idx 
)

delete first element from messages queue

  • jcp : pointer to the Jabber connections pool structure return : 0 on success or <0 on error

Definition at line 131 of file xjab_util.c.

References _xj_jcon_pool::jmqueue, _xj_jmsg_queue::jsm, NULL, _xj_jmsg_queue::ojc, and _xj_jmsg_queue::size.

Referenced by xj_worker_check_qmsg().

void xj_jcon_pool_free ( xj_jcon_pool  jcp  ) 

free a Jabber connections pool structure

  • jcp : pointer to the Jabber connections pool structure

Definition at line 233 of file xjab_util.c.

References _M_FREE, _xj_jmsg_queue::expire, _xj_jcon_pool::jmqueue, _xj_jmsg_queue::jsm, _xj_jcon_pool::len, LM_DBG, NULL, _xj_jmsg_queue::ojc, _xj_jcon_pool::ojc, and xj_jcon_free().

xj_jcon xj_jcon_pool_get ( xj_jcon_pool  jcp,
xj_jkey  jkey 
)

get the jabber connection associated with 'id'

  • jcp : pointer to the Jabber connections pool structure
  • id : id of the Jabber connection return : pointer to the open connection to Jabber structure or NULL on error

Definition at line 173 of file xjab_util.c.

References _xj_jkey::hash, _xj_jkey::id, _xj_jcon::jkey, len, _str::len, LM_DBG, NULL, _xj_jcon_pool::ojc, and _str::s.

Referenced by xj_worker_process().

xj_jcon_pool xj_jcon_pool_init ( int  size,
int  jlen,
int  ch 
)

init a jc_pool structure

  • size : maximum number of the open connection to Jabber
  • jlen : maximum size of messages queue return : pointer to the structure or NULL on error

Definition at line 48 of file xjab_util.c.

References _M_FREE, _M_MALLOC, _xj_jmsg_queue::cache, _xj_jmsg_queue::expire, _xj_jcon_pool::jmqueue, _xj_jmsg_queue::jsm, _xj_jmsg_queue::len, _xj_jcon_pool::len, NULL, _xj_jmsg_queue::ojc, _xj_jcon_pool::ojc, and _xj_jmsg_queue::size.

Referenced by xj_worker_process().


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