⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 siptransactionutils.cxx

📁 MiniSip Client with DomainKeys Authentication, Sip, Audio communications, Echo Cancel
💻 CXX
字号:
/*  Copyright (C) 2005, 2004 Erik Eliasson, Johan Bilien    This library is free software; you can redistribute it and/or  modify it under the terms of the GNU Lesser General Public  License as published by the Free Software Foundation; either  version 2.1 of the License, or (at your option) any later version.  This library 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  Lesser General Public License for more details.  You should have received a copy of the GNU Lesser General Public  License along with this library; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//* * Authors: Erik Eliasson <eliasson@it.kth.se> *          Johan Bilien <jobi@via.ecp.fr>*/#include<config.h>#include<libmsip/SipTransactionUtils.h>#include<libmsip/SipResponse.h>#include<libmutil/split_in_lines.h>using namespace std;/** * Checks if a response packet has the response code indicated by a * pattern. The pattern may contain wild cards (*) * @param resp 		SIP response to check against, for example "100 OK" * @param pattern	Pattern, for example "100" or "1**" */bool sipResponseFilterMatch(MRef<SipResponse*> resp, const string &pattern){	int32_t status = resp->getStatusCode();	if ( (pattern[0]=='*' || (status/100==(pattern[0]-'0'))) &&			(pattern[1]=='*' || ((status/10)%10 == pattern[1]-'0')) &&			(pattern[2]=='*' || (status%10 == pattern[2]-'0') )){		return true;	}else{		return false;	}}bool transitionMatch(		const std::string& packetType,		const SipSMCommand &command,		int source,		int destination,		const string &respFilter){	if (/*source!=IGN &&  command.getSource()!=SipSMCommand::ANY &&*/      command.getSource() != source){		return false;	}	if (/*destination!=IGN && command.getDestination()!=SipSMCommand::ANY &&*/ command.getDestination() != destination){		return false;	}	if (command.getType()!=SipSMCommand::COMMAND_PACKET){		return false;	}	if (packetType!="" && command.getCommandPacket()->getType()!=packetType){		return false;	}	if (respFilter.size()>0){		vector<string> filters = split_in_lines(respFilter);		for (vector<string>::iterator i=filters.begin(); i!=filters.end(); i++){			if (sipResponseFilterMatch( MRef<SipResponse*> ( (SipResponse *)*command.getCommandPacket() ), *i )){				return true;			}		}		return false;	}	return true;}bool transitionMatch(		const SipSMCommand &command,		const string &cmd_str,		int source,		int destination){	if (command.getType()!=SipSMCommand::COMMAND_STRING){		return false;	}	if (/*destination!=IGN && destination!=SipSMCommand::ANY && */ command.getDestination() != destination){		return false;	}	if (/*source!=IGN && source!=SipSMCommand::ANY &&*/ command.getSource() != source){		return false;	}	if (command.getCommandString().getOp()!=cmd_str){		return false;	}	return true;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -