00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _XJAB_WORKER_H_
00040 #define _XJAB_WORKER_H_
00041
00042 #include "../../str.h"
00043 #include "../../lib/srdb2/db.h"
00044 #include "../../locking.h"
00045 #include "../../modules/tm/tm_load.h"
00046
00047 #include "xjab_util.h"
00048 #include "tree234.h"
00049
00050
00051 typedef struct _xj_jalias
00052 {
00053 int size;
00054 str *jdm;
00055 char dlm;
00056 str *proxy;
00057 str *a;
00058 char *d;
00059 } t_xj_jalias, *xj_jalias;
00060
00061 typedef struct _xj_worker
00062 {
00063 int pid;
00064 int wpipe;
00065 int rpipe;
00066 int nr;
00067 tree234 *sip_ids;
00068 } t_xj_worker, *xj_worker;
00069
00070 typedef struct _xj_wlist
00071 {
00072 int len;
00073 int maxj;
00074 int cachet;
00075 int delayt;
00076 int sleept;
00077 gen_lock_set_t *sems;
00078 xj_jalias aliases;
00079 xj_worker workers;
00080 } t_xj_wlist, *xj_wlist;
00081
00082
00083
00084 xj_wlist xj_wlist_init(int **, int, int, int, int, int);
00085 int xj_wlist_set_pid(xj_wlist, int, int);
00086 int xj_wlist_get(xj_wlist, xj_jkey, xj_jkey*);
00087 int xj_wlist_check(xj_wlist, xj_jkey, xj_jkey*);
00088 int xj_wlist_set_flag(xj_wlist, xj_jkey, int);
00089 void xj_wlist_del(xj_wlist, xj_jkey, int);
00090 void xj_wlist_free(xj_wlist);
00091 int xj_wlist_set_aliases(xj_wlist, char *, char *, char *);
00092 int xj_wlist_check_aliases(xj_wlist, str*);
00093 int xj_wlist_clean_jobs(xj_wlist, int, int);
00094
00095 int xj_worker_process(xj_wlist, char*, int, int, db_cmd_t*);
00096
00097 int xj_address_translation(str *src, str *dst, xj_jalias als, int flag);
00098 int xj_manage_jab(char *buf, int len, int *pos, xj_jalias als, xj_jcon jbc);
00099
00100 void xj_sig_handler(int s);
00101
00102
00103
00104 int xj_send_sip_msg(str *, str *, str *, str *, int *);
00105 int xj_send_sip_msgz(str *,str *, str *, char *, int *);
00106 void xj_tuac_callback( struct cell *t, int type, struct tmcb_params *ps);
00107 void xj_worker_check_jcons(xj_wlist, xj_jcon_pool, int, fd_set*);
00108 void xj_worker_check_qmsg(xj_wlist, xj_jcon_pool);
00109 void xj_worker_check_watcher(xj_wlist, xj_jcon_pool, xj_jcon, xj_sipmsg);
00110
00111 #endif
00112