r3355 - in trunk: libmcrypto/source libmsip libmsip/include libmsip/include/libmsip libmsip/source libmsip/tests libmutil libmutil/include libmutil/include/libmutil libmutil/source

erik at minisip.org erik at minisip.org
Wed Aug 8 11:06:55 CEST 2007


Author: erik
Date: 2007-08-08 11:06:55 +0200 (Wed, 08 Aug 2007)
New Revision: 3355

Added:
   trunk/libmutil/include/libmutil/SipUri.h
   trunk/libmutil/source/SipUri.cxx
Removed:
   trunk/libmsip/include/libmsip/SipUri.h
   trunk/libmsip/source/SipUri.cxx
Modified:
   trunk/libmcrypto/source/CacheManager.cxx
   trunk/libmcrypto/source/CertificatePathFinderUcd.cxx
   trunk/libmsip/Makefile.am
   trunk/libmsip/include/Makefile.am
   trunk/libmsip/include/libmsip/SipHeaderAuthorization.h
   trunk/libmsip/include/libmsip/SipHeaderContact.h
   trunk/libmsip/include/libmsip/SipHeaderFrom.h
   trunk/libmsip/include/libmsip/SipHeaderProxyAuthenticate.h
   trunk/libmsip/include/libmsip/SipHeaderProxyAuthorization.h
   trunk/libmsip/include/libmsip/SipHeaderTo.h
   trunk/libmsip/include/libmsip/SipHeaderWWWAuthenticate.h
   trunk/libmsip/include/libmsip/SipMessage.h
   trunk/libmsip/tests/000_compile.cxx
   trunk/libmutil/Makefile.am
   trunk/libmutil/include/Makefile.am
Log:

 Move SipUri to libmutil

 SipUri is needed by the Up-Cross-Down certificate lookup code which is
 in libmcrypto.

 This is not an ideal solution.

 I believe that the correct solution is to create a "Uri" class that
 exist in libmutil, and that can be used by Up-Cross-Down. Then SipUri
 would
 be moved back. The Up-Cross-Down path builder could then be used by other
 apps than SIP apps.

 An alternative is to move certificate code to libm(ini)sip which is less
 attractive.




Modified: trunk/libmcrypto/source/CacheManager.cxx
===================================================================
--- trunk/libmcrypto/source/CacheManager.cxx	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmcrypto/source/CacheManager.cxx	2007-08-08 09:06:55 UTC (rev 3355)
@@ -26,7 +26,7 @@
 #include <libmutil/stringutils.h>
 #include <libmcrypto/cert.h>
 #include <libmnetutil/FileDownloader.h>
-#include <libmsip/SipUri.h>
+#include<libmutil/SipUri.h>
 
 #include <list>
 #include <stack>

Modified: trunk/libmcrypto/source/CertificatePathFinderUcd.cxx
===================================================================
--- trunk/libmcrypto/source/CertificatePathFinderUcd.cxx	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmcrypto/source/CertificatePathFinderUcd.cxx	2007-08-08 09:06:55 UTC (rev 3355)
@@ -23,7 +23,7 @@
 
 #include <config.h>
 #include <libminisip/config/CertificatePathFinderUcd.h>
-#include <libmsip/SipUri.h>
+#include<libmutil/SipUri.h>
 
 #include <iostream>
 

Modified: trunk/libmsip/Makefile.am
===================================================================
--- trunk/libmsip/Makefile.am	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/Makefile.am	2007-08-08 09:06:55 UTC (rev 3355)
@@ -34,7 +34,6 @@
 		     source/SipSocketServer.cxx \
 		     source/SipSMCommand.cxx \
 		     source/SipCommandString.cxx \
-		     source/SipUri.cxx \
 		     source/SipTimers.cxx \
 		     source/SipMessageContentIM.cxx \
 		     source/SipMessageContentFactory.cxx \

Modified: trunk/libmsip/include/Makefile.am
===================================================================
--- trunk/libmsip/include/Makefile.am	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/Makefile.am	2007-08-08 09:06:55 UTC (rev 3355)
@@ -42,7 +42,6 @@
 		     libmsip/SipMessageContentMime.h \
 		     libmsip/SipSMCommand.h \
 		     libmsip/SipCommandString.h \
-		     libmsip/SipUri.h \
 		     libmsip/SipException.h \
 		     libmsip/SipTransitionUtils.h \
 		     libmsip/SipMessage.h \

Modified: trunk/libmsip/include/libmsip/SipHeaderAuthorization.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderAuthorization.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderAuthorization.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -36,7 +36,7 @@
 #include<libmsip/libmsip_config.h>
 
 #include<libmsip/SipHeader.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 #include<list>
 

Modified: trunk/libmsip/include/libmsip/SipHeaderContact.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderContact.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderContact.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -37,7 +37,7 @@
 #include<libmsip/libmsip_config.h>
 
 #include<libmsip/SipHeader.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 /**
  * @author Erik Eliasson

Modified: trunk/libmsip/include/libmsip/SipHeaderFrom.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderFrom.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderFrom.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -36,7 +36,7 @@
 #include<libmsip/libmsip_config.h>
 
 #include<libmsip/SipHeader.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 /**
  * @author Erik Eliasson

Modified: trunk/libmsip/include/libmsip/SipHeaderProxyAuthenticate.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderProxyAuthenticate.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderProxyAuthenticate.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -37,7 +37,7 @@
 
 
 #include<libmsip/SipHeader.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 /**
  * @author Erik Eliasson

Modified: trunk/libmsip/include/libmsip/SipHeaderProxyAuthorization.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderProxyAuthorization.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderProxyAuthorization.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -36,7 +36,7 @@
 #include<libmsip/libmsip_config.h>
 
 #include<libmsip/SipHeaderAuthorization.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 /**
  * @author Erik Eliasson

Modified: trunk/libmsip/include/libmsip/SipHeaderTo.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderTo.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderTo.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -36,7 +36,7 @@
 #include<libmsip/libmsip_config.h>
 
 #include<libmsip/SipHeader.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 /**
  * @author Erik Eliasson

Modified: trunk/libmsip/include/libmsip/SipHeaderWWWAuthenticate.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeaderWWWAuthenticate.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipHeaderWWWAuthenticate.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -37,7 +37,7 @@
 
 
 #include<libmsip/SipHeaderProxyAuthenticate.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 
 /**
  * @author Erik Eliasson

Modified: trunk/libmsip/include/libmsip/SipMessage.h
===================================================================
--- trunk/libmsip/include/libmsip/SipMessage.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipMessage.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -39,7 +39,7 @@
 
 #include<libmutil/minilist.h>
 #include<libmsip/SipHeader.h>
-#include<libmsip/SipUri.h>
+#include.libmutil/SipUri.h.
 #include<libmsip/SipMessageContent.h>
 #include<libmutil/MemObject.h>
 #include<libmsip/SipMessageContentFactory.h>

Deleted: trunk/libmsip/include/libmsip/SipUri.h
===================================================================
--- trunk/libmsip/include/libmsip/SipUri.h	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/include/libmsip/SipUri.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -1,174 +0,0 @@
-/*
-  Copyright (C) 2005, 2004 Erik Eliasson, Johan Bilien
-  Copyright (C) 2006 Mikael Magnusson
-  
-  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>
- *          Mikael Magnusson <mikma at users.sourceforge.net>
-*/
-
-/* Name
- * 	SipUri.h
- * Author
- * 	Cesc Santasusana, c e s c dot s a n t a A{T g m a i l dot co m; 2005
- * Purpose
- * 
-*/
-
-#ifndef SIPURI_H
-#define SIPURI_H
-
-#include<libmsip/libmsip_config.h>
-
-#define SIP_URI_USERNAME_DEFAULT "UNKNOWN"
-#define SIP_URI_USER_TYPE_DEFAULT "phone"
-
-#include<sys/types.h>
-#include<map>
-#include<iostream>
-
-#include<libmutil/MemObject.h>
-#include<libmutil/dbg.h>
-
-
-/**
-A SipUri representation.
-It can create a Uri from a string (parse it), 
-or from parameters that can be set.
-
-The scheme is:
-
-"displayName" <protocolId:userName at ip:port;userType;transport>
-*/
-class LIBMSIP_API SipUri : public MObject{
-	public:
-		/**
-		Basic constructor ... it creates an invalid uri
-		*/
-		SipUri() { clear(); };
-
-		~SipUri();
-		
-		/**
-		This constructor, and the setUri function, parse 
-		a uri string. If everything is ok, the uri object is valid
-		*/
-		SipUri(std::string build_from);
-		void setUri( std::string buildFrom );
-
-		/**
-		Given a string with the inside part of the uri (between, but without, 
-		the '<' and '>' ), parse and set the right parameters.
-		*/
-		void parseUserInfo( std::string userInfo );
-		                
-		/**
-		Sets at once all these params and creates a valid uri ...
-		dangerous ... use at own risk.
-		What it does?
-		For some obscure reason, some objects create sip uris providing as username a kinda uri, 
-		for example cesc at domain.org, and then also provide an ip address, which has "precedence".
-		So ... we parse the username info provided and then overwrite the ip part.
-		Also ... note that if we are provided a username like sip:user (we don't know the domain, 
-		so when calling we don't use it, for example, the TO: ) ... but this sip uri class interprets
-		(correctly) that the user is an ip ... so ... if this happens, in this particular function,
-		we move the "ip = user" to the "userName = user" ...
-		*/
-		void setParams(std::string userName, std::string ip, std::string userType, int32_t port);
-		
-		/**
-		Return the whole uri ...
-		*/
-		std::string getString() const;
-		
-		/**
-		Return only userName at ip
-		*/
-		std::string getUserIpString() const;
-		
-		/**
-		Return the uri in a valid form to be used as a request uri, 
-		that is, without: display name, '<', '>' and parameters.
-		*/
-		std::string getRequestUriString() const;
-
-		virtual std::string getMemObjectType() const {return "SipUri";}
-
-		void setDisplayName(std::string id);
-		const std::string & getDisplayName() const;
-		
-		void setProtocolId(std::string protocolId);
-		const std::string & getProtocolId() const;
-	
-		void setUser(std::string id);
-		const std::string & getUserName() const;
-
-		void setIp(std::string ip);
-		const std::string & getIp() const;
-
-		void setPort(int32_t port);
-		int32_t getPort() const;
-
-		void setUserType(std::string userType);
-		const std::string & getUserType() const;
-
-		void setTransport(std::string transp);
-		const std::string & getTransport() const;
-		
-		/**
-		Use it to check whether the uri has valid stuff in it ... 
-		don't use if not valid.
-		If invalid and used, the getXXXString functions will return nothing
-		*/
-		bool isValid() const;
-		
-		/**
-		Use at your own risk ... forces uri in a (in)valid state
-		*/
-		void makeValid( bool valid );
-		
-		void clear();
-
-		void setParameter(const std::string &key, const std::string &val);
-
-		bool hasParameter(const std::string &key) const;
-
-		const std::string & getParameter(const std::string &key) const;
-
-		void removeParameter(const std::string &key);
-
-		/**
-		 * Compare two SIP URI:s according to RFC 3261 19.1.4
-		 */
-		int operator==( const SipUri &uri ) const;
-
-	private:
-		std::string displayName;
-		std::string protocolId;
-		std::string userName;
-		std::string ip;
-		int32_t port;
-		
-		bool validUri;
-		std::map<std::string, std::string> parameters;
-};
-
-std::ostream& operator << (std::ostream& os, const SipUri& uri);
-
-#endif

Deleted: trunk/libmsip/source/SipUri.cxx
===================================================================
--- trunk/libmsip/source/SipUri.cxx	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/source/SipUri.cxx	2007-08-08 09:06:55 UTC (rev 3355)
@@ -1,472 +0,0 @@
-/*
-  Copyright (C) 2005, 2004 Erik Eliasson, Johan Bilien
-  Copyright (C) 2005-2006 Mikael Magnusson
-  
-  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>
- *          Mikael Magnusson <mikma at users.sourceforge.net>
-*/
-
-
-/* Name
- * 	SipUri.cxx
- * Author
- * 	Cesc Santasusana, c e s c dot s a n t a A{T g m a i l dot co m; 2005
- * Purpose
- * 
-*/
-
-#include<config.h>
-
-#include<libmsip/SipUri.h>
-#include<libmsip/SipException.h>
-#include<libmutil/dbg.h>
-#include<libmutil/stringutils.h>
-
-#include<vector>
-#include<locale>
-
-#ifdef DEBUG_OUTPUT
-#include<iostream>
-#endif
-
-using namespace std;
-
-SipUri::SipUri(string buildFrom){
-	setUri( buildFrom );
-}
-
-SipUri::~SipUri(){
-
-}
-
-void SipUri::setUri( string buildFrom ) {
-	size_t pos;
-	string UriData;
-	char paramDelimiter = '\0';
-	
-	clear();
-	
-#ifdef DEBUG_OUTPUT
-	mdbg("signaling/sip") << "SipUri::fromString = " << buildFrom << endl;
-#endif
-
-	//look for the full name ... 	
-	pos = buildFrom.find( '<' );
-	if( pos != string::npos ) {
-		size_t pos2, pos3;
-		pos2 = buildFrom.find( '>' );
-		if( pos2 == string::npos ) {
-#ifdef DEBUG_OUTPUT
-			cerr << "SipUri::constructor - bogus Uri ... " << buildFrom << endl;
-#endif
-			return;
-		}
-		//process the full name ... 
-		string nameTmp;
-		nameTmp = trim( buildFrom.substr( 0, pos ) );
-		pos3 = nameTmp.find( '"' );
-		while( pos3 != string::npos ) {
-			nameTmp.erase( pos3, 1 );
-			pos3 = nameTmp.find( '"' );
-		}
-		setDisplayName( nameTmp );
-		buildFrom.erase( 0, pos + 1 ); //remove the full name ...
-		//remove the leftovers (ZZZ)... XXX<YYY>ZZZ 
-		pos2 = buildFrom.find( '>' );
-		buildFrom.erase( pos2 );
-	}
-
-	//now we process the stuff that was between the < and > chars ... 
-
-	//separate the params from the Uri ... 
-	if( (pos = buildFrom.find( ';' )) != string::npos ) {
-		UriData = buildFrom.substr( 0, pos ); 
-		buildFrom.erase( 0, pos );
-		paramDelimiter = ';';
-	} else if( (pos = buildFrom.find( '?' )) != string::npos ) {
-		UriData = buildFrom.substr( 0, pos ); 
-		buildFrom.erase( 0, pos );
-		paramDelimiter = '?';
-	} else {
-		UriData = buildFrom;
-	}
-	
-	//parse the Uri info related to user (protocol, userName, ip, port)
-	parseUserInfo( UriData );
-
-	//now parse the parameters ... 
-	if( paramDelimiter != '\0' ) {
-		std::vector<string> params;
-		string paramName;
-		unsigned int idx; 
-		params = split( buildFrom, true, paramDelimiter );
-		for( idx = 0; idx < params.size(); idx++ ) {
-			pos = params[idx].find( '=' );
-			if( pos != string::npos ) {
-				paramName = params[idx].substr( 0, pos );
-				params[idx].erase( 0, pos + 1 );
-			} else {
-				paramName = params[idx];
-				params[idx] = "";
-			}
-
-			setParameter( paramName, params[ idx ] );
-		}
-	}
-	
-	validUri = true;
-	
-}
-
-void SipUri::setParams(string userName_, string ip_, string type, int32_t port_){
-	clear();
-	
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri::setParams " << endl;
-#endif	
-	parseUserInfo( userName_ );
-	if( getUserName() == "" && getIp() != "" ) {
-		setUser( getIp() );
-		setIp( "" );
-		setPort( 0 );
-	}
-	
-	if( getIp() == "" && ip_ != "" ) {
-		setIp( ip_ );
-	}
-	
-	if( port_ != 0 ) setPort( port_ );
-	if( type != "" ) setUserType( type );
-	validUri = true;
-}
-
-
-void SipUri::parseUserInfo( string UriData ) {
-	//Lets piece the Uri (without params first ) ... in UriData string
-	size_t pos;
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri::parseUserInfo - " << UriData << endl;
-#endif
-	//first identify the protocol ...
-	if( UriData.substr(0,4) == "sip:" ) {
-		setProtocolId( "sip" );
-		UriData.erase( 0, 4 );
-	} else 	if( UriData.substr(0,4) == "tel:" ) {
-		setProtocolId( "tel" );
-		UriData.erase( 0, 4 );
-	} else 	if( UriData.substr(0,5) == "sips:" ) {
-		setProtocolId( "sips" );
-		UriData.erase( 0, 5 );
-	} 
-	
-	//try to get the username ...
-	pos = UriData.find( '@' );
-	if( pos != string::npos ) { //there is a username ...
-		userName = UriData.substr( 0, pos );
-		UriData.erase( 0, pos + 1 );
-	} else { //no user info ...
-		userName = "";
-	}
-	
-	if( UriData[0] == '[' ){
-		pos = UriData.find(']');
-
-		if( pos != string::npos ){
-			setIp( UriData.substr( 1, pos - 1 ) );
-
-			if( UriData[ pos + 1 ] == ':' ) { //there is port info ...
-				UriData.erase( 0, pos + 2);
-				setPort( atoi(UriData.c_str()) );
-			} else {
-				setPort( 0 );
-			}
-			return;
-		}
-	}
-
-	//now, we get the host/ip ...
-	pos = UriData.find( ':' );
-	if( pos != string::npos ) { //there is port info ...
-		setIp( UriData.substr( 0, pos ) );
-		UriData.erase( 0, pos + 1);
-		setPort( atoi(UriData.c_str()) );
-	} else {
-		setIp( UriData );
-		UriData.erase( 0, pos );
-		setPort( 0 );
-	}
-}
-
-void SipUri::clear( ) {
-	this->displayName = "";
-	this->protocolId = "sip";
-	this->userName = "";
-	this->ip = "";
-	this->port = 0;
-	this->validUri = false;
-	this->parameters.clear();
-}
-
-string SipUri::getString() const {
-	string Uri = "";
-	
-	if( !isValid() ) {
-#ifdef DEBUG_OUTPUT
-		cerr << "SipUri::getString - invalid Uri!" << endl;
-#endif
-		return "";
-	}
-	
-	if( getDisplayName() != "" ) {
-		Uri += "\"" + getDisplayName() + "\" ";
-	}
-	Uri += "<";
-	Uri += getRequestUriString();
-	Uri += ">";
-	
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri::getString() - " << Uri << endl << endl;
-#endif
-	return Uri;
-}
-
-string SipUri::getUserIpString() const {
-	string Uri = "";
-	
-	if( !isValid() ) {
-#ifdef DEBUG_OUTPUT
-		cerr << "SipUri::getUserIpString - invalid Uri!" << endl;
-#endif
-		return "";
-	}
-	
-	if( getUserName() != "" ) Uri += getUserName() + "@";
-
-	if( getIp().find(':') != string::npos ){
-		// IPv6
-		Uri += '[' + getIp() + ']';
-	}
-	else{
-		Uri += getIp();
-	}
-	
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri::getUserIpString() - " << Uri << endl;
-#endif
-	return Uri;
-}
-
-string SipUri::getRequestUriString() const {
-	string Uri = "";
-	
-	if( !isValid() ) {
-#ifdef DEBUG_OUTPUT
-		cerr << "SipUri::getString - invalid Uri!" << endl;
-#endif
-		return "";
-	}
-	
-	if( getProtocolId() != "" )
-		 Uri += getProtocolId() + ":";
-	Uri += getUserIpString();
-	if( getPort() != 0 ) {
-		Uri += ":" + itoa( port );
-	}
-	
-	map<string, string>::const_iterator iter;
-	map<string, string>::const_iterator last = parameters.end();
-
-	for( iter = parameters.begin(); iter != last; iter++ ){
-		string key = iter->first;
-		string val = iter->second;
-
-		if( val.empty() )
-			Uri += ';' + key ;
-		else
-			Uri += ';' + key + '=' + val;
-	}
-
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri::getRequestUristring() - " << Uri << endl;
-#endif
-	return Uri;
-}
-
-void SipUri::setDisplayName(string dispName) {
-	displayName = dispName;
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri: display name = ###" << displayName << "###" << endl;
-#endif
-}
-
-const string & SipUri::getDisplayName() const {
-	return displayName;
-}
-
-void SipUri::setProtocolId(string id){
-	protocolId=id;
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri: protocol id = " << protocolId << endl;
-#endif
-}
-
-const string & SipUri::getProtocolId() const {
-	return protocolId;
-}
-
-//scan the given name ... just in case someone is misusing this function,
-// (it should use setUri() ).
-void SipUri::setUser(string name){
-		this->userName = name;
-#ifdef DEBUG_OUTPUT
-// 	cerr << "SipUri: user name = " << userName << endl;
-#endif
-}
-
-const string & SipUri::getUserName() const {
-	return userName;
-}
-
-void SipUri::setIp(string i){
-	this->ip=i;
-}
-
-const string & SipUri::getIp() const {
-	return ip;
-}
-
-void SipUri::setPort(int32_t p){
-	this->port=p;
-}
-
-int32_t SipUri::getPort() const {
-	return port;
-}
-
-void SipUri::setUserType(string type){
-	setParameter( "user", type );
-}
-
-const string & SipUri::getUserType() const {
-	return getParameter( "user" );
-}
-
-void SipUri::setTransport(string transp){
-	setParameter( "transport", transp );
-}
-
-const string & SipUri::getTransport() const {
-	return getParameter( "transport" );
-}
-
-void SipUri::setParameter(const std::string &key, const std::string &val){
-	parameters[ key ] = val;
-}
-
-bool SipUri::hasParameter(const std::string &key) const{
-	std::map<std::string, std::string>::const_iterator iter;
-	iter = parameters.find( key );
-
-	return iter != parameters.end();
-}
-
-const std::string & SipUri::getParameter(const std::string &key) const{
-	static const string empty = "";
-
-	std::map<std::string, std::string>::const_iterator iter;
-	iter = parameters.find( key );
-	if( iter != parameters.end() )
-		return iter->second;
-	else
-		return empty;
-}
-
-void SipUri::removeParameter(const std::string &key){
-	parameters.erase( key );
-}
-
-int SipUri::operator==(const SipUri &uri) const{
-	locale loc("");
-
-	if( getProtocolId() != uri.getProtocolId() ||
-	    getUserName() != uri.getUserName() ||
-	    strCaseCmp(getIp(), uri.getIp(), loc) ||
-	    getPort() != uri.getPort() ){
-		return false;
-	}
-
-	// RFC 3261 19.1.4
-	// A URI omitting any component with a default value will not
-        // match a URI explicitly containing that component with its
-        // default value.
-	const char *keys[] = { "transport", "user", "ttl",
-			      "method", "maddr", NULL };
-
-	for( int j = 0; keys[j]; j++ ){
-		const char *key = keys[j];
-		const string & value = getParameter( key );
-
-		if( strCaseCmp( value, uri.getParameter( key ), loc) ){
-			return false;
-		}
-	}
-
-	map<string,string>::const_iterator i;
-	map<string,string>::const_iterator last = parameters.end();
-
-	for( i = parameters.begin(); i != last; i++ ){
-		const string &key = i->first;
-		const string &value = i->second;
-
-		if( uri.hasParameter( key ) ){
-			if( strCaseCmp( value, uri.getParameter( key ), loc ) ){
-				return false;
-			}
-		}
-	}
-
-	last = uri.parameters.end();
-
-	for( i = uri.parameters.begin(); i != last; i++ ){
-		const string &key = i->first;
-		const string &value = i->second;
-
-		if( hasParameter( key ) ){
-			if( strCaseCmp( value, getParameter( key ), loc ) ){
-				return false;
-			}
-		}
-	}
-
-	return true;
-}
-
-bool SipUri::isValid() const { 
-	return validUri;
-}
-
-void SipUri::makeValid( bool valid ) { 
-	validUri = valid; 
-}
-
-
-ostream& operator << (ostream& os, const SipUri& uri){
-	return os << uri.getString();
-}

Modified: trunk/libmsip/tests/000_compile.cxx
===================================================================
--- trunk/libmsip/tests/000_compile.cxx	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmsip/tests/000_compile.cxx	2007-08-08 09:06:55 UTC (rev 3355)
@@ -41,7 +41,7 @@
 #include<libmsip/SipMessageContentMime.h>
 #include<libmsip/SipSMCommand.h>
 #include<libmsip/SipCommandString.h>
-#include<libmsip/SipUri.h>
+#include<libmutil/SipUri.h>
 #include<libmsip/SipException.h>
 #include<libmsip/SipTransitionUtils.h>
 #include<libmsip/SipMessage.h>

Modified: trunk/libmutil/Makefile.am
===================================================================
--- trunk/libmutil/Makefile.am	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmutil/Makefile.am	2007-08-08 09:06:55 UTC (rev 3355)
@@ -62,6 +62,7 @@
 		source/XMLParser.cxx \
 		source/MPlugin.cxx \
 		source/CircularBuffer.cxx \
+		source/SipUri.cxx \
 		source/CacheItem.cxx \
 		$(thread_src)
 

Modified: trunk/libmutil/include/Makefile.am
===================================================================
--- trunk/libmutil/include/Makefile.am	2007-08-08 08:51:14 UTC (rev 3354)
+++ trunk/libmutil/include/Makefile.am	2007-08-08 09:06:55 UTC (rev 3355)
@@ -29,6 +29,7 @@
 			libmutil/libmutil_config.h \
 			libmutil/MSingleton.h \
 			libmutil/CircularBuffer.h \
+			libmutil/SipUri.h \
 			libmutil/CacheItem.h
 
 noinst_HEADERS = 	config.h

Copied: trunk/libmutil/include/libmutil/SipUri.h (from rev 3351, trunk/libmsip/include/libmsip/SipUri.h)
===================================================================
--- trunk/libmutil/include/libmutil/SipUri.h	                        (rev 0)
+++ trunk/libmutil/include/libmutil/SipUri.h	2007-08-08 09:06:55 UTC (rev 3355)
@@ -0,0 +1,174 @@
+/*
+  Copyright (C) 2005, 2004 Erik Eliasson, Johan Bilien
+  Copyright (C) 2006 Mikael Magnusson
+  
+  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>
+ *          Mikael Magnusson <mikma at users.sourceforge.net>
+*/
+
+/* Name
+ * 	SipUri.h
+ * Author
+ * 	Cesc Santasusana, c e s c dot s a n t a A{T g m a i l dot co m; 2005
+ * Purpose
+ * 
+*/
+
+#ifndef SIPURI_H
+#define SIPURI_H
+
+#include<libmutil/libmutil_config.h>
+
+#define SIP_URI_USERNAME_DEFAULT "UNKNOWN"
+#define SIP_URI_USER_TYPE_DEFAULT "phone"
+
+#include<sys/types.h>
+#include<map>
+#include<iostream>
+
+#include<libmutil/MemObject.h>
+#include<libmutil/dbg.h>
+
+
+/**
+A SipUri representation.
+It can create a Uri from a string (parse it), 
+or from parameters that can be set.
+
+The scheme is:
+
+"displayName" <protocolId:userName at ip:port;userType;transport>
+*/
+class LIBMUTIL_API SipUri : public MObject{
+	public:
+		/**
+		Basic constructor ... it creates an invalid uri
+		*/
+		SipUri() { clear(); };
+
+		~SipUri();
+		
+		/**
+		This constructor, and the setUri function, parse 
+		a uri string. If everything is ok, the uri object is valid
+		*/
+		SipUri(std::string build_from);
+		void setUri( std::string buildFrom );
+
+		/**
+		Given a string with the inside part of the uri (between, but without, 
+		the '<' and '>' ), parse and set the right parameters.
+		*/
+		void parseUserInfo( std::string userInfo );
+		                
+		/**
+		Sets at once all these params and creates a valid uri ...
+		dangerous ... use at own risk.
+		What it does?
+		For some obscure reason, some objects create sip uris providing as username a kinda uri, 
+		for example cesc at domain.org, and then also provide an ip address, which has "precedence".
+		So ... we parse the username info provided and then overwrite the ip part.
+		Also ... note that if we are provided a username like sip:user (we don't know the domain, 
+		so when calling we don't use it, for example, the TO: ) ... but this sip uri class interprets
+		(correctly) that the user is an ip ... so ... if this happens, in this particular function,
+		we move the "ip = user" to the "userName = user" ...
+		*/
+		void setParams(std::string userName, std::string ip, std::string userType, int32_t port);
+		
+		/**
+		Return the whole uri ...
+		*/
+		std::string getString() const;
+		
+		/**
+		Return only userName at ip
+		*/
+		std::string getUserIpString() const;
+		
+		/**
+		Return the uri in a valid form to be used as a request uri, 
+		that is, without: display name, '<', '>' and parameters.
+		*/
+		std::string getRequestUriString() const;
+
+		virtual std::string getMemObjectType() const {return "SipUri";}
+
+		void setDisplayName(std::string id);
+		const std::string & getDisplayName() const;
+		
+		void setProtocolId(std::string protocolId);
+		const std::string & getProtocolId() const;
+	
+		void setUser(std::string id);
+		const std::string & getUserName() const;
+
+		void setIp(std::string ip);
+		const std::string & getIp() const;
+
+		void setPort(int32_t port);
+		int32_t getPort() const;
+
+		void setUserType(std::string userType);
+		const std::string & getUserType() const;
+
+		void setTransport(std::string transp);
+		const std::string & getTransport() const;
+		
+		/**
+		Use it to check whether the uri has valid stuff in it ... 
+		don't use if not valid.
+		If invalid and used, the getXXXString functions will return nothing
+		*/
+		bool isValid() const;
+		
+		/**
+		Use at your own risk ... forces uri in a (in)valid state
+		*/
+		void makeValid( bool valid );
+		
+		void clear();
+
+		void setParameter(const std::string &key, const std::string &val);
+
+		bool hasParameter(const std::string &key) const;
+
+		const std::string & getParameter(const std::string &key) const;
+
+		void removeParameter(const std::string &key);
+
+		/**
+		 * Compare two SIP URI:s according to RFC 3261 19.1.4
+		 */
+		int operator==( const SipUri &uri ) const;
+
+	private:
+		std::string displayName;
+		std::string protocolId;
+		std::string userName;
+		std::string ip;
+		int32_t port;
+		
+		bool validUri;
+		std::map<std::string, std::string> parameters;
+};
+
+std::ostream& operator << (std::ostream& os, const SipUri& uri);
+
+#endif

Copied: trunk/libmutil/source/SipUri.cxx (from rev 3351, trunk/libmsip/source/SipUri.cxx)
===================================================================
--- trunk/libmutil/source/SipUri.cxx	                        (rev 0)
+++ trunk/libmutil/source/SipUri.cxx	2007-08-08 09:06:55 UTC (rev 3355)
@@ -0,0 +1,472 @@
+/*
+  Copyright (C) 2005, 2004 Erik Eliasson, Johan Bilien
+  Copyright (C) 2005-2006 Mikael Magnusson
+  
+  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>
+ *          Mikael Magnusson <mikma at users.sourceforge.net>
+*/
+
+
+/* Name
+ * 	SipUri.cxx
+ * Author
+ * 	Cesc Santasusana, c e s c dot s a n t a A{T g m a i l dot co m; 2005
+ * Purpose
+ * 
+*/
+
+#include<config.h>
+
+#include<libmutil/SipUri.h>
+//#include<libmsip/SipException.h>
+#include<libmutil/dbg.h>
+#include<libmutil/stringutils.h>
+
+#include<vector>
+#include<locale>
+
+#ifdef DEBUG_OUTPUT
+#include<iostream>
+#endif
+
+using namespace std;
+
+SipUri::SipUri(string buildFrom){
+	setUri( buildFrom );
+}
+
+SipUri::~SipUri(){
+
+}
+
+void SipUri::setUri( string buildFrom ) {
+	size_t pos;
+	string UriData;
+	char paramDelimiter = '\0';
+	
+	clear();
+	
+#ifdef DEBUG_OUTPUT
+	mdbg("signaling/sip") << "SipUri::fromString = " << buildFrom << endl;
+#endif
+
+	//look for the full name ... 	
+	pos = buildFrom.find( '<' );
+	if( pos != string::npos ) {
+		size_t pos2, pos3;
+		pos2 = buildFrom.find( '>' );
+		if( pos2 == string::npos ) {
+#ifdef DEBUG_OUTPUT
+			cerr << "SipUri::constructor - bogus Uri ... " << buildFrom << endl;
+#endif
+			return;
+		}
+		//process the full name ... 
+		string nameTmp;
+		nameTmp = trim( buildFrom.substr( 0, pos ) );
+		pos3 = nameTmp.find( '"' );
+		while( pos3 != string::npos ) {
+			nameTmp.erase( pos3, 1 );
+			pos3 = nameTmp.find( '"' );
+		}
+		setDisplayName( nameTmp );
+		buildFrom.erase( 0, pos + 1 ); //remove the full name ...
+		//remove the leftovers (ZZZ)... XXX<YYY>ZZZ 
+		pos2 = buildFrom.find( '>' );
+		buildFrom.erase( pos2 );
+	}
+
+	//now we process the stuff that was between the < and > chars ... 
+
+	//separate the params from the Uri ... 
+	if( (pos = buildFrom.find( ';' )) != string::npos ) {
+		UriData = buildFrom.substr( 0, pos ); 
+		buildFrom.erase( 0, pos );
+		paramDelimiter = ';';
+	} else if( (pos = buildFrom.find( '?' )) != string::npos ) {
+		UriData = buildFrom.substr( 0, pos ); 
+		buildFrom.erase( 0, pos );
+		paramDelimiter = '?';
+	} else {
+		UriData = buildFrom;
+	}
+	
+	//parse the Uri info related to user (protocol, userName, ip, port)
+	parseUserInfo( UriData );
+
+	//now parse the parameters ... 
+	if( paramDelimiter != '\0' ) {
+		std::vector<string> params;
+		string paramName;
+		unsigned int idx; 
+		params = split( buildFrom, true, paramDelimiter );
+		for( idx = 0; idx < params.size(); idx++ ) {
+			pos = params[idx].find( '=' );
+			if( pos != string::npos ) {
+				paramName = params[idx].substr( 0, pos );
+				params[idx].erase( 0, pos + 1 );
+			} else {
+				paramName = params[idx];
+				params[idx] = "";
+			}
+
+			setParameter( paramName, params[ idx ] );
+		}
+	}
+	
+	validUri = true;
+	
+}
+
+void SipUri::setParams(string userName_, string ip_, string type, int32_t port_){
+	clear();
+	
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri::setParams " << endl;
+#endif	
+	parseUserInfo( userName_ );
+	if( getUserName() == "" && getIp() != "" ) {
+		setUser( getIp() );
+		setIp( "" );
+		setPort( 0 );
+	}
+	
+	if( getIp() == "" && ip_ != "" ) {
+		setIp( ip_ );
+	}
+	
+	if( port_ != 0 ) setPort( port_ );
+	if( type != "" ) setUserType( type );
+	validUri = true;
+}
+
+
+void SipUri::parseUserInfo( string UriData ) {
+	//Lets piece the Uri (without params first ) ... in UriData string
+	size_t pos;
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri::parseUserInfo - " << UriData << endl;
+#endif
+	//first identify the protocol ...
+	if( UriData.substr(0,4) == "sip:" ) {
+		setProtocolId( "sip" );
+		UriData.erase( 0, 4 );
+	} else 	if( UriData.substr(0,4) == "tel:" ) {
+		setProtocolId( "tel" );
+		UriData.erase( 0, 4 );
+	} else 	if( UriData.substr(0,5) == "sips:" ) {
+		setProtocolId( "sips" );
+		UriData.erase( 0, 5 );
+	} 
+	
+	//try to get the username ...
+	pos = UriData.find( '@' );
+	if( pos != string::npos ) { //there is a username ...
+		userName = UriData.substr( 0, pos );
+		UriData.erase( 0, pos + 1 );
+	} else { //no user info ...
+		userName = "";
+	}
+	
+	if( UriData[0] == '[' ){
+		pos = UriData.find(']');
+
+		if( pos != string::npos ){
+			setIp( UriData.substr( 1, pos - 1 ) );
+
+			if( UriData[ pos + 1 ] == ':' ) { //there is port info ...
+				UriData.erase( 0, pos + 2);
+				setPort( atoi(UriData.c_str()) );
+			} else {
+				setPort( 0 );
+			}
+			return;
+		}
+	}
+
+	//now, we get the host/ip ...
+	pos = UriData.find( ':' );
+	if( pos != string::npos ) { //there is port info ...
+		setIp( UriData.substr( 0, pos ) );
+		UriData.erase( 0, pos + 1);
+		setPort( atoi(UriData.c_str()) );
+	} else {
+		setIp( UriData );
+		UriData.erase( 0, pos );
+		setPort( 0 );
+	}
+}
+
+void SipUri::clear( ) {
+	this->displayName = "";
+	this->protocolId = "sip";
+	this->userName = "";
+	this->ip = "";
+	this->port = 0;
+	this->validUri = false;
+	this->parameters.clear();
+}
+
+string SipUri::getString() const {
+	string Uri = "";
+	
+	if( !isValid() ) {
+#ifdef DEBUG_OUTPUT
+		cerr << "SipUri::getString - invalid Uri!" << endl;
+#endif
+		return "";
+	}
+	
+	if( getDisplayName() != "" ) {
+		Uri += "\"" + getDisplayName() + "\" ";
+	}
+	Uri += "<";
+	Uri += getRequestUriString();
+	Uri += ">";
+	
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri::getString() - " << Uri << endl << endl;
+#endif
+	return Uri;
+}
+
+string SipUri::getUserIpString() const {
+	string Uri = "";
+	
+	if( !isValid() ) {
+#ifdef DEBUG_OUTPUT
+		cerr << "SipUri::getUserIpString - invalid Uri!" << endl;
+#endif
+		return "";
+	}
+	
+	if( getUserName() != "" ) Uri += getUserName() + "@";
+
+	if( getIp().find(':') != string::npos ){
+		// IPv6
+		Uri += '[' + getIp() + ']';
+	}
+	else{
+		Uri += getIp();
+	}
+	
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri::getUserIpString() - " << Uri << endl;
+#endif
+	return Uri;
+}
+
+string SipUri::getRequestUriString() const {
+	string Uri = "";
+	
+	if( !isValid() ) {
+#ifdef DEBUG_OUTPUT
+		cerr << "SipUri::getString - invalid Uri!" << endl;
+#endif
+		return "";
+	}
+	
+	if( getProtocolId() != "" )
+		 Uri += getProtocolId() + ":";
+	Uri += getUserIpString();
+	if( getPort() != 0 ) {
+		Uri += ":" + itoa( port );
+	}
+	
+	map<string, string>::const_iterator iter;
+	map<string, string>::const_iterator last = parameters.end();
+
+	for( iter = parameters.begin(); iter != last; iter++ ){
+		string key = iter->first;
+		string val = iter->second;
+
+		if( val.empty() )
+			Uri += ';' + key ;
+		else
+			Uri += ';' + key + '=' + val;
+	}
+
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri::getRequestUristring() - " << Uri << endl;
+#endif
+	return Uri;
+}
+
+void SipUri::setDisplayName(string dispName) {
+	displayName = dispName;
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri: display name = ###" << displayName << "###" << endl;
+#endif
+}
+
+const string & SipUri::getDisplayName() const {
+	return displayName;
+}
+
+void SipUri::setProtocolId(string id){
+	protocolId=id;
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri: protocol id = " << protocolId << endl;
+#endif
+}
+
+const string & SipUri::getProtocolId() const {
+	return protocolId;
+}
+
+//scan the given name ... just in case someone is misusing this function,
+// (it should use setUri() ).
+void SipUri::setUser(string name){
+		this->userName = name;
+#ifdef DEBUG_OUTPUT
+// 	cerr << "SipUri: user name = " << userName << endl;
+#endif
+}
+
+const string & SipUri::getUserName() const {
+	return userName;
+}
+
+void SipUri::setIp(string i){
+	this->ip=i;
+}
+
+const string & SipUri::getIp() const {
+	return ip;
+}
+
+void SipUri::setPort(int32_t p){
+	this->port=p;
+}
+
+int32_t SipUri::getPort() const {
+	return port;
+}
+
+void SipUri::setUserType(string type){
+	setParameter( "user", type );
+}
+
+const string & SipUri::getUserType() const {
+	return getParameter( "user" );
+}
+
+void SipUri::setTransport(string transp){
+	setParameter( "transport", transp );
+}
+
+const string & SipUri::getTransport() const {
+	return getParameter( "transport" );
+}
+
+void SipUri::setParameter(const std::string &key, const std::string &val){
+	parameters[ key ] = val;
+}
+
+bool SipUri::hasParameter(const std::string &key) const{
+	std::map<std::string, std::string>::const_iterator iter;
+	iter = parameters.find( key );
+
+	return iter != parameters.end();
+}
+
+const std::string & SipUri::getParameter(const std::string &key) const{
+	static const string empty = "";
+
+	std::map<std::string, std::string>::const_iterator iter;
+	iter = parameters.find( key );
+	if( iter != parameters.end() )
+		return iter->second;
+	else
+		return empty;
+}
+
+void SipUri::removeParameter(const std::string &key){
+	parameters.erase( key );
+}
+
+int SipUri::operator==(const SipUri &uri) const{
+	locale loc("");
+
+	if( getProtocolId() != uri.getProtocolId() ||
+	    getUserName() != uri.getUserName() ||
+	    strCaseCmp(getIp(), uri.getIp(), loc) ||
+	    getPort() != uri.getPort() ){
+		return false;
+	}
+
+	// RFC 3261 19.1.4
+	// A URI omitting any component with a default value will not
+        // match a URI explicitly containing that component with its
+        // default value.
+	const char *keys[] = { "transport", "user", "ttl",
+			      "method", "maddr", NULL };
+
+	for( int j = 0; keys[j]; j++ ){
+		const char *key = keys[j];
+		const string & value = getParameter( key );
+
+		if( strCaseCmp( value, uri.getParameter( key ), loc) ){
+			return false;
+		}
+	}
+
+	map<string,string>::const_iterator i;
+	map<string,string>::const_iterator last = parameters.end();
+
+	for( i = parameters.begin(); i != last; i++ ){
+		const string &key = i->first;
+		const string &value = i->second;
+
+		if( uri.hasParameter( key ) ){
+			if( strCaseCmp( value, uri.getParameter( key ), loc ) ){
+				return false;
+			}
+		}
+	}
+
+	last = uri.parameters.end();
+
+	for( i = uri.parameters.begin(); i != last; i++ ){
+		const string &key = i->first;
+		const string &value = i->second;
+
+		if( hasParameter( key ) ){
+			if( strCaseCmp( value, getParameter( key ), loc ) ){
+				return false;
+			}
+		}
+	}
+
+	return true;
+}
+
+bool SipUri::isValid() const { 
+	return validUri;
+}
+
+void SipUri::makeValid( bool valid ) { 
+	validUri = valid; 
+}
+
+
+ostream& operator << (ostream& os, const SipUri& uri){
+	return os << uri.getString();
+}



More information about the Minisip-devel mailing list