r2756 - in trunk: libminisip/source/sip libmsip libmsip/include
libmsip/include/libmsip libmsip/source/dialogs
libmsip/source/transactions
erik at minisip.org
erik at minisip.org
Sun Sep 10 23:22:50 CEST 2006
Author: erik
Date: 2006-09-10 23:22:49 +0200 (Sun, 10 Sep 2006)
New Revision: 2756
Added:
trunk/libmsip/include/libmsip/SipTransitionUtils.h
trunk/libmsip/source/dialogs/SipTransactionUtils.cxx
trunk/libmsip/source/dialogs/SipTransitionUtils.cxx
Removed:
trunk/libmsip/include/libmsip/SipTransactionUtils.h
trunk/libmsip/source/transactions/SipTransactionUtils.cxx
Modified:
trunk/libminisip/source/sip/SipDialogConfVoip.cxx
trunk/libminisip/source/sip/SipDialogPresenceClient.cxx
trunk/libminisip/source/sip/SipDialogPresenceServer.cxx
trunk/libminisip/source/sip/SipDialogVoip.cxx
trunk/libminisip/source/sip/SipDialogVoipClient.cxx
trunk/libminisip/source/sip/SipDialogVoipServer.cxx
trunk/libminisip/source/sip/SipDialogVoipServer100rel.cxx
trunk/libmsip/Makefile.am
trunk/libmsip/include/Makefile.am
trunk/libmsip/source/dialogs/SipDialogManagement.cxx
trunk/libmsip/source/dialogs/SipDialogRegister.cxx
trunk/libmsip/source/transactions/SipTransaction.cxx
trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx
trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx
trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx
Log:
* Renamed SipTransactionUtils.{h,cxx} to SipTransitionUtils.{h,cxx}.
The utilities are used in the transitions in both the dialogs and
the transactions. Since the transactions are not part of the
"api", and it is used in the transition matching (in both dialogs
and transactions) this is a better name.
* Bug fix: the P2T and conference dialogs used the IGN constant
declared in SipTransactionUtils.h when matching commands. It was
not used by the functions, and therefore IGN meant the opposite
(never matched).
Modified: trunk/libminisip/source/sip/SipDialogConfVoip.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogConfVoip.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogConfVoip.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -38,7 +38,7 @@
#include<libmutil/massert.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipDialog.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipHeaderTo.h>
Modified: trunk/libminisip/source/sip/SipDialogPresenceClient.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogPresenceClient.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogPresenceClient.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -37,7 +37,7 @@
#include<libmsip/SipHeaderFrom.h>
#include<libmsip/SipHeaderTo.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipDialog.h>
#include<libmsip/SipCommandString.h>
#include<libminisip/sip/DefaultDialogHandler.h>
Modified: trunk/libminisip/source/sip/SipDialogPresenceServer.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogPresenceServer.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogPresenceServer.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -36,7 +36,7 @@
#include<libmsip/SipHeaderFrom.h>
#include<libmsip/SipHeaderTo.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipDialog.h>
#include<libmsip/SipCommandString.h>
#include<libminisip/sip/DefaultDialogHandler.h>
Modified: trunk/libminisip/source/sip/SipDialogVoip.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoip.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogVoip.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -36,7 +36,7 @@
#include<libmutil/massert.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipHeaderWarning.h>
#include<libmsip/SipHeaderContact.h>
Modified: trunk/libminisip/source/sip/SipDialogVoipClient.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoipClient.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogVoipClient.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -37,7 +37,7 @@
#include<libmutil/massert.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipHeaderWarning.h>
#include<libmsip/SipHeaderContact.h>
Modified: trunk/libminisip/source/sip/SipDialogVoipServer.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoipServer.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogVoipServer.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -36,7 +36,7 @@
#include<libmutil/massert.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipHeaderWarning.h>
#include<libmsip/SipHeaderContact.h>
Modified: trunk/libminisip/source/sip/SipDialogVoipServer100rel.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoipServer100rel.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libminisip/source/sip/SipDialogVoipServer100rel.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -33,7 +33,7 @@
#include<libmutil/massert.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipHeaderWarning.h>
#include<libmsip/SipHeaderContact.h>
Modified: trunk/libmsip/Makefile.am
===================================================================
--- trunk/libmsip/Makefile.am 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/Makefile.am 2006-09-10 21:22:49 UTC (rev 2756)
@@ -37,13 +37,13 @@
source/SipMessageContentIM.cxx \
source/SipMessageContentFactory.cxx \
source/SipMIMEContent.cxx \
- source/transactions/SipTransactionUtils.cxx \
source/transactions/SipTransaction.cxx \
source/transactions/SipTransactionNonInviteClient.cxx \
source/transactions/SipTransactionNonInviteServer.cxx \
source/transactions/SipTransactionInviteClient.cxx \
source/transactions/SipTransactionInviteServer.cxx \
source/transactions/SipTransactionInviteServerUA.cxx \
+ source/dialogs/SipTransitionUtils.cxx \
source/dialogs/SipDialog.cxx \
source/dialogs/SipDialogRegister.cxx \
source/dialogs/SipDialogManagement.cxx \
Modified: trunk/libmsip/include/Makefile.am
===================================================================
--- trunk/libmsip/include/Makefile.am 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/include/Makefile.am 2006-09-10 21:22:49 UTC (rev 2756)
@@ -43,7 +43,7 @@
libmsip/SipCommandString.h \
libmsip/SipUri.h \
libmsip/SipException.h \
- libmsip/SipTransactionUtils.h \
+ libmsip/SipTransitionUtils.h \
libmsip/SipMessage.h \
libmsip/SipResponse.h \
libmsip/SipRequest.h \
Deleted: trunk/libmsip/include/libmsip/SipTransactionUtils.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionUtils.h 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/include/libmsip/SipTransactionUtils.h 2006-09-10 21:22:49 UTC (rev 2756)
@@ -1,68 +0,0 @@
-/*
- 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 at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef SIPTRANSACTIONUTILS_H
-#define SIPTRANSACTIONUTILS_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmutil/MemObject.h>
-#include<libmsip/SipSMCommand.h>
-#include<string>
-
-class SipResponse;
-
-/**
- * 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 LIBMSIP_API sipResponseFilterMatch(MRef<SipResponse*> resp, const std::string &pattern);
-
-
-#define IGN -1
-
-bool LIBMSIP_API transitionMatch(
- const std::string& packetType,
- const SipSMCommand &command,
- int source/*=IGN*/,
- int destination/*=IGN*/,
- const std::string &respFilter="");
-
-/** Match Sip responses */
-bool LIBMSIP_API transitionMatchSipResponse(
- const std::string& cseqMethod,
- const SipSMCommand &command,
- int source/*=IGN*/,
- int destination/*=IGN*/,
- const std::string &respFilter="");
-
-bool LIBMSIP_API transitionMatch(
- const SipSMCommand &command,
- const std::string &cmd_str,
- int source/*=SipSMCommand::dialog_layer*/,
- int destination/*=SipSMCommand::dialog_layer*/);
-
-#endif
-
Copied: trunk/libmsip/include/libmsip/SipTransitionUtils.h (from rev 2754, trunk/libmsip/include/libmsip/SipTransactionUtils.h)
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionUtils.h 2006-09-10 13:48:42 UTC (rev 2754)
+++ trunk/libmsip/include/libmsip/SipTransitionUtils.h 2006-09-10 21:22:49 UTC (rev 2756)
@@ -0,0 +1,67 @@
+/*
+ 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 at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef SIPTRANSITIONUTILS_H
+#define SIPTRANSITIONUTILS_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmutil/MemObject.h>
+#include<libmsip/SipSMCommand.h>
+#include<string>
+
+class SipResponse;
+
+/**
+ * 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 LIBMSIP_API sipResponseFilterMatch(MRef<SipResponse*> resp, const std::string &pattern);
+
+#define IGN -1
+
+bool LIBMSIP_API transitionMatch(
+ const std::string& packetType,
+ const SipSMCommand &command,
+ int source,
+ int destination,
+ const std::string &respFilter="");
+
+/** Match Sip responses */
+bool LIBMSIP_API transitionMatchSipResponse(
+ const std::string& cseqMethod,
+ const SipSMCommand &command,
+ int source,
+ int destination,
+ const std::string &respFilter="");
+
+bool LIBMSIP_API transitionMatch(
+ const SipSMCommand &command,
+ const std::string &cmd_str,
+ int source,
+ int destination);
+
+#endif
+
Modified: trunk/libmsip/source/dialogs/SipDialogManagement.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialogManagement.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/dialogs/SipDialogManagement.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -41,7 +41,7 @@
#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
using namespace std;
Modified: trunk/libmsip/source/dialogs/SipDialogRegister.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialogRegister.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/dialogs/SipDialogRegister.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -30,7 +30,7 @@
#include<libmsip/SipDialogConfig.h>
#include<libmsip/SipDialogRegister.h>
#include<libmsip/SipCommandDispatcher.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipTransactionNonInviteClient.h>
#include<libmsip/SipRequest.h>
#include<libmsip/SipResponse.h>
Copied: trunk/libmsip/source/dialogs/SipTransactionUtils.cxx (from rev 2754, trunk/libmsip/source/transactions/SipTransactionUtils.cxx)
Copied: trunk/libmsip/source/dialogs/SipTransitionUtils.cxx (from rev 2754, trunk/libmsip/source/transactions/SipTransactionUtils.cxx)
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionUtils.cxx 2006-09-10 13:48:42 UTC (rev 2754)
+++ trunk/libmsip/source/dialogs/SipTransitionUtils.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -0,0 +1,120 @@
+/*
+ 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 at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+
+#include<config.h>
+
+
+#include<libmsip/SipTransitionUtils.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() != source){
+ return false;
+ }
+ if ( destination!=IGN && 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 LIBMSIP_API transitionMatchSipResponse(
+ const std::string& cseqMethod,
+ const SipSMCommand &command,
+ int source,
+ int destination,
+ const std::string &respFilter){
+ if( !transitionMatch( SipResponse::type, command,
+ source, destination, respFilter ) )
+ return false;
+
+ return command.getCommandPacket()->getCSeqMethod() == cseqMethod;
+}
+
+
+bool transitionMatch(
+ const SipSMCommand &command,
+ const string &cmd_str,
+ int source,
+ int destination)
+{
+ if (command.getType()!=SipSMCommand::COMMAND_STRING){
+ return false;
+ }
+ if ( destination!=IGN && command.getDestination() != destination){
+ return false;
+ }
+ if ( source!=IGN && command.getSource() != source){
+ return false;
+ }
+ if (command.getCommandString().getOp()!=cmd_str){
+ return false;
+ }
+ return true;
+}
+
Modified: trunk/libmsip/source/transactions/SipTransaction.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransaction.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransaction.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -46,7 +46,7 @@
#include<libmsip/SipTransactionInviteServerUA.h>
#include<libmsip/SipTransactionNonInviteServer.h>
#include<libmsip/SipTransactionNonInviteClient.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
using namespace std;
Modified: trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -82,7 +82,7 @@
#include<libmsip/SipTransactionNonInviteClient.h>
#include<libmsip/SipResponse.h>
#include<libmsip/SipHeaderRoute.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandDispatcher.h>
#include<libmsip/SipSMCommand.h>
#include<libmsip/SipCommandString.h>
Modified: trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -82,7 +82,7 @@
#include<libmsip/SipTransactionInviteServer.h>
#include<libmsip/SipTransactionNonInviteServer.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandDispatcher.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipDialog.h>
Modified: trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -83,7 +83,7 @@
#include<libmutil/massert.h>
#include<libmsip/SipTransactionInviteServerUA.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandDispatcher.h>
#include<libmsip/SipDialog.h>
#include<libmsip/SipDialogConfig.h>
Modified: trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -36,7 +36,7 @@
#include<libmsip/SipTransactionNonInviteClient.h>
#include<libmsip/SipCommandDispatcher.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipDialog.h>
#include<libmsip/SipDialogConfig.h>
Modified: trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -35,7 +35,7 @@
#include<libmutil/massert.h>
#include<libmsip/SipTransactionNonInviteServer.h>
#include<libmsip/SipResponse.h>
-#include<libmsip/SipTransactionUtils.h>
+#include<libmsip/SipTransitionUtils.h>
#include<libmsip/SipCommandDispatcher.h>
#include<libmsip/SipCommandString.h>
#include<libmsip/SipDialog.h>
Deleted: trunk/libmsip/source/transactions/SipTransactionUtils.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionUtils.cxx 2006-09-10 14:33:32 UTC (rev 2755)
+++ trunk/libmsip/source/transactions/SipTransactionUtils.cxx 2006-09-10 21:22:49 UTC (rev 2756)
@@ -1,120 +0,0 @@
-/*
- 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 at it.kth.se>
- * Johan Bilien <jobi at 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 LIBMSIP_API transitionMatchSipResponse(
- const std::string& cseqMethod,
- const SipSMCommand &command,
- int source,
- int destination,
- const std::string &respFilter){
- if( !transitionMatch( SipResponse::type, command,
- source, destination, respFilter ) )
- return false;
-
- return command.getCommandPacket()->getCSeqMethod() == cseqMethod;
-}
-
-
-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;
-}
-
More information about the Minisip-devel
mailing list