xjab_wlist.c File Reference

#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include "../../dprint.h"
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "xjab_worker.h"
#include "mdefines.h"

Include dependency graph for xjab_wlist.c:

Go to the source code of this file.

Defines

#define XJ_DEF_JDELIM   '*'

Functions

int xj_wlist_check (xj_wlist jwl, xj_jkey jkey, xj_jkey *p)
int xj_wlist_check_aliases (xj_wlist jwl, str *addr)
void xj_wlist_del (xj_wlist jwl, xj_jkey jkey, int _pid)
void xj_wlist_free (xj_wlist jwl)
int xj_wlist_get (xj_wlist jwl, xj_jkey jkey, xj_jkey *p)
xj_wlist xj_wlist_init (int **pipes, int size, int max, int cache_time, int sleep_time, int delay_time)
int xj_wlist_set_aliases (xj_wlist jwl, char *als, char *jd, char *pa)
int xj_wlist_set_flag (xj_wlist jwl, xj_jkey jkey, int fl)
int xj_wlist_set_pid (xj_wlist jwl, int pid, int idx)


Define Documentation

#define XJ_DEF_JDELIM   '*'

Definition at line 45 of file xjab_wlist.c.

Referenced by xj_wlist_set_aliases().


Function Documentation

int xj_wlist_check ( xj_wlist  jwl,
xj_jkey  jkey,
xj_jkey p 
)

return communication pipe with the worker that will process the message for the id 'sid' only if it exists, or -1 if error

  • jwl : pointer to the workers list
  • sid : id of the entity (connection to Jabber - usually SHOULD be FROM header of the incoming SIP message)
  • p : will point to the SHM location of the 'sid' in jwl

Definition at line 205 of file xjab_wlist.c.

References find234(), _xj_jkey::id, _str::len, len, LM_DBG, NULL, _xj_worker::pid, _str::s, _xj_wlist::sems, _xj_worker::sip_ids, _xj_wlist::workers, and _xj_worker::wpipe.

Referenced by xjab_manage_sipmsg().

int xj_wlist_check_aliases ( xj_wlist  jwl,
str addr 
)

check if the addr contains jdomain or an alias

  • jwl : pointer to the workers list
  • addr: the address to check against jdomain and aliases returns 0 - if contains or !=0 if not

Definition at line 582 of file xjab_wlist.c.

References _xj_jalias::a, _xj_wlist::aliases, _xj_jalias::jdm, _str::len, s, _str::s, and _xj_jalias::size.

Referenced by xjab_manage_sipmsg().

void xj_wlist_del ( xj_wlist  jwl,
xj_jkey  jkey,
int  _pid 
)

delete an entity from working list of a worker

  • jwl : pointer to the workers list
  • sid : id of the entity (connection to Jabber - usually SHOULD be FROM header of the incoming SIP message
  • _pid : process id of the worker

Definition at line 628 of file xjab_wlist.c.

References del234(), _xj_jkey::id, _str::len, _xj_wlist::len, LM_DBG, _xj_worker::nr, NULL, _xj_worker::pid, _str::s, _xj_wlist::sems, _xj_worker::sip_ids, _xj_wlist::workers, and xj_jkey_free_p().

Referenced by xj_worker_check_jcons(), and xj_worker_process().

void xj_wlist_free ( xj_wlist  jwl  ) 

int xj_wlist_get ( xj_wlist  jwl,
xj_jkey  jkey,
xj_jkey p 
)

return communication pipe with the worker that will process the message for the id 'sid', or -1 if error

  • jwl : pointer to the workers list
  • sid : id of the entity (connection to Jabber - usually SHOULD be FROM header of the incoming SIP message)
  • p : will point to the SHM location of the 'sid' in jwl

Definition at line 250 of file xjab_wlist.c.

References _M_SHM_FREE, _M_SHM_MALLOC, add234(), find234(), _xj_jkey::flag, _xj_jkey::hash, _xj_jkey::id, _str::len, len, LM_DBG, _xj_wlist::maxj, min, _xj_worker::nr, NULL, _xj_worker::pid, _str::s, _xj_wlist::sems, _xj_worker::sip_ids, _xj_wlist::workers, _xj_worker::wpipe, and XJ_FLAG_OPEN.

Referenced by xj_register_watcher(), and xjab_manage_sipmsg().

xj_wlist xj_wlist_init ( int **  pipes,
int  size,
int  max,
int  cache_time,
int  sleep_time,
int  delay_time 
)

init a workers list

  • pipes : communication pipes
  • size : size of list - number of workers
  • max : maximum number of jobs per worker return : pointer to workers list or NULL on error

Definition at line 54 of file xjab_wlist.c.

References _M_SHM_FREE, _M_SHM_MALLOC, _xj_wlist::aliases, _xj_wlist::cachet, _xj_wlist::delayt, free2tree234(), jwl, _xj_wlist::len, LM_CRIT, LM_DBG, _xj_wlist::maxj, newtree234(), _xj_worker::nr, NULL, _xj_worker::pid, _xj_worker::rpipe, _xj_wlist::sems, _xj_worker::sip_ids, _xj_wlist::sleept, _xj_wlist::workers, _xj_worker::wpipe, xj_jkey_cmp(), and xj_jkey_free_p().

Referenced by mod_init().

int xj_wlist_set_aliases ( xj_wlist  jwl,
char *  als,
char *  jd,
char *  pa 
)

set IM aliases, jdomain and outbound proxy

return 0 if OK

Definition at line 392 of file xjab_wlist.c.

References _M_SHM_FREE, _M_SHM_MALLOC, _xj_jalias::a, _xj_wlist::aliases, _xj_jalias::d, _xj_jalias::dlm, _xj_jalias::jdm, _str::len, LM_DBG, NULL, _xj_jalias::proxy, _str::s, _xj_jalias::size, and XJ_DEF_JDELIM.

Referenced by mod_init().

int xj_wlist_set_flag ( xj_wlist  jwl,
xj_jkey  jkey,
int  fl 
)

set the flag of the connection identified by 'jkey'

Definition at line 344 of file xjab_wlist.c.

References find234(), _xj_jkey::flag, _xj_jkey::hash, _xj_jkey::id, len, _str::len, LM_DBG, NULL, _xj_worker::pid, _str::s, _xj_wlist::sems, _xj_worker::sip_ids, _xj_wlist::workers, and _xj_worker::wpipe.

int xj_wlist_set_pid ( xj_wlist  jwl,
int  pid,
int  idx 
)

set the p.id's of the workers

  • jwl : pointer to the workers list
  • pids : p.id's array
  • size : number of pids return : 0 on success or <0 on error

Definition at line 134 of file xjab_wlist.c.

References _xj_wlist::len, NULL, _xj_worker::pid, _xj_wlist::sems, and _xj_wlist::workers.

Referenced by child_init(), and xjab_check_workers().


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