亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jabber.c

?? SIP Express Router, Linux下的SIP代理服務器,小巧實用,開發測試VoIP設備和應用的必備.
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * $Id: jabber.c,v 1.57.2.1 2005/07/20 17:11:51 andrei Exp $ * * XJAB module * * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of ser, a free SIP server. * * ser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version * * For a license to use the ser software under conditions * other than those described here, or to purchase support for this * software, please contact iptel.org by e-mail at the following addresses: *    info@iptel.org * * ser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * --- * * History * ------- * 2003-02-28 connection management with ihttp implemented (dcm) * 2003-02-24 first version of callback functions for ihttp (dcm) * 2003-02-13 lot of comments enclosed in #ifdef XJ_EXTRA_DEBUG (dcm) * 2003-03-11 New module interface (janakj) * 2003-03-16 flags export parameter added (janakj) * 2003-04-06 rank 0 changed to 1 in child_init (janakj) * 2003-06-19 fixed too many Jabber workers bug (mostly on RH9.0) (dcm) * 2003-08-05 adapted to the new parse_content_type_hdr function (bogdan) * 2004-06-07 db API update (andrei) */#include <stdio.h>#include <string.h>#include <stdlib.h>#include <sys/types.h>#include <sys/wait.h>#include <sys/ipc.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include "../../sr_module.h"#include "../../error.h"#include "../../ut.h"#include "../../mem/shm_mem.h"#include "../../mem/mem.h"#include "../../globals.h"#include "../../timer.h"#include "../../parser/parse_uri.h"#include "../../parser/parse_content.h"#include "../../parser/parse_from.h"#include "../../db/db.h"#include "../tm/tm_load.h"#ifdef HAVE_IHTTP#include "../ihttp/ih_load.h"#endif#include "xjab_load.h"#include "xjab_worker.h"#include "xjab_util.h"MODULE_VERSION/** TM bind */struct tm_binds tmb;#ifdef HAVE_IHTTP/** iHTTP bind */struct ih_binds ihb;/** iHTTP callback functions */int xjab_mod_info(ih_req_p _irp, void *_p, char *_bb, int *_bl, 		char *_hb, int *_hl);int xjab_connections(ih_req_p _irp, void *_p, char *_bb, int *_bl, 		char *_hb, int *_hl);#endif/** workers list */xj_wlist jwl = NULL;/** Structure that represents database connection */static db_con_t** db_con;static db_func_t jabber_dbf;/** parameters */static char *db_url   = "mysql://root@127.0.0.1/sip_jab";char *db_table = "jusers";char *registrar=NULL; //"sip:registrar@iptel.org";int nrw = 2;int max_jobs = 10;char *jaddress = "127.0.0.1";int jport = 5222;char *jaliases = NULL;char *jdomain  = NULL;char *proxy	   = NULL;int delay_time = 90;int sleep_time = 20;int cache_time = 600;int check_time = 20;int **pipes = NULL;static int mod_init(void);static int child_init(int rank);int xjab_manage_sipmsg(struct sip_msg *msg, int type);void xjab_check_workers(int mpid);static int xj_send_message(struct sip_msg*, char*, char*);static int xj_join_jconf(struct sip_msg*, char*, char*);static int xj_exit_jconf(struct sip_msg*, char*, char*);static int xj_go_online(struct sip_msg*, char*, char*);static int xj_go_offline(struct sip_msg*, char*, char*);void destroy(void);/* * Exported functions */static cmd_export_t cmds[] = {	{"jab_send_message",       xj_send_message,                     0,              0, REQUEST_ROUTE},	{"jab_join_jconf",         xj_join_jconf,                       0,              0, REQUEST_ROUTE},	{"jab_exit_jconf",         xj_exit_jconf,                       0,              0, REQUEST_ROUTE},	{"jab_go_online",          xj_go_online,                        0,              0, REQUEST_ROUTE},	{"jab_go_offline",         xj_go_offline,                       0,              0, REQUEST_ROUTE},	{"jab_register_watcher",   (cmd_function)xj_register_watcher,   XJ_NO_SCRIPT_F, 0, 0            },	{"jab_unregister_watcher", (cmd_function)xj_unregister_watcher, XJ_NO_SCRIPT_F, 0, 0            },	{"load_xjab",              (cmd_function)load_xjab,             XJ_NO_SCRIPT_F, 0, 0            },	{0, 0, 0, 0, 0}};/* * Exported parameters  */static param_export_t params[] = {	{"db_url",     STR_PARAM, &db_url    },	{"jaddress",   STR_PARAM, &jaddress  },	{"aliases",    STR_PARAM, &jaliases  },	{"proxy",      STR_PARAM, &proxy     },	{"jdomain",    STR_PARAM, &jdomain   },	{"registrar",  STR_PARAM, &registrar },	{"jport",      INT_PARAM, &jport     },	{"workers",    INT_PARAM, &nrw       },	{"max_jobs",   INT_PARAM, &max_jobs  },	{"cache_time", INT_PARAM, &cache_time},	{"delay_time", INT_PARAM, &delay_time},	{"sleep_time", INT_PARAM, &sleep_time},	{"check_time", INT_PARAM, &check_time},	{0, 0, 0}};struct module_exports exports= {	"jabber",	cmds,       /* Exported functions */	params,     /* Exported parameters */	mod_init,   /* module initialization function */	(response_function) 0,	(destroy_function) destroy,	0,	child_init  /* per-child init function */};/** * init module function */static int mod_init(void){	load_tm_f load_tm;#ifdef HAVE_IHTTP	load_ih_f load_ih;#endif	int  i;	DBG("XJAB:mod_init: initializing ...\n");	if(!jdomain)	{		LOG(L_ERR, "XJAB:mod_init: ERROR jdomain is NULL\n");		return -1;	}	/* import mysql functions */	if (bind_dbmod(db_url, &jabber_dbf)<0)	{		LOG(L_ERR, "XJAB:mod_init: error - database module not found\n");		return -1;	}	if (!DB_CAPABILITY(jabber_dbf, DB_CAP_QUERY)) {		LOG(L_ERR, "XJAB:mod_init: Database module does not implement 'query' function\n");		return -1;	}	db_con = (db_con_t**)shm_malloc(nrw*sizeof(db_con_t*));	if (db_con == NULL)	{		LOG(L_ERR, "XJAB:mod_init: Error while allocating db_con's\n");		return -1;	}	/* import the TM auto-loading function */	if ( !(load_tm=(load_tm_f)find_export("load_tm", NO_SCRIPT, 0))) {		LOG(L_ERR, "ERROR: xjab:mod_init: can't import load_tm\n");		return -1;	}	/* let the auto-loading function load all TM stuff */	if (load_tm( &tmb )==-1)		return -1;#ifdef HAVE_IHTTP	/* import the iHTTP auto-loading function */	if ( !(load_ih=(load_ih_f)find_export("load_ih", IH_NO_SCRIPT_F, 0))) {		LOG(L_ERR, "ERROR:xjab:mod_init: can't import load_ih\n");		return -1;	}	/* let the auto-loading function load all TM stuff */	if (load_ih( &ihb )==-1)		return -1;#endif		pipes = (int**)pkg_malloc(nrw*sizeof(int*));	if (pipes == NULL)	{		LOG(L_ERR, "XJAB:mod_init:Error while allocating pipes\n");		return -1;	}		for(i=0; i<nrw; i++)	{		pipes[i] = (int*)pkg_malloc(2*sizeof(int));		if (!pipes[i])		{			LOG(L_ERR, "XJAB:mod_init: Error while allocating pipes\n");			return -1;		}	}		for(i=0; i<nrw; i++)	{		db_con[i] = jabber_dbf.init(db_url);		if (!db_con[i])		{			LOG(L_ERR, "XJAB:mod_init: Error while connecting database\n");			return -1;		}		else		{			if (jabber_dbf.use_table(db_con[i], db_table) < 0) {				LOG(L_ERR, "XJAB:mod_init: Error in use_table\n");				return -1;			}			DBG("XJAB:mod_init: Database connection opened successfully\n");		}	}		/** creating the pipes */		for(i=0;i<nrw;i++)	{		/* create the pipe*/		if (pipe(pipes[i])==-1) {			LOG(L_ERR, "XJAB:mod_init: error - cannot create pipe!\n");			return -1;		}		DBG("XJAB:mod_init: pipe[%d] = <%d>-<%d>\n", i, pipes[i][0],			pipes[i][1]);	}		if((jwl = xj_wlist_init(pipes,nrw,max_jobs,cache_time,sleep_time,				delay_time)) == NULL)	{		LOG(L_ERR, "XJAB:mod_init: error initializing workers list\n");		return -1;	}		if(xj_wlist_set_aliases(jwl, jaliases, jdomain, proxy) < 0)	{		LOG(L_ERR, "XJAB:mod_init: error setting aliases and outbound proxy\n");		return -1;	}	DBG("XJAB:mod_init: initialized ...\n");		return 0;}/* * Initialize children */static int child_init(int rank){	int i, j, mpid, cpid;		DBG("XJAB:child_init: initializing child <%d>\n", rank);	     /* Rank 0 is main process now - 1 is the first child (janakj) */	if(rank == 1)	{#ifdef HAVE_IHTTP		/** register iHTTP callbacks -- go forward in any case*/		ihb.reg_f("xjab", "XMPP Gateway", IH_MENU_YES,				xjab_mod_info, NULL);		ihb.reg_f("xjabc", "XMPP connections", IH_MENU_YES,				xjab_connections, NULL);#endif		if((mpid=fork())<0 )		{			LOG(L_ERR, "XJAB:child_init:error - cannot launch worker's"					" manager\n");			return -1;		}		if(mpid == 0)		{			/** launching the workers */			for(i=0;i<nrw;i++)			{				if ( (cpid=fork())<0 )				{					LOG(L_ERR,"XJAB:child_init:error - cannot launch worker\n");					return -1;				}				if (cpid == 0)				{					for(j=0;j<nrw;j++)						if(j!=i) close(pipes[j][0]);					close(pipes[i][1]);					if(xj_wlist_set_pid(jwl, getpid(), i) < 0)					{						LOG(L_ERR, "XJAB:child_init:error setting worker's"										" pid\n");						return -1;					}					xj_worker_process(jwl,jaddress,jport,i,db_con[i],							&jabber_dbf);					exit(0);				}			}			mpid = getpid();			while(1)			{				sleep(check_time);				xjab_check_workers(mpid);			}		}	}		//if(pipes)	//{	//	for(i=0;i<nrw;i++)	//		close(pipes[i][0]);	//}	return 0;}/** * send the SIP MESSAGE through Jabber */static int xj_send_message(struct sip_msg *msg, char* foo1, char * foo2){	DBG("XJAB: processing SIP MESSAGE\n");	return xjab_manage_sipmsg(msg, XJ_SEND_MESSAGE);}/** * join a Jabber conference */static int xj_join_jconf(struct sip_msg *msg, char* foo1, char * foo2){	DBG("XJAB: join a Jabber conference\n");	return xjab_manage_sipmsg(msg, XJ_JOIN_JCONF);}/** * exit from Jabber conference */static int xj_exit_jconf(struct sip_msg *msg, char* foo1, char * foo2){	DBG("XJAB: exit from a Jabber conference\n");	return xjab_manage_sipmsg(msg, XJ_EXIT_JCONF);}/** * go online in Jabber network */static int xj_go_online(struct sip_msg *msg, char* foo1, char * foo2){	DBG("XJAB: go online in Jabber network\n");	return xjab_manage_sipmsg(msg, XJ_GO_ONLINE);}/** * go offline in Jabber network */static int xj_go_offline(struct sip_msg *msg, char* foo1, char * foo2){	DBG("XJAB: go offline in Jabber network\n");	return xjab_manage_sipmsg(msg, XJ_GO_OFFLINE);}/** * manage SIP message */int xjab_manage_sipmsg(struct sip_msg *msg, int type){	str body, dst, from_uri;	xj_sipmsg jsmsg;	int pipe, fl;	t_xj_jkey jkey, *p;	int mime;		body.s=0;  /* fixes gcc 4.0 warning */	body.len=0;	// extract message body - after that whole SIP MESSAGE is parsed	if (type==XJ_SEND_MESSAGE)	{		/* get the message's body */		body.s = get_body( msg );		if(body.s==0) 		{			LOG(L_ERR,"XJAB:xjab_manage_sipmsg: ERROR cannot extract body from"				" msg\n");			goto error;		}				/* content-length (if present) must be already parsed */		if(!msg->content_length)		{			LOG(L_ERR,"XJAB:xjab_manage_sipmsg: ERROR no Content-Length"					" header found!\n");			goto error;		}		body.len = get_content_length(msg);		/* parse the content-type header */		if((mime=parse_content_type_hdr(msg))<1)		{			LOG(L_ERR,"XJAB:xjab_manage_sipmsg: ERROR cannot parse"					" Content-Type header\n");			goto error;		}		/* check the content-type value */		if(mime!=(TYPE_TEXT<<16)+SUBTYPE_PLAIN			&& mime!=(TYPE_MESSAGE<<16)+SUBTYPE_CPIM)		{			LOG(L_ERR,"XJAB:xjab_manage_sipmsg: ERROR invalid content-type for"				" a message request! type found=%d\n", mime);			goto error;		}	}		// check for TO and FROM headers - if is not SIP MESSAGE 	if(parse_headers( msg, HDR_TO|HDR_FROM, 0)==-1 || !msg->to || !msg->from)	{		LOG(L_ERR,"XJAB:xjab_manage_sipmsg: cannot find TO or FROM HEADERS!\n");		goto error;	}		/* parsing from header */	if ( parse_from_header( msg )==-1 || msg->from->parsed==NULL) 	{		DBG("ERROR:xjab_manage_sipmsg: cannot get FROM header\n");		goto error;	}	from_uri.s = ((struct to_body*)msg->from->parsed)->uri.s;	from_uri.len = ((struct to_body*)msg->from->parsed)->uri.len;	if(xj_extract_aor(&from_uri, 0))	{		DBG("ERROR:xjab_manage_sipmsg: cannot get AoR from FROM header\n");		goto error;	}	jkey.hash = xj_get_hash(&from_uri, NULL);	jkey.id = &from_uri;	// get the communication pipe with the worker	switch(type)	{		case XJ_SEND_MESSAGE:		case XJ_JOIN_JCONF:		case XJ_GO_ONLINE:			if((pipe = xj_wlist_get(jwl, &jkey, &p)) < 0)			{				DBG("XJAB:xjab_manage_sipmsg: cannot find pipe of the worker!\n");				goto error;			}		break;		case XJ_EXIT_JCONF:		case XJ_GO_OFFLINE:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品久久久| 91精品福利在线一区二区三区 | 国产精品毛片高清在线完整版| 欧美激情一区二区| 亚洲一区欧美一区| 大美女一区二区三区| 欧美三级中文字| 国产精品视频麻豆| 美女网站在线免费欧美精品| 91色在线porny| 久久人人97超碰com| 午夜精品影院在线观看| 波多野结衣在线一区| 日韩午夜av电影| 亚洲综合视频网| 成人av网址在线| 久久综合色播五月| 日韩高清一区二区| 在线视频你懂得一区| 欧美激情一区二区| 国产一区999| 欧美大片国产精品| 五月激情综合网| 91久久线看在观草草青青| 国产日韩在线不卡| 韩国精品主播一区二区在线观看| 欧美美女一区二区三区| 亚洲男人的天堂av| jlzzjlzz亚洲女人18| 精品福利一二区| 蜜臀av一区二区在线免费观看| 欧美在线999| 一区二区久久久久| 色婷婷综合久久久久中文 | 99在线精品观看| 亚洲高清久久久| 成人av电影观看| 欧美国产精品一区二区三区| 国产精品中文字幕日韩精品| 精品国产亚洲一区二区三区在线观看| 日本中文一区二区三区| 在线电影国产精品| 日韩主播视频在线| 在线不卡中文字幕| 免费欧美高清视频| 欧美大片一区二区| 国产精品一级黄| 日本一区二区三区在线观看| 成人激情综合网站| 亚洲欧美乱综合| 欧美视频你懂的| 日韩福利电影在线| 精品国精品自拍自在线| 国产一区二区三区精品欧美日韩一区二区三区| 欧美大片日本大片免费观看| 国产一区二区在线视频| 国产嫩草影院久久久久| 91丨九色丨蝌蚪丨老版| 亚洲电影在线免费观看| 日韩欧美亚洲另类制服综合在线| 国产在线乱码一区二区三区| 欧美国产精品一区二区三区| 欧洲精品一区二区三区在线观看| 色综合天天性综合| 亚洲超碰97人人做人人爱| 日韩三级伦理片妻子的秘密按摩| 国产一区二三区| 亚洲人成网站精品片在线观看| 欧美写真视频网站| 精品一区二区三区影院在线午夜| 中文字幕不卡在线| 欧美日韩精品一区二区三区| 精品一二三四在线| 国产精品你懂的| 欧美片网站yy| 成人一二三区视频| 亚洲国产中文字幕在线视频综合| 欧美va天堂va视频va在线| www.欧美日韩| 蜜臀av一区二区| 亚洲视频狠狠干| 欧美一激情一区二区三区| 成人免费av在线| 青草av.久久免费一区| 国产精品免费av| 日韩网站在线看片你懂的| 99免费精品在线| 九一九一国产精品| 亚洲国产aⅴ天堂久久| 中文字幕欧美区| 日韩一级二级三级精品视频| 99精品欧美一区二区蜜桃免费| 蜜桃传媒麻豆第一区在线观看| 国产一区二区三区四| 亚洲美女精品一区| 国产视频911| 欧美一级二级三级蜜桃| 91久久久免费一区二区| 国产麻豆精品在线| 秋霞国产午夜精品免费视频| 亚洲啪啪综合av一区二区三区| 2023国产一二三区日本精品2022| 欧美麻豆精品久久久久久| 97久久精品人人做人人爽| 国产伦理精品不卡| 免费高清成人在线| 亚洲成人一二三| 一区二区三区中文字幕精品精品 | 一区二区免费看| 国产精品欧美久久久久一区二区| 精品99一区二区三区| 91精品啪在线观看国产60岁| 欧美性受极品xxxx喷水| 91无套直看片红桃| 不卡视频一二三四| 国产一区二三区好的| 极品美女销魂一区二区三区免费| 丝袜亚洲另类欧美综合| 亚洲国产aⅴ成人精品无吗| 亚洲美女淫视频| 亚洲免费观看高清完整版在线 | 成人动漫一区二区在线| 国产一区免费电影| 国产乱人伦精品一区二区在线观看 | 欧美日韩激情在线| 欧美日韩中字一区| 欧美日韩日日骚| 777久久久精品| 欧美一激情一区二区三区| 日韩欧美高清在线| 精品91自产拍在线观看一区| 欧美精品一区二区不卡| 久久久亚洲精品一区二区三区| 日韩精品一区二区三区老鸭窝| 日韩美女视频在线| 久久久精品影视| 中文字幕 久热精品 视频在线| 国产精品不卡视频| 日韩激情视频在线观看| 天天综合天天做天天综合| 日本免费在线视频不卡一不卡二| 免费高清视频精品| 国产成人精品免费在线| 成人免费看视频| 91高清视频免费看| 91精品婷婷国产综合久久 | 色噜噜狠狠色综合欧洲selulu| 欧美性生活大片视频| 日韩一级片在线播放| 国产欧美日产一区| 一个色妞综合视频在线观看| 日本在线观看不卡视频| 国产宾馆实践打屁股91| 在线观看日韩高清av| 欧美成人三级在线| 日韩一区在线看| 奇米精品一区二区三区在线观看| 国产精品一二三在| 色哦色哦哦色天天综合| 欧美电视剧在线看免费| 中文字幕亚洲精品在线观看| 三级影片在线观看欧美日韩一区二区| 国模娜娜一区二区三区| 在线观看视频一区二区欧美日韩| 欧美一区二区国产| 中文字幕日本不卡| 久久er精品视频| 91久久精品日日躁夜夜躁欧美| 日韩女优视频免费观看| 亚洲欧美激情小说另类| 国产在线精品一区二区不卡了| 一本大道久久a久久精品综合 | 色婷婷久久久亚洲一区二区三区| 欧美一级艳片视频免费观看| **网站欧美大片在线观看| 老司机精品视频在线| 在线亚洲+欧美+日本专区| 久久久久久久久久久电影| 午夜欧美大尺度福利影院在线看| 欧美精品1区2区3区| 综合欧美亚洲日本| 国产精品一二三区在线| 91精品国产91热久久久做人人| 亚洲日本青草视频在线怡红院| 国产在线精品一区二区不卡了| 欧美日韩三级在线| 亚洲欧美偷拍另类a∨色屁股| 国产乱码精品一区二区三区忘忧草| 欧美日韩一区二区三区视频| 亚洲欧洲成人精品av97| 国产一区欧美一区| 日韩欧美色电影| 日韩高清不卡一区| 欧美日韩国产综合久久 | 成人黄色片在线观看| 日韩欧美二区三区| 蜜桃视频在线观看一区| 日韩亚洲欧美一区| 天天影视涩香欲综合网| 欧美色男人天堂|