r3421 - in trunk/libmsip: . include include/libmsip source source/dialogs source/messages source/transactions

erik at minisip.org erik at minisip.org
Thu Sep 6 20:44:33 CEST 2007


Author: erik
Date: 2007-09-06 20:44:33 +0200 (Thu, 06 Sep 2007)
New Revision: 3421

Added:
   trunk/libmsip/source/SipCommandDispatcher.h
   trunk/libmsip/source/SipLayerDialog.h
   trunk/libmsip/source/SipLayerTransaction.h
   trunk/libmsip/source/SipLayerTransport.h
   trunk/libmsip/source/SipSocketServer.h
   trunk/libmsip/source/SipStackInternal.h
   trunk/libmsip/source/transactions/SipTransaction.h
   trunk/libmsip/source/transactions/SipTransactionInviteClient.h
   trunk/libmsip/source/transactions/SipTransactionInviteServer.h
   trunk/libmsip/source/transactions/SipTransactionInviteServerUA.h
   trunk/libmsip/source/transactions/SipTransactionNonInviteClient.h
   trunk/libmsip/source/transactions/SipTransactionNonInviteServer.h
Removed:
   trunk/libmsip/include/libmsip/SipCommandDispatcher.h
   trunk/libmsip/include/libmsip/SipLayerDialog.h
   trunk/libmsip/include/libmsip/SipLayerTransaction.h
   trunk/libmsip/include/libmsip/SipLayerTransport.h
   trunk/libmsip/include/libmsip/SipSocketServer.h
   trunk/libmsip/include/libmsip/SipStackInternal.h
   trunk/libmsip/include/libmsip/SipTransaction.h
   trunk/libmsip/include/libmsip/SipTransactionInviteClient.h
   trunk/libmsip/include/libmsip/SipTransactionInviteServer.h
   trunk/libmsip/include/libmsip/SipTransactionInviteServerUA.h
   trunk/libmsip/include/libmsip/SipTransactionNonInviteClient.h
   trunk/libmsip/include/libmsip/SipTransactionNonInviteServer.h
Modified:
   trunk/libmsip/Makefile.am
   trunk/libmsip/include/Makefile.am
   trunk/libmsip/source/SipCommandDispatcher.cxx
   trunk/libmsip/source/SipLayerDialog.cxx
   trunk/libmsip/source/SipLayerTransaction.cxx
   trunk/libmsip/source/SipLayerTransport.cxx
   trunk/libmsip/source/SipSocketServer.cxx
   trunk/libmsip/source/SipStack.cxx
   trunk/libmsip/source/SipStackInternal.cxx
   trunk/libmsip/source/dialogs/SipDialog.cxx
   trunk/libmsip/source/dialogs/SipDialogManagement.cxx
   trunk/libmsip/source/dialogs/SipDialogRegister.cxx
   trunk/libmsip/source/messages/SipRequest.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:
libmsip:
 * Moved the headers for the classes that are local to the library (not
   part of the library API) to the "source" directory.

   It is a bug to include any header file that is not installed
   from a header file that is. By moving the headers to the "source"
   directory doing so results in a compile error when building
   the library instead of a compile error when a user of the library
   includes the header.

  * fixed a few compiler warnings



Modified: trunk/libmsip/Makefile.am
===================================================================
--- trunk/libmsip/Makefile.am	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/Makefile.am	2007-09-06 18:44:33 UTC (rev 3421)
@@ -22,15 +22,21 @@
 msip_src =           source/SipDialogConfig.cxx \
 		     source/SipAuthenticationDigest.cxx \
 		     source/SipStack.cxx \
+		     source/SipStackInternal.h \
 		     source/SipStackInternal.cxx \
+		     source/SipLayerDialog.h \
 		     source/SipLayerDialog.cxx \
+		     source/SipLayerTransaction.h \
 		     source/SipLayerTransaction.cxx \
                      source/messages/SipMessage.cxx \
                      source/messages/SipResponse.cxx \
                      source/messages/SipRequest.cxx \
 		     source/SipUtils.cxx \
+		     source/SipCommandDispatcher.h \
 		     source/SipCommandDispatcher.cxx \
+		     source/SipLayerTransport.h \
 		     source/SipLayerTransport.cxx \
+		     source/SipSocketServer.h \
 		     source/SipSocketServer.cxx \
 		     source/SipSMCommand.cxx \
 		     source/SipCommandString.cxx \
@@ -38,11 +44,17 @@
 		     source/SipMessageContentIM.cxx \
 		     source/SipMessageContentFactory.cxx \
 		     source/SipMessageContentMime.cxx \
+		     source/transactions/SipTransaction.h \
                      source/transactions/SipTransaction.cxx \
+		     source/transactions/SipTransactionNonInviteClient.h \
 		     source/transactions/SipTransactionNonInviteClient.cxx \
+		     source/transactions/SipTransactionNonInviteServer.h \
 		     source/transactions/SipTransactionNonInviteServer.cxx \
+		     source/transactions/SipTransactionInviteClient.h \
 		     source/transactions/SipTransactionInviteClient.cxx \
+		     source/transactions/SipTransactionInviteServer.h \
 		     source/transactions/SipTransactionInviteServer.cxx \
+		     source/transactions/SipTransactionInviteServerUA.h \
 		     source/transactions/SipTransactionInviteServerUA.cxx \
                      source/dialogs/SipTransitionUtils.cxx \
 		     source/dialogs/SipDialog.cxx \

Modified: trunk/libmsip/include/Makefile.am
===================================================================
--- trunk/libmsip/include/Makefile.am	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/Makefile.am	2007-09-06 18:44:33 UTC (rev 3421)
@@ -53,19 +53,7 @@
 		     libmsip/SipDialogManagement.h \
 		     libmsip/libmsip_config.h
 
-noinst_HEADERS = 	libmsip/SipTransactionNonInviteClient.h \
-		     libmsip/SipTransactionNonInviteServer.h \
-		     libmsip/SipTransactionInviteClient.h \
-		     libmsip/SipTransactionInviteServer.h \
-		     libmsip/SipTransactionInviteServerUA.h \
-                     libmsip/SipStackInternal.h \
-		     libmsip/SipCommandDispatcher.h \
-		     libmsip/SipLayerDialog.h \
-		     libmsip/SipLayerTransaction.h \
-		     libmsip/SipLayerTransport.h \
-		     libmsip/SipSocketServer.h \
-		     libmsip/SipTransaction.h \
-			config.h
+noinst_HEADERS = config.h
 
 MAINTAINERCLEANFILES =	$(srcdir)/Makefile.in \
 			$(srcdir)/compilation_config.h.in \

Deleted: trunk/libmsip/include/libmsip/SipCommandDispatcher.h
===================================================================
--- trunk/libmsip/include/libmsip/SipCommandDispatcher.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipCommandDispatcher.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,141 +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 _SipCommandDispatcher_H
-#define _SipCommandDispatcher_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-
-#include<list>
-#include<libmutil/Mutex.h>
-#include<libmutil/MessageRouter.h>
-#include<libmutil/MemObject.h>
-#include<libmutil/minilist.h>
-#include<libmsip/SipTransaction.h>
-#include<libmsip/SipLayerDialog.h>
-#include<libmsip/SipLayerTransaction.h>
-#include<libmsip/SipLayerTransport.h>
-#include<libmsip/SipStack.h>
-
-class SipStackInternal;
-class SipDialog;
-
-/**
- * queue_type: For internal use only!
- * An item in the priority queue of commands to dispatch.
- */
-typedef struct queue_type{
-        int type;
-        MRef<SipSMCommand*> command;
-        MRef<SipTransaction*> transaction_receiver;
-        MRef<SipDialog*> call_receiver;
-} queue_type;
-
-class SipLayerDialog;
-class SipLayerTransport;
-
-#define TYPE_COMMAND 2
-#define TYPE_TIMEOUT 3
-
-
-class SipCommandDispatcher : public MObject{
-	public:
-		SipCommandDispatcher(MRef<SipStackInternal*> stack, MRef<SipLayerTransport*> transport);
-
-		void free();
-
-		void setCallback(MRef<CommandReceiver*> cb);
-		MRef<CommandReceiver*> getCallback();
-		
-		void addDialog(MRef<SipDialog*> d);
-		std::list<MRef<SipDialog *> > getDialogs();
-
-		void setDialogManagement(MRef<SipDialog*> mgmt);
-
-		virtual void run();
-		void stopRunning();
-
-		MRef<SipStackInternal*> getSipStackInternal();
-		
-//#ifdef DEBUG_OUTPUT
-		virtual std::string getMemObjectType() const {return "SipCommandDispatcher";}
-//#endif
-		
-		virtual bool handleCommand(const SipSMCommand &cmd);
-		bool dispatch(const SipSMCommand &cmd);
-
- 		bool maintainenceHandleCommand(const SipSMCommand &cmd);
-		
-		void enqueueCommand(const SipSMCommand &cmd, int queue=LOW_PRIO_QUEUE);
-
-		void enqueueTimeout(MRef<SipTransaction*> receiver, const SipSMCommand &);
-		void enqueueTimeout(MRef<SipDialog*> receiver, const SipSMCommand &);
-
-
-		MRef<SipLayerTransport*> getLayerTransport();
-		MRef<SipLayerTransaction*> getLayerTransaction();
-		MRef<SipLayerDialog*> getLayerDialog();
-
-
-		/**
-		//CESC::
-		Needs to be moved to private and use set/get functions
-		*/
-		MRef<SipDialog*> managementHandler;
-		                
-	private:
-		MRef<CommandReceiver*> callback;
-		MRef<SipStackInternal *> sipStackInternal;
-
-		Semaphore semaphore;
-		Mutex mlock;
-                minilist<queue_type> high_prio_command_q;
-                minilist<queue_type> low_prio_command_q;
-
-		
-                //
-                MRef<SipLayerDialog*> dialogLayer;
-
-                //
-                MRef<SipLayerTransaction*> transactionLayer;
-
-                //
-                MRef<SipLayerTransport *> transportLayer;
-		
-		Mutex dialogListLock;
-
-                /**
-                We will use this to stop the dialog container :: run()
-                on stack shutdown.
-                */
-                bool keepRunning;
-
-};
-
-#include<libmsip/SipDialog.h>
-#include<libmsip/SipStackInternal.h>
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipLayerDialog.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerDialog.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipLayerDialog.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,72 +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 _SipLayerDialog_H
-#define _SipLayerDialog_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipAuthenticationDigest.h>
-
-#include<list>
-#include<libmutil/Mutex.h>
-#include<libmutil/MemObject.h>
-#include<map>
-
-class SipDialog;
-class SipCommandDispatcher;
-
-
-class LIBMSIP_API SipLayerDialog : public SipSMCommandReceiver{
-	public:
-
-		SipLayerDialog(MRef<SipCommandDispatcher*> dispatcher);
-
-		~SipLayerDialog();
-		
-		void setDefaultDialogCommandHandler(MRef<SipDefaultHandler*> cb);
-		MRef<SipDefaultHandler*> getDefaultDialogCommandHandler();
-		
-		void addDialog(MRef<SipDialog*> d);
-		MRef<SipDialog*> getDialog(std::string callId);
-		bool removeDialog(std::string callId);
-
-		virtual std::string getMemObjectType() const {return "SipLayerDialog";}
-		
-		virtual bool handleCommand(const SipSMCommand &cmd);
-		
-		std::list<MRef<SipDialog*> > getDialogs();
-
-	private:
-		MRef<SipDefaultHandler*> defaultHandler;
-
-		std::map<std::string, MRef<SipDialog*> > dialogs;
-
-                MRef<SipCommandDispatcher*> dispatcher;
-
-		Mutex dialogListLock;
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipLayerTransaction.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerTransaction.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipLayerTransaction.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,82 +0,0 @@
-/*
-  Copyright (C) 2006, Erik Eliasson
-  
-  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>
-*/
-
-
-#ifndef SIPLAYERTRANSACTION_H
-#define SIPLAYERTRANSACTION_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-
-#include<list>
-#include<libmutil/Mutex.h>
-#include<libmutil/MemObject.h>
-#include<map>
-
-class SipCommandDispatcher;
-class SipTransaction;
-class SipLayerTransport;
-
-class SipLayerTransaction: public SipSMCommandReceiver{
-	public:
-		SipLayerTransaction(MRef<SipCommandDispatcher*> dispatcher, 
-				MRef<SipLayerTransport*> transp);
-
-		~SipLayerTransaction();
-
-		void doHandleAck(bool b);
-		
-		/**
-		 * @param A transaction ID is composed of the branch
-		 * 	parameter AND the CSeq method part concatenated
-		 */
-		void removeTransaction(std::string transactionId);
-
-		/**
-		 * @param A transaction ID is composed of the branch
-		 * 	parameter AND the CSeq method part concatenated
-		 */
-		MRef<SipTransaction*> getTransaction(std::string transactionId);
-
-		std::list<MRef<SipTransaction*> > getTransactions();
-		
-		std::list<MRef<SipTransaction*> > getTransactionsWithCallId(std::string callid);
-		
-		virtual std::string getMemObjectType() const {return "SipLayerTransaction";}
-		
-		virtual bool handleCommand(const SipSMCommand &cmd);
-		
-	private:
-		void addTransaction(MRef<SipTransaction*> t);
-
-		bool defaultCommandHandler(const SipSMCommand &cmd);
-		
-		bool handleAck;
-		
-		std::map<std::string, MRef<SipTransaction*> > transactions;
-
-		MRef<SipCommandDispatcher*> dispatcher;
-		MRef<SipLayerTransport*> transportLayer;
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipLayerTransport.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerTransport.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipLayerTransport.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,147 +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>
-*/
-
-
-#ifndef SipLayerTransport_H
-#define SipLayerTransport_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmnetutil/DatagramSocket.h>
-#include<libmnetutil/StreamSocket.h>
-#include<libmutil/Mutex.h>
-#include<libmutil/Semaphore.h>
-#include<libmutil/MemObject.h>
-#include<libmcrypto/cert.h>
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipMessage.h>
-#include<libmsip/SipSocketServer.h>
-#include<libmsip/SipCommandDispatcher.h>
-
-#include<list>
-
-class SipMessage;
-
-class SipLayerTransport;
-class SipCommandDispatcher;
-class StreamThreadData;
-class StreamThreadServer;
-
-class SipLayerTransport : public SipSMCommandReceiver {
-	public:
-		SipLayerTransport( MRef<CertificateChain *> cchain=NULL,
-				   MRef<CertificateSet *> cert_db = NULL
-		);
-
-		virtual ~SipLayerTransport();
-  
-		virtual void stop();
-
-		bool handleCommand(const SipSMCommand& cmd);
-		
-		
-		void setDispatcher(MRef<SipCommandDispatcher*> d);
-
-		virtual std::string getMemObjectType() const {return "SipLayerTransport";}
-
-		void sendMessage(MRef<SipMessage*> pack, const std::string &branch,
-				 bool addVia);
-
-		void addSocket(MRef<StreamSocket *> sock);
-		void removeSocket(MRef<StreamSocket *> sock);
-
-		void addServer(MRef<SipSocketServer *> server);
-
-		MRef<CertificateChain *> getCertificateChain();
-		MRef<Certificate*> getMyCertificate();
-		MRef<CertificateSet *> getCertificateSet ();
-
-		void datagramSocketRead(MRef<DatagramSocket *> sock);
-
-	protected:
-		void sendMessage(MRef<SipMessage*> pack, 
-				 const std::string &toaddr,
-				int32_t port, 
-				std::string branch,
-				std::string preferredTransport,
-				bool addVia
-				);
-
-		virtual MRef<SipSocketServer *> findServer( int32_t type, bool ipv6);
-		virtual MRef<Socket *> findServerSocket( int32_t type, bool ipv6);
-
-	private:
-		
-		/** 
-		 * Checks if the message is valid and 
-		 * the SIP stack should continue processing
-		 * the message.
-		 *
-		 * If the method returns "false" no further
-		 * processing should be made.
-		 * 
-		 * Note that the method itself can send SIP error
-		 * responses.
-		 */
-		bool validateIncoming(MRef<SipMessage *> msg);
-
-		bool getDestination(MRef<SipMessage*> pack, std::string &destAddr,
-				    int32_t &destPort, std::string &destTransport);
-		void addViaHeader( MRef<SipMessage*> pack, MRef<SipSocketServer*> server, MRef<Socket *> socket, std::string branch );
-		MRef<StreamSocket *> findStreamSocket(IPAddress&, uint16_t);
-		bool findSocket(const std::string &transport,
-					 IPAddress &addr,
-					 uint16_t port,
-					 MRef<SipSocketServer*> &server,
-					 MRef<Socket*> &socket);
-		
-		/**
-		 * Set contact uri host and port to external ip and
-		 * port configured on the server or local address and
-		 * port of the socket it if contains "minisip" param.
-		 */
-		void updateContact(MRef<SipMessage*> pack,
-				   MRef<SipSocketServer *> server,
-				   MRef<Socket *> socket);
-                
-		Mutex serversLock;
-		std::list<MRef<SipSocketServer *> > servers;
-		MRef<SocketServer*> manager;
-
-		MRef<CertificateChain *> cert_chain;
-		MRef<CertificateSet *> cert_db;
-		void * tls_ctx;
-
-		MRef<SipCommandDispatcher*> dispatcher;
-
-		friend class StreamThreadData;
-
-};
-
-void set_debug_print_packets(bool);
-bool get_debug_print_packets();
-
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipSocketServer.h
===================================================================
--- trunk/libmsip/include/libmsip/SipSocketServer.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipSocketServer.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,101 +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>
-*/
-
-
-#ifndef SipSocketServer_H
-#define SipSocketServer_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmnetutil/Socket.h>
-#include<libmnetutil/ServerSocket.h>
-#include<libmnetutil/SocketServer.h>
-#include<libmutil/Thread.h>
-
-class SipLayerTransport;
-
-/**
- * Purpose: Listens on a TCP or TLS server socket and reports
- * when a client connects to it.
- *
- */
-class SipSocketServer : public SocketServer, InputReadyHandler {
-	public:
-		SipSocketServer(MRef<SipLayerTransport*> r, MRef<Socket*> sock );
-		virtual ~SipSocketServer();
-		void free();
-		std::string getMemObjectType() const {return "SipSocketServer";}
-
-		MRef<Socket *> getSocket() const;
-		MRef<SipLayerTransport *> getReceiver() const;
-		void setReceiver(MRef<SipLayerTransport *> r);
-
-		bool isIpv6() const;
-		int32_t getType() const;
-
-		const std::string &getExternalIp() const { return externalIp; }
-		void setExternalIp( const std::string &ip ) { externalIp = ip; }
-
-		/** Override server port  */
-		void setExternalPort(int32_t port) { externalPort = port; }
-		int32_t getExternalPort() const { return externalPort; }
-
-		virtual void inputReady()=0;
-
-	protected:
-		virtual void inputReady( MRef<Socket*> socket );
-
-	private:
-		MRef<Socket *> ssock;
-		MRef<SipLayerTransport *> receiver;
-		std::string externalIp;
-		int32_t externalPort;
-};
-
-
-// 
-// StreamSocketServer
-// 
-
-class StreamSocketServer : public SipSocketServer{
-	public:
-		StreamSocketServer(MRef<SipLayerTransport*> r, MRef<ServerSocket*> sock );
-		std::string getMemObjectType(){return "StreamSocketServer";}
-		virtual void inputReady();
-};
-
-
-// 
-// DatagramSocketServer
-// 
-class DatagramSocketServer : public SipSocketServer{
-	public:
-		DatagramSocketServer(MRef<SipLayerTransport*> r, MRef<DatagramSocket*> sock );
-		std::string getMemObjectType(){return "DatagramSocketServer";}
-		virtual void inputReady();
-};
-
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipStackInternal.h
===================================================================
--- trunk/libmsip/include/libmsip/SipStackInternal.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipStackInternal.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,121 +0,0 @@
-/*
- 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
- */
-
-/* Copyright (C) 2004, 2005, 2006
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- *          Johan Bilien <jobi at via.ecp.fr>
-*/
-
-
-
-#ifndef _SIPSTACKINTERNAL_H
-#define _SIPSTACKINTERNAL_H
-
-
-#include<libmutil/CommandString.h>
-#include<libmsip/SipDialogConfig.h>
-#include<libmsip/SipTimers.h>
-
-#include<libmsip/SipLayerTransport.h>
-#include<libmsip/SipTransaction.h>
-#include<libmcrypto/cert.h>
-#include<libmutil/MessageRouter.h>
-#include<libmutil/TimeoutProvider.h>
-#include<libmutil/StateMachine.h>
-
-class SipDialog;
-
-class SipStackInternal : public SipSMCommandReceiver, public Runnable{
-
-	public:
-		SipStackInternal( MRef<SipStackConfig*> stackConfig );
-
-		void setTransactionHandlesAck(bool transHandleAck);
-
-		void setDefaultDialogCommandHandler(MRef<SipDefaultHandler*> cb);
-		MRef<SipDefaultHandler*> getDefaultDialogCommandHandler();
-
-		virtual std::string getMemObjectType() const {return "SipStackInternal";}
-		
-                virtual void run();
-		virtual void stopRunning();
-
-		MRef<SipCommandDispatcher*> getDispatcher();
-
-		bool handleCommand(const CommandString &cmd);
-
-		bool handleCommand(const SipSMCommand &command);
-		
-		void setCallback(MRef<CommandReceiver*> callback);	//Rename to setMessageRouterCallback?
-		MRef<CommandReceiver *> getCallback();
-
-		void setConfCallback(MRef<CommandReceiver*> callback); // Hack to make the conference calling work - should not be here FIXME
-		MRef<CommandReceiver *> getConfCallback();
-		
-		void addDialog(MRef<SipDialog*> d);
-
-		/**
-		 * Each SipStack object creates a TimeoutProvider that with
-		 * a thread of it's own keeps track of timers waiting to
-		 * fire. This method is used by the transactions and
-		 * dialogs that wish to use timeouts to retrieve which
-		 * timeout provider to use.
-		 */
-		MRef<TimeoutProvider<std::string, MRef<StateMachine<SipSMCommand,std::string>*> > *> getTimeoutProvider();
-
-		MRef<SipTimers*> getTimers();
-		MRef<SipStackConfig*> getStackConfig();
-
-		void addSupportedExtension(std::string extension);
-		std::string getAllSupportedExtensionsStr();
-		bool supports(std::string extension);
-                
-		std::string getStackStatusDebugString();
-
-		MRef<SipSocketServer *> createUdpServer( bool ipv6, const std::string &ipString );
-		MRef<SipSocketServer *> createTcpServer( bool ipv6, const std::string &ipString );
-		MRef<SipSocketServer *> createTlsServer( bool ipv6, const std::string &ipString );
-
-		void startUdpServer();
-		void startTcpServer();
-		void startTlsServer();
-
-		void free();
-
-	private:
-
-//		std::string getDialogDebugString(MRef<SipDialog*> d, list<MRef<SipTransaction*> > &trans,
-//				list <TPRequest<string,MRef<StateMachine<SipSMCommand,string>*> > > &torequests);
-
-		MRef<SipTimers*> timers;
-		MRef<SipStackConfig *> config;
-		MRef<CommandReceiver*> callback;
-		
-		MRef<CommandReceiver*> confCallback;	//hack to make conference calling work until the ConfMessageRouter is removed
-		
-		//
-		MRef<SipCommandDispatcher*> dispatcher;
-
-		MRef<TimeoutProvider<std::string, MRef<StateMachine<SipSMCommand,std::string>*> > *> timeoutProvider;
-
-		std::list<std::string> sipExtensions;
-};
-
-
-
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipTransaction.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransaction.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipTransaction.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,155 +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>
-*/
-
-
-/* Name
- * 	SipTransaction.h
- * Author
- * 	Erik Eliasson, eliasson at it.kth.se
- * Purpose
- * 
-*/
-
-
-#ifndef SIPTRANSACTION_H
-#define SIPTRANSACTION_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmutil/StateMachine.h>
-#include<libmutil/MemObject.h>
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipDialogConfig.h>
-#include<libmsip/SipLayerTransport.h>
-
-class SipDialog;
-class SipMessage;
-class SipCommandDispatcher;
-class SipLayerTransport;
-class SipStackInternal;
-class Socket;
-
-/**
- * SipTransaction
- */
-class SipTransaction : public StateMachine<SipSMCommand,std::string>{
-	public:
-		
-		SipTransaction(MRef<SipStackInternal*> stackInternal, 
-				int cseq, 
-				const std::string &cseqMethod, 
-				const std::string &branch, 
-				const std::string &callid);
-                
-		virtual ~SipTransaction();
-
-		/**
-		 * Creates a new transaction and initiates it using
-		 * the values of a request. This is used by the
-		 * transaction layer to create transactions.
-		 *
-		 * @param stack All transactions operate within a SIP
-		 *              stack.
-		 * @param msg	SIP request that initiates a transaction
-		 * @param fromTU  true if the request is generated by the
-		 *                local UA (client transaction) and false if it has been 
-		 *                received from a remote one (server transaction).
-		 * @param handleAck  TRUE if the "UA" versions of the
-		 *                   INVITE server transactions should be used.
-		 */
-		static MRef<SipTransaction*> create(MRef<SipStackInternal*> stackInternal, 
-				MRef<SipRequest*> msg, 
-				bool fromTU, 
-				bool handleAck=false);
-		
-		virtual std::string getName()=0;
-
-		virtual bool handleCommand(const SipSMCommand &command);
-
-		virtual void handleTimeout(const std::string &c);
-		
-		std::string getBranch();
-		void setBranch(std::string branch);
-				
-		void send(MRef<SipMessage*>  pack, bool addVia, std::string branch=""); // if not specified branch, use the attribute one - ok in most cases.
-		void setSocket(Socket * sock);
-		MRef<Socket *> getSocket();
-
-		virtual std::string getMemObjectType() const;
-		void setDebugTransType(std::string t);
-		std::string getDebugTransType();
-
-		int getCSeqNo();
-		std::string getCSeqMethod();
-                
-		std::string getCallId();
-
-		//The transition to cancel a transaction is common to all
-		//transactions and is defined in this class.
-		bool a1000_anyState_terminated_canceltransaction(const SipSMCommand &command);
-
-		//FIXME: get the reliability correctly
-		bool isUnreliable();
-
-		
-	protected:
-		
-		void setCSeqNo(int n){cSeqNo=n;}
-		MRef<SipCommandDispatcher*> dispatcher;
-		MRef<SipStackInternal*> sipStackInternal;
-		MRef<SipLayerTransport*> transportLayer;
-		MRef<Socket *> socket;
-		
-		std::string callId;
-		
-	private:
-		int cSeqNo;
-		std::string cSeqMethod;
-		std::string branch;
-
-		std::string debugTransType;
-};
-
-
-//All sub-classes of SipTransaction are local to libmsip
-class SipTransactionClient: public SipTransaction{
-        public:
-                SipTransactionClient(MRef<SipStackInternal*> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &branch, 
-				const std::string &callid);
-                ~SipTransactionClient();
-};
-
-class SipTransactionServer: public SipTransaction{
-        public:
-                SipTransactionServer(MRef<SipStackInternal*> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &branch, 
-				const std::string &callid);
-                ~SipTransactionServer();
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipTransactionInviteClient.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionInviteClient.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipTransactionInviteClient.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,212 +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>
-*/
-
-
-/* Name
- * 	SipTransactionInviteInitiator.h
- * Author
- * 	Erik Eliasson, eliasson at it.kth.se
- * Purpose
- * 
-*/
-
-
-
-#ifndef SIPTRANSACTIONINVITEICLIENT_H
-#define SIPTRANSACTIONINVITEICLIENT_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipTransaction.h>
-
-class SipResponse;
-
-/**
-	Implement an INVITE Transaction Client,
-	as defined in RFC 3261, section 17.1.1
-	
-	It is composed of the following states:
-		start, calling, proceeding, completed, terminated
-	
-	Transition functions between the states are axxx_description().
-	
-	There is a transition from any state into TERMINATED, defined in 
-	the base class SipTransaction::a1000_xxxx()
-	
-	This is a base class for an INVITE transaction client UA
-	(the handling of 2xx responses changes).
-*/
-class SipTransactionInviteClient: public SipTransactionClient{
-	public:
-		SipTransactionInviteClient(MRef<SipStackInternal*> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &callid);
-		
-		virtual ~SipTransactionInviteClient();
-
-		virtual std::string getMemObjectType() const {return "SipTransactionInvCli";}
-		virtual std::string getName(){return "transaction_invite_client[branch="+getBranch()+"]";}
-
-		void setUpStateMachine();
-		
-		/**
-			Update the parent dialog's route set. 
-			For now, only responses >= 200 update the route-set.
-			FIXME: PRACKs too
-			FIXME: Actually the route set would be better set in the dialog state machine.
-				But it is not possible until the ACK for 2xx responses are handled/sent by
-				the dialog/TU and not by the transaction (in violation of the RFC).
-		*/
-		void setDialogRouteSet(MRef<SipResponse *> resp);
-
-		void sendAck(MRef<SipResponse *>, bool provisional=false); //if no branch specified, use transaction branch attribute
-
-	private:
-		
-		/**
-			Transition from START to CALLING
-			It receives the INVITE message to send from the TU.
-			Start timer A (retx timer), only for unreliable protocols.
-			Start timer B, transaction timeout.
-			Send the INVITE message (transport layer).
-		*/
-		bool a0_start_calling_INVITE( const SipSMCommand &command);
-		
-		/**
-			No Transition, loop CALLING to CALLING
-			Timer A goes off, thus we re-tx the msg and reset the timer
-			using the backoff algorithm (multiply by 2).
-		*/
-		bool a1_calling_calling_timerA( const SipSMCommand &command);
-		
-		/**
-			Transition from CALLING to PROCEEDING
-			If a non final 1xx response is received, we move to the proceeding
-			state. 
-			Timer A is cancelled (no more retx)
-			Timer B is also cancelled, thus we stay in this state until we receive
-			some response from the proxy.
-			Forward the response to the TU.
-		*/
-		bool a2_calling_proceeding_1xx( const SipSMCommand &command);
-		
-		/**
-			Transition from CALLING to COMPLETED
-			If a final response 3xx,4xx,5xx or 6xx is received, we move to the COMPLETED
-			state. 
-			Timer A is cancelled (no more retx)
-			Timer B is also cancelled.
-			Timer D is set (response absorbtion timeout)
-			Forward the response to the TU.
-		*/
-		bool a3_calling_completed_resp36( const SipSMCommand &command);
-		
-		/**
-			Transition from CALLING to TERMINATED
-			A transport error, or timer B (transaction timeout), have happened.
-			Notify the TU about this and that the transaction_terminated.
-			Timer A is cancelled (no more retx)
-			Timer B is also cancelled.
-		*/
-		bool a4_calling_terminated_ErrOrTimerB( const SipSMCommand &command);
-		
-		/**
-			Transition from CALLING to TERMINATED
-			If a final 2xx response is received, we move to the TERMINATED
-			state. 
-			Forward the 2xx to the TU and notify the TU about transaction_terminated.
-			Timer A is cancelled (no more retx)
-			Timer B is also cancelled.
-			
-			Note: this transition does not exhist for INVITE client UA transaction
-		*/
-		bool a5_calling_terminated_2xx( const SipSMCommand &command);
-		
-		/**
-			Loop Transition in PROCEEDING
-			If a non-final 1xx response is received, just notify the TU 
-			about the reception of such.
-			Forward the response to the TU.
-		*/
-		bool a6_proceeding_proceeding_1xx( const SipSMCommand &command);
-		
-		/**
-			Transition from PROCEEDING to TERMINATED
-			Same as a5 transition.
-			
-			Note: this transition does not exhist for INVITE client UA transaction.
-		*/
-		bool a7_proceeding_terminated_2xx( const SipSMCommand &command);
-		
-		/**
-			Transition from PROCEEDING to COMPLETED
-			If a final 3xx,4xx,5xx or 6xx response is received, we move to the COMPLETED
-			state. 
-			Notify the TU about the reception of such response.
-			Timer A is cancelled (no more retx)
-			Timer B is also cancelled.
-			Timer D is set (response absorbtion timeout)
-		*/
-		bool a8_proceeding_completed_resp36( const SipSMCommand &command);
-		
-		/**
-			Loop Transition in COMPLETED
-			If a final 3xx,4xx, 5xx or 6xx response is received, we resend the
-			ACK we previously have sent. 
-			Do NOT forward this responses to the TU.
-		*/
-		bool a9_completed_completed_resp36( const SipSMCommand &command);
-		
-		/**
-			Transition from COMPLETED to TERMINATED
-			Transport Error transition. Notify the TU about the transport error
-			and transaction_terminated.
-			Timer D is cancelled (response absorbtion timeout)
-			Forward the response to the TU.
-		*/
-		bool a10_completed_terminated_TErr( const SipSMCommand &command);
-		
-		/**
-			Transition from COMPLETED to TERMINATED
-			Timer D goes off, thus we have absorbed enough re-txd responses.
-			Notify TU about transaction_terminated.
-		*/
-		bool a11_completed_terminated_timerD( const SipSMCommand &command);
-
-		/**
-		 * If the remote UA requires reliable transmission of 1xx
-		 * responses we need to do some extra processing. This
-		 * method should be called when ever receiving a 1XX
-		 * response to setup the reliable transmission (100rel SIP
-		 * extension, RFC3262)
-		 */
-		//void rel1xxProcessing(MRef<SipResponse*> resp);
-		
-		MRef<SipRequest*> lastInvite;
-//		int timerT1;
-		int timerA;
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipTransactionInviteServer.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionInviteServer.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipTransactionInviteServer.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,216 +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>
-*/
-
-
-/* Name
- * 	SipTransactionInviteServer.h
- * Author
- * 	Erik Eliasson, eliasson at it.kth.se
- * Purpose
- * 
-*/
-
-
-
-#ifndef SIPTRANSACTIONINVITESERVER_H
-#define SIPTRANSACTIONINVITESERVER_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipTransaction.h>
-
-class SipResponse;
-
-/**
-	Implement an INVITE Transaction Server
-	as defined in RFC 3261, section 17.2.1
-	
-	It is composed of the following states:
-		start, proceeding, completed, confirmed, terminated
-	
-	Transition functions between the states are axxx_description().
-	
-	There is a transition from any state into TERMINATED, defined in 
-	the base class SipTransaction::a1000_xxxx()
-	
-	This is a base class for an INVITE transaction server UA
-	(the handling of 2xx responses changes).
-*/
-class SipTransactionInviteServer : public SipTransactionServer{
-	public:
-		SipTransactionInviteServer(MRef<SipStackInternal *> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &branch, 
-				const std::string &callid);
-		
-		virtual ~SipTransactionInviteServer();
-
-		virtual std::string getMemObjectType() const {return "SipTransactionInvServer";}
-		virtual std::string getName(){return "transaction_INVITE_responder[branch="+getBranch()+"]";}
-
-		void setUpStateMachine();
-		
-		/**
-			Update the parent dialog's route set. 
-			We are in a server transaction, thus the record-route headers
-			are taken in reverse order to form the route set.
-			FIXME: Actually the route set would be better set in the dialog state machine.
-				But it is not possible until the ACK for 2xx responses are handled/sent by
-				the dialog/TU and not by the transaction (in violation of the RFC).
-		*/
-		void setDialogRouteSet(MRef<SipRequest*> inv);
-
-
-		void sendTrying();
-		void sendOk();
-		void sendRinging();
-		void sendReject();
-
-	protected:
-		MRef<SipResponse*> lastResponse;
-		MRef<SipResponse*> lastReliableResponse;
-		int timerG;
-		int timerRel1xxResend;
-
-	private:
-		
-		/**
-		Transition from START to PROCEEDING
-		The first command a INVITE server transaction receives is an INVITE
-		packet. It forwards the packet to the TU/call. We send no 1xx since we
- 		expect a response from the TU in less than 200 ms.
-		*/
-		bool a0_start_proceeding_INVITE( const SipSMCommand &command);
-		
-		/**
-		Loop in PROCEEDING state
-		If we receive the INVITE packet _again_, our response was probably lost.
-		In that case we retransmit it. 
-		Note: We expected that the TU/Call would answer before the remote side
-		retransmitted. 
-		TODO: Implement an option to send 100 trying in action "a0".
-		*/
-		bool a1_proceeding_proceeding_INVITE( const SipSMCommand &command);
-
-		/**
-		Loop in PROCEEDING state.
-		If a "1xx" response is received from the TU(/call), 
-		send it to the remote side and 
-		save it in case we need to retransmit it.
-		*/		
-		bool a2_proceeding_proceeding_1xx( const SipSMCommand &command);
-		
-		/**
-		Transition from PROCEEDING to COMPLETED
-		If a response (non 2xx/1xx) is received from the TU/Call, we send it to
-		the remote side. 
-		We save it in case we need to retransmit it later.
-		Set "timerH", wait time for an ACK.
-		Set "timerG", response re-tx interval (only if unreliable transport)
-		*/
-		bool a3_proceeding_completed_resp36( const SipSMCommand &command);
-		
-		/**
-		Transition from PROCEEDING to TERMINATED
-		If we receive a "transport_error" indication, 
-		we inform the TU and go to the terminated state.
-		//FIXME: There is currently no one giving this command to the transaction
-		layer (EE, r241).
-		*/
-		bool a4_proceeding_terminated_err( const SipSMCommand &command);
-
-		/**
-		Transiton from PROCEEDING to TERMINATED
-		If a 2xx response is received from the TU/Call,
-		  it is sent to the remote side 
-		  and the transaction terminates. 
-		Note that the ACK is not yet handled when a 
-		  2xx terminates the INVITE server transaction.
-		*/
-		bool a5_proceeding_terminated_2xx( const SipSMCommand &command);
-		
-		/**
-		Loop in COMPLETED state.
-		If we receive the INVITE again from the TU, the response has been lost. 
-		We retransmit the response again without informing the TU.
-		*/
-		bool a6_completed_completed_INVITE( const SipSMCommand &command);
-
-		/**
-		Transition from COMPLETED to CONFIRMED state.
-		If we receive an ACK while in COMPLETED, we go to the "confirmed" state
-		without informing the TU.
-		Schedule for transaction termination using timer I.
-		All other timers are cancelled.
-		*/
-		bool a7_completed_confirmed_ACK( const SipSMCommand &command);
-		
-		/**
-		Loop in COMPLETED state.
-		If timer G fires when in the "completed" state, we have not received an
-		"ACK" to our response (3xx-6xx). 
-		Resend the response and hope for an "ACK" before a transaction
-		timeout (timer H).
-		*/
-		bool a8_completed_completed_timerG( const SipSMCommand &command);
-
-		/**
-		Transition from COMPLETED to TERMINATED
-		If there is a transport error 
-		or 
-		if timerH fires, 
-		we failed to receive an ACK after several re-sends. 
-		We inform the TU/Call and go to the terminated state.
-		*/
-		bool a9_completed_terminated_errOrTimerH( const SipSMCommand &command);
-		
-		/**
-		Transition from CONFIRMED to TERMINATED
-		When timer I fires, we stop absorbing ACKs.
-		Move to TERMINATED and inform TU.
-		*/
-		bool a10_confirmed_terminated_timerI( const SipSMCommand &command);
-
-		/**
-		Absorb ACKs while in confirmed state.
-		*/
-		bool a11_confirmed_confirmed_ACK(const SipSMCommand&);
-
-		/**
-		Transition from PROCEEDING to PROCEEDING
-		When timer timerRel1xxResend fires, we resend the 1XX response
-		and double the timer value.
-		This is used for the RFC3262 "100rel" SIP extension.
-		*/
-		bool a20_proceeding_proceeding_timerRel1xxResend( const SipSMCommand &command);
-		
-		bool user_has_accepted;
-		bool user_has_rejected;
-
-		std::string key_mgmt;
-		int32_t key_mgmt_method;
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipTransactionInviteServerUA.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionInviteServerUA.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipTransactionInviteServerUA.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,83 +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>
-*/
-
-
-/* Name
- * 	SipTransactionInviteInitiator.h
- * Author
- * 	Erik Eliasson, eliasson at it.kth.se
- * Purpose
- * 
-*/
-
-
-
-#ifndef SIPTRANSACTIONINVITESERVERUA_H
-#define SIPTRANSACTIONINVITESERVERUA_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipTransactionInviteServer.h>
-
-class SipResponse;
-
-/**
-	Implement an INVITE Transaction Server UAC,
-	as defined in RFC 3261, section 17.2.1
-	
-	It is composed of the following states:
-		start, proceeding, completed, confirmed, terminated
-
-	Transition functions between the states are axxx_description().
-	
-	There is a transition from any state into TERMINATED, defined in 
-	the base class SipTransaction::a1000_xxxx()
-	
-	All transitions are the same as for the parent class, except for
-	a5, which is substituted by a1001.
-*/
-class SipTransactionInviteServerUA: public SipTransactionInviteServer{
-	public:
-		SipTransactionInviteServerUA(MRef<SipStackInternal*> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &branch, 
-				const std::string &callid);
-		
-		virtual ~SipTransactionInviteServerUA();
-
-		virtual std::string getMemObjectType() const {return "SipTransactionInvServerUA";}
-		virtual std::string getName(){return "transaction_ua_invite_server[branch="+getBranch()+"]";}
-
-		void changeStateMachine();
-
-	private:
-		/**
-		Transiton from PROCEEDING to COMPLETED
-		(substitutes a5 from the parent class).
-		*/
-		bool a1001_proceeding_completed_2xx( const SipSMCommand &command);
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipTransactionNonInviteClient.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionNonInviteClient.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipTransactionNonInviteClient.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,164 +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>
-*/
-
-
-/* Name
- * 	SipTransactionServer.h
- * Author
- * 	Erik Eliasson, eliasson at it.kth.se
- * Purpose
- * 
-*/
-
-
-
-#ifndef SIPTRANSACTIONNONINVITECLIENT_H
-#define SIPTRANSACTIONNONINVITECLIENT_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipTransaction.h>
-
-class SipDialog;
-class SipRequest;
-
-/**
-	Implement a Non-INVITE Transaction Client,
-	as defined in RFC 3261, section 17.1.2.
-	
-	It is composed of the following states:
-		start, trying, proceeding, completed, terminated
-	
-	Transition functions between the states are axxx_description().
-	
-	There is a transition from any state into TERMINATED, defined in 
-	the base class SipTransaction::a1000_xxxx()
-*/
-class SipTransactionNonInviteClient: public SipTransactionClient{
-	public:
-		SipTransactionNonInviteClient(MRef<SipStackInternal *> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &callid);
-                ~SipTransactionNonInviteClient();
-		
-		virtual std::string getMemObjectType() const {return "SipTransactionNonInvCli";}
-		
-		virtual std::string getName(){return "transaction_noninviteclient[branch="+getBranch()+",type="+getDebugTransType()+"]";}
-
-		void setUpStateMachine();
-
-	private:
-		
-		/**
-			Transition from START to TRYNG.
-			It takes the request from the TU and forwards it to the
-			transport layer (send() ).
-			Timer E is set (re-tx interval, for non reliable transport only)
-			Timer F is set (transaction timeout).
-		*/
-		bool a0_start_trying_request(const SipSMCommand &command);
-		
-		/**
-			Transition from TRYNG to PROCEEDING.
-			If the response received is a 1xx non-final response.
-			Cancel timeouts (E, F).
-			Forward the response received to the TU.
-		*/
-		bool a1_trying_proceeding_1xx( const SipSMCommand &command);
-		
-		/**
-			Transition from TRYNG to TERMINATED.
-			If there is a transport error, or timer F (transaction timeout)
-			fires, terminate the transaction. 
-			Notify the TU about the transport error and the transaction_terminated.
-		*/
-		bool a2_trying_terminated_TimerFOrErr( const SipSMCommand &command);
-		
-		/**
-			Transition from PROCEEDING to COMPLTED.
-			The response received is a final non-1xx. 
-			Set timer K (how long responses are absorbed).
-			Forward the received response up to the TU.
-		*/
-		bool a3_proceeding_completed_non1xxresp( const SipSMCommand &command);
-		
-		/**
-			No transition, state loop from PROCEEDING to PROCEEDING.
-			Timer E has fired, indicating the need to re-tx the last
-			request sent. 
-			Reset Timer E again.
-		*/
-		bool a4_proceeding_proceeding_timerE( const SipSMCommand &command);
-		
-		/**
-			No transition, state loop from PROCEEDING to PROCEEDING.
-			If another non-final 1xx response is received while in PROCEEDING,
-			forward it to the TU also (it may be a different 1xx as the first one).
-			
-		*/
-		bool a5_proceeding_proceeding_1xx( const SipSMCommand &command);
-		
-		/**
-			Transition from PROCEEDING to TERMINATED.
-			Transaction timeout timer (F) is fired or transport error.
-			Notify the TU about a transport error and about the 
-			transaction being terminated.
-		*/
-		bool a6_proceeding_terminated_transperrOrTimerF( const SipSMCommand &command);
-		
-		/**
-			Transition from TRYNG to COMPLETED.
-			If the received response is final non-1xx response, 
-			transit to the completed stated.
-			Cancel timeouts (E and F).
-			Forward the response to the TU.
-			Set Timer K (response re-tx absorbion timeout).
-		*/
-		bool a7_trying_completed_non1xxresp(const SipSMCommand &command);
-		
-		/**
-			No transition, loop from TRYNG to TRYING.
-			When Timer F fires, it means we must re-tx the last response.
-			Update Timer E (re-tx timeout for responses) according to the
-			standard algorithm in the RFC.
-			Forward the message to the transport layer (re-send).
-		*/
-		bool a8_trying_trying_timerE(const SipSMCommand &command);
-		
-		/**
-			Transition from COMPLETED to TERMINATED.
-			We are finished absorbing re-tx of responses.
-			Notify the TU about the transaction_terminated.
-		*/
-		bool a9_completed_terminated_timerK(const SipSMCommand &command);
-
-		bool a10_completed_completed_anyresp(const SipSMCommand &);
-
-		MRef<SipRequest*> lastRequest;
-		
-		int timerE; //retransmission of the initial request
-};
-
-#endif

Deleted: trunk/libmsip/include/libmsip/SipTransactionNonInviteServer.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransactionNonInviteServer.h	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/include/libmsip/SipTransactionNonInviteServer.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -1,157 +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>
-*/
-
-
-/* Name
- * 	SipTransactionServer.h
- * Author
- * 	Erik Eliasson, eliasson at it.kth.se
- * Purpose
- * 
-*/
-
-
-
-#ifndef SIPTRANSACTIONNONINVITESERVER_H
-#define SIPTRANSACTIONNONINVITESERVER_H
-
-#include<libmsip/libmsip_config.h>
-
-#include<libmsip/SipSMCommand.h>
-#include<libmsip/SipTransaction.h>
-
-class SipResponse;
-
-/**
-	Implement a Non-INVITE Transaction Server,
-	as defined in RFC 3261, section 17.2.2.
-	
-	It is composed of the following states:
-		start, trying, proceeding, completed, terminated
-	
-	Transition functions between the states are axxx_description().
-	
-	There is a transition from any state into TERMINATED, defined in 
-	the base class SipTransaction::a1000_xxxx()
-*/
-class SipTransactionNonInviteServer: public SipTransactionServer{
-	public:
-		SipTransactionNonInviteServer(MRef<SipStackInternal*> stackInternal, 
-				int seq_no, 
-				const std::string &cSeqMethod, 
-				const std::string &branch, 
-				const std::string &callid);
-		
-		virtual ~SipTransactionNonInviteServer();
-
-		virtual std::string getMemObjectType() const {return "SipTransactionNonInvServer";}
-		virtual std::string getName(){return "transaction_noninviteserver[branch="+getBranch()+",type="+getDebugTransType()+"]";}
-
-		void setUpStateMachine();
-
-	private:
-		/**
-			Transition from START to TRYNG.
-			It takes the received request and enqueues it,
-			to be received by the TU (Transaction Unit).
-		*/
-		bool a0_start_trying_request(const SipSMCommand &command);
-		
-		/**
-			Transition from TRYNG to PROCEEDING.
-			If the command contains a 1xx response (to reply to the 
-			initial request) forward it to the transport layer (send() )
-		*/		
-		bool a1_trying_proceeding_1xx(const SipSMCommand &command);
-		
-		/**
-			Transition from TRYNG to COMPLETED.
-			If the command contains a non-1xx final response (to reply to the 
-			initial request) forward it to the transport layer (send() )
-		*/
-		bool a2_trying_completed_non1xxresp(const SipSMCommand &command);
-		
-		/**
-			Transition from PROCEEDING to COMPLETED.
-			If the command contains a non-1xx final response (we are 
-			in proceeding, so we already have sent a 1xx response), forward
-			it to the transport layer.
-			Set TimerJ if transition is true (how long are we going to absorb
-			request retx).
-		*/
-		bool a3_proceeding_completed_non1xxresp(const SipSMCommand &command);
-		
-		/**
-			No state change, loop in PROCEEDING.
-			Re-send the last response. 
-			This happens when a re-tx of the request is received while in 
-			PROCEEDING state (by command of the TU usually).
-		*/
-		bool a4_proceeding_proceeding_request(const SipSMCommand &command);
-		
-		/**
-			No state change, loop in PROCEEDING.
-			Send the new response contained in the command.
-			(by command of the TU usually).
-		*/
-		bool a5_proceeding_proceeding_1xx(const SipSMCommand &command);
-		
-		/**
-			Transition from PROCEEDING to TERMINATED.
-			Transport error detected. 
-			Notify the TU about the transport error, as well as from 
-			the transaction_terminated.
-		*/
-		bool a6_proceeding_terminated_transperr(const SipSMCommand &command);
-		
-		/**
-			No state change, loop in COMPLETED.
-			Forward final responses to the transport layer for re-tx  whenever a 
-			retransmission of the request is received.  
-			Any other final responses passed by the TU to the server
-			transaction MUST be discarded while in the "Completed" state	
-		*/
-		bool a7_completed_completed_request(const SipSMCommand &command);
-		
-		/**
-			Transition from COMPLETED to TERMINATED.
-			Transport error detected. 
-			Notify the TU about the transport error, as well as from 
-			the transaction_terminated.
-		*/
-		bool a8_completed_terminated_transperr(const SipSMCommand &command);
-		
-		/**
-			Transition from COMPLETED to TERMINATED.
-			Timer J fired, stop absorbing retx. 
-			Notify the TU about the transaction_terminated.
-		*/
-		bool a9_completed_terminated_timerJ(const SipSMCommand &command);
-
-		MRef<SipResponse*> lastResponse;
-
-		//int timerT1;
-		int timerJ;
-};
-
-#endif

Modified: trunk/libmsip/source/SipCommandDispatcher.cxx
===================================================================
--- trunk/libmsip/source/SipCommandDispatcher.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipCommandDispatcher.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -25,11 +25,11 @@
 
 #include<config.h>
 
-#include<libmsip/SipCommandDispatcher.h>
-#include<libmsip/SipTransaction.h>
+#include"SipCommandDispatcher.h"
+#include"transactions/SipTransaction.h"
 #include<libmsip/SipDialog.h>
-#include<libmsip/SipLayerDialog.h>
-#include<libmsip/SipLayerTransaction.h>
+#include"SipLayerDialog.h"
+#include"SipLayerTransaction.h"
 #include<libmsip/SipCommandString.h>
 
 using namespace std;

Copied: trunk/libmsip/source/SipCommandDispatcher.h (from rev 3420, trunk/libmsip/include/libmsip/SipCommandDispatcher.h)
===================================================================
--- trunk/libmsip/source/SipCommandDispatcher.h	                        (rev 0)
+++ trunk/libmsip/source/SipCommandDispatcher.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,141 @@
+/*
+  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 _SipCommandDispatcher_H
+#define _SipCommandDispatcher_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmsip/SipSMCommand.h>
+
+#include<list>
+#include<libmutil/Mutex.h>
+#include<libmutil/MessageRouter.h>
+#include<libmutil/MemObject.h>
+#include<libmutil/minilist.h>
+#include"transactions/SipTransaction.h"
+#include"SipLayerDialog.h"
+#include"SipLayerTransaction.h"
+#include"SipLayerTransport.h"
+#include<libmsip/SipStack.h>
+
+class SipStackInternal;
+class SipDialog;
+
+/**
+ * queue_type: For internal use only!
+ * An item in the priority queue of commands to dispatch.
+ */
+typedef struct queue_type{
+        int type;
+        MRef<SipSMCommand*> command;
+        MRef<SipTransaction*> transaction_receiver;
+        MRef<SipDialog*> call_receiver;
+} queue_type;
+
+class SipLayerDialog;
+class SipLayerTransport;
+
+#define TYPE_COMMAND 2
+#define TYPE_TIMEOUT 3
+
+
+class SipCommandDispatcher : public MObject{
+	public:
+		SipCommandDispatcher(MRef<SipStackInternal*> stack, MRef<SipLayerTransport*> transport);
+
+		void free();
+
+		void setCallback(MRef<CommandReceiver*> cb);
+		MRef<CommandReceiver*> getCallback();
+		
+		void addDialog(MRef<SipDialog*> d);
+		std::list<MRef<SipDialog *> > getDialogs();
+
+		void setDialogManagement(MRef<SipDialog*> mgmt);
+
+		virtual void run();
+		void stopRunning();
+
+		MRef<SipStackInternal*> getSipStackInternal();
+		
+//#ifdef DEBUG_OUTPUT
+		virtual std::string getMemObjectType() const {return "SipCommandDispatcher";}
+//#endif
+		
+		virtual bool handleCommand(const SipSMCommand &cmd);
+		bool dispatch(const SipSMCommand &cmd);
+
+ 		bool maintainenceHandleCommand(const SipSMCommand &cmd);
+		
+		void enqueueCommand(const SipSMCommand &cmd, int queue=LOW_PRIO_QUEUE);
+
+		void enqueueTimeout(MRef<SipTransaction*> receiver, const SipSMCommand &);
+		void enqueueTimeout(MRef<SipDialog*> receiver, const SipSMCommand &);
+
+
+		MRef<SipLayerTransport*> getLayerTransport();
+		MRef<SipLayerTransaction*> getLayerTransaction();
+		MRef<SipLayerDialog*> getLayerDialog();
+
+
+		/**
+		//CESC::
+		Needs to be moved to private and use set/get functions
+		*/
+		MRef<SipDialog*> managementHandler;
+		                
+	private:
+		MRef<CommandReceiver*> callback;
+		MRef<SipStackInternal *> sipStackInternal;
+
+		Semaphore semaphore;
+		Mutex mlock;
+                minilist<queue_type> high_prio_command_q;
+                minilist<queue_type> low_prio_command_q;
+
+		
+                //
+                MRef<SipLayerDialog*> dialogLayer;
+
+                //
+                MRef<SipLayerTransaction*> transactionLayer;
+
+                //
+                MRef<SipLayerTransport *> transportLayer;
+		
+		Mutex dialogListLock;
+
+                /**
+                We will use this to stop the dialog container :: run()
+                on stack shutdown.
+                */
+                bool keepRunning;
+
+};
+
+#include<libmsip/SipDialog.h>
+#include"SipStackInternal.h"
+
+#endif

Modified: trunk/libmsip/source/SipLayerDialog.cxx
===================================================================
--- trunk/libmsip/source/SipLayerDialog.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipLayerDialog.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -26,11 +26,11 @@
 #include<config.h>
 
 #include<libmsip/SipDialog.h>
-#include<libmsip/SipLayerDialog.h>
+#include"SipLayerDialog.h"
 #include<libmsip/SipSMCommand.h>
 #include<libmsip/SipCommandString.h>
-#include<libmsip/SipCommandDispatcher.h>
-#include<libmsip/SipStackInternal.h>
+#include"SipCommandDispatcher.h"
+#include"SipStackInternal.h"
 
 using namespace std;
 

Copied: trunk/libmsip/source/SipLayerDialog.h (from rev 3420, trunk/libmsip/include/libmsip/SipLayerDialog.h)
===================================================================
--- trunk/libmsip/source/SipLayerDialog.h	                        (rev 0)
+++ trunk/libmsip/source/SipLayerDialog.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,72 @@
+/*
+  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 _SipLayerDialog_H
+#define _SipLayerDialog_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmsip/SipSMCommand.h>
+#include<libmsip/SipAuthenticationDigest.h>
+
+#include<list>
+#include<libmutil/Mutex.h>
+#include<libmutil/MemObject.h>
+#include<map>
+
+class SipDialog;
+class SipCommandDispatcher;
+
+
+class LIBMSIP_API SipLayerDialog : public SipSMCommandReceiver{
+	public:
+
+		SipLayerDialog(MRef<SipCommandDispatcher*> dispatcher);
+
+		~SipLayerDialog();
+		
+		void setDefaultDialogCommandHandler(MRef<SipDefaultHandler*> cb);
+		MRef<SipDefaultHandler*> getDefaultDialogCommandHandler();
+		
+		void addDialog(MRef<SipDialog*> d);
+		MRef<SipDialog*> getDialog(std::string callId);
+		bool removeDialog(std::string callId);
+
+		virtual std::string getMemObjectType() const {return "SipLayerDialog";}
+		
+		virtual bool handleCommand(const SipSMCommand &cmd);
+		
+		std::list<MRef<SipDialog*> > getDialogs();
+
+	private:
+		MRef<SipDefaultHandler*> defaultHandler;
+
+		std::map<std::string, MRef<SipDialog*> > dialogs;
+
+                MRef<SipCommandDispatcher*> dispatcher;
+
+		Mutex dialogListLock;
+};
+
+#endif

Modified: trunk/libmsip/source/SipLayerTransaction.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransaction.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipLayerTransaction.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -25,10 +25,10 @@
 
 #include<config.h>
 
-#include<libmsip/SipLayerTransaction.h>
-#include<libmsip/SipTransaction.h>
+#include"SipLayerTransaction.h"
+#include"transactions/SipTransaction.h"
 #include<libmsip/SipCommandString.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"SipCommandDispatcher.h"
 
 using namespace std;
 

Copied: trunk/libmsip/source/SipLayerTransaction.h (from rev 3420, trunk/libmsip/include/libmsip/SipLayerTransaction.h)
===================================================================
--- trunk/libmsip/source/SipLayerTransaction.h	                        (rev 0)
+++ trunk/libmsip/source/SipLayerTransaction.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,82 @@
+/*
+  Copyright (C) 2006, Erik Eliasson
+  
+  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>
+*/
+
+
+#ifndef SIPLAYERTRANSACTION_H
+#define SIPLAYERTRANSACTION_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmsip/SipSMCommand.h>
+
+#include<list>
+#include<libmutil/Mutex.h>
+#include<libmutil/MemObject.h>
+#include<map>
+
+class SipCommandDispatcher;
+class SipTransaction;
+class SipLayerTransport;
+
+class SipLayerTransaction: public SipSMCommandReceiver{
+	public:
+		SipLayerTransaction(MRef<SipCommandDispatcher*> dispatcher, 
+				MRef<SipLayerTransport*> transp);
+
+		~SipLayerTransaction();
+
+		void doHandleAck(bool b);
+		
+		/**
+		 * @param A transaction ID is composed of the branch
+		 * 	parameter AND the CSeq method part concatenated
+		 */
+		void removeTransaction(std::string transactionId);
+
+		/**
+		 * @param A transaction ID is composed of the branch
+		 * 	parameter AND the CSeq method part concatenated
+		 */
+		MRef<SipTransaction*> getTransaction(std::string transactionId);
+
+		std::list<MRef<SipTransaction*> > getTransactions();
+		
+		std::list<MRef<SipTransaction*> > getTransactionsWithCallId(std::string callid);
+		
+		virtual std::string getMemObjectType() const {return "SipLayerTransaction";}
+		
+		virtual bool handleCommand(const SipSMCommand &cmd);
+		
+	private:
+		void addTransaction(MRef<SipTransaction*> t);
+
+		bool defaultCommandHandler(const SipSMCommand &cmd);
+		
+		bool handleAck;
+		
+		std::map<std::string, MRef<SipTransaction*> > transactions;
+
+		MRef<SipCommandDispatcher*> dispatcher;
+		MRef<SipLayerTransport*> transportLayer;
+};
+
+#endif

Modified: trunk/libmsip/source/SipLayerTransport.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransport.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipLayerTransport.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -26,7 +26,7 @@
 
 #include<config.h>
 
-#include<libmsip/SipLayerTransport.h>
+#include"SipLayerTransport.h"
 
 #include<errno.h>
 #include<stdio.h>
@@ -53,7 +53,7 @@
 #include<libmutil/dbg.h>
 #include<libmutil/stringutils.h>
 #include<libmsip/SipCommandString.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"SipCommandDispatcher.h"
 #include<libmsip/SipHeaderFrom.h>
 
 #include<cctype>

Copied: trunk/libmsip/source/SipLayerTransport.h (from rev 3420, trunk/libmsip/include/libmsip/SipLayerTransport.h)
===================================================================
--- trunk/libmsip/source/SipLayerTransport.h	                        (rev 0)
+++ trunk/libmsip/source/SipLayerTransport.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,147 @@
+/*
+  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>
+*/
+
+
+#ifndef SipLayerTransport_H
+#define SipLayerTransport_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmnetutil/DatagramSocket.h>
+#include<libmnetutil/StreamSocket.h>
+#include<libmutil/Mutex.h>
+#include<libmutil/Semaphore.h>
+#include<libmutil/MemObject.h>
+#include<libmcrypto/cert.h>
+#include<libmsip/SipSMCommand.h>
+#include<libmsip/SipMessage.h>
+#include"SipSocketServer.h"
+#include"SipCommandDispatcher.h"
+
+#include<list>
+
+class SipMessage;
+
+class SipLayerTransport;
+class SipCommandDispatcher;
+class StreamThreadData;
+class StreamThreadServer;
+
+class SipLayerTransport : public SipSMCommandReceiver {
+	public:
+		SipLayerTransport( MRef<CertificateChain *> cchain=NULL,
+				   MRef<CertificateSet *> cert_db = NULL
+		);
+
+		virtual ~SipLayerTransport();
+  
+		virtual void stop();
+
+		bool handleCommand(const SipSMCommand& cmd);
+		
+		
+		void setDispatcher(MRef<SipCommandDispatcher*> d);
+
+		virtual std::string getMemObjectType() const {return "SipLayerTransport";}
+
+		void sendMessage(MRef<SipMessage*> pack, const std::string &branch,
+				 bool addVia);
+
+		void addSocket(MRef<StreamSocket *> sock);
+		void removeSocket(MRef<StreamSocket *> sock);
+
+		void addServer(MRef<SipSocketServer *> server);
+
+		MRef<CertificateChain *> getCertificateChain();
+		MRef<Certificate*> getMyCertificate();
+		MRef<CertificateSet *> getCertificateSet ();
+
+		void datagramSocketRead(MRef<DatagramSocket *> sock);
+
+	protected:
+		void sendMessage(MRef<SipMessage*> pack, 
+				 const std::string &toaddr,
+				int32_t port, 
+				std::string branch,
+				std::string preferredTransport,
+				bool addVia
+				);
+
+		virtual MRef<SipSocketServer *> findServer( int32_t type, bool ipv6);
+		virtual MRef<Socket *> findServerSocket( int32_t type, bool ipv6);
+
+	private:
+		
+		/** 
+		 * Checks if the message is valid and 
+		 * the SIP stack should continue processing
+		 * the message.
+		 *
+		 * If the method returns "false" no further
+		 * processing should be made.
+		 * 
+		 * Note that the method itself can send SIP error
+		 * responses.
+		 */
+		bool validateIncoming(MRef<SipMessage *> msg);
+
+		bool getDestination(MRef<SipMessage*> pack, std::string &destAddr,
+				    int32_t &destPort, std::string &destTransport);
+		void addViaHeader( MRef<SipMessage*> pack, MRef<SipSocketServer*> server, MRef<Socket *> socket, std::string branch );
+		MRef<StreamSocket *> findStreamSocket(IPAddress&, uint16_t);
+		bool findSocket(const std::string &transport,
+					 IPAddress &addr,
+					 uint16_t port,
+					 MRef<SipSocketServer*> &server,
+					 MRef<Socket*> &socket);
+		
+		/**
+		 * Set contact uri host and port to external ip and
+		 * port configured on the server or local address and
+		 * port of the socket it if contains "minisip" param.
+		 */
+		void updateContact(MRef<SipMessage*> pack,
+				   MRef<SipSocketServer *> server,
+				   MRef<Socket *> socket);
+                
+		Mutex serversLock;
+		std::list<MRef<SipSocketServer *> > servers;
+		MRef<SocketServer*> manager;
+
+		MRef<CertificateChain *> cert_chain;
+		MRef<CertificateSet *> cert_db;
+		void * tls_ctx;
+
+		MRef<SipCommandDispatcher*> dispatcher;
+
+		friend class StreamThreadData;
+
+};
+
+void set_debug_print_packets(bool);
+bool get_debug_print_packets();
+
+
+#endif

Modified: trunk/libmsip/source/SipSocketServer.cxx
===================================================================
--- trunk/libmsip/source/SipSocketServer.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipSocketServer.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -28,8 +28,8 @@
 
 #include<libmnetutil/NetworkException.h>
 #include<libmnetutil/DatagramSocket.h>
-#include<libmsip/SipSocketServer.h>
-#include<libmsip/SipLayerTransport.h>
+#include"SipSocketServer.h"
+#include"SipLayerTransport.h"
 
 using namespace std;
 

Copied: trunk/libmsip/source/SipSocketServer.h (from rev 3420, trunk/libmsip/include/libmsip/SipSocketServer.h)
===================================================================
--- trunk/libmsip/source/SipSocketServer.h	                        (rev 0)
+++ trunk/libmsip/source/SipSocketServer.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,101 @@
+/*
+  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>
+*/
+
+
+#ifndef SipSocketServer_H
+#define SipSocketServer_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmnetutil/Socket.h>
+#include<libmnetutil/ServerSocket.h>
+#include<libmnetutil/SocketServer.h>
+#include<libmutil/Thread.h>
+
+class SipLayerTransport;
+
+/**
+ * Purpose: Listens on a TCP or TLS server socket and reports
+ * when a client connects to it.
+ *
+ */
+class SipSocketServer : public SocketServer, InputReadyHandler {
+	public:
+		SipSocketServer(MRef<SipLayerTransport*> r, MRef<Socket*> sock );
+		virtual ~SipSocketServer();
+		void free();
+		std::string getMemObjectType() const {return "SipSocketServer";}
+
+		MRef<Socket *> getSocket() const;
+		MRef<SipLayerTransport *> getReceiver() const;
+		void setReceiver(MRef<SipLayerTransport *> r);
+
+		bool isIpv6() const;
+		int32_t getType() const;
+
+		const std::string &getExternalIp() const { return externalIp; }
+		void setExternalIp( const std::string &ip ) { externalIp = ip; }
+
+		/** Override server port  */
+		void setExternalPort(int32_t port) { externalPort = port; }
+		int32_t getExternalPort() const { return externalPort; }
+
+		virtual void inputReady()=0;
+
+	protected:
+		virtual void inputReady( MRef<Socket*> socket );
+
+	private:
+		MRef<Socket *> ssock;
+		MRef<SipLayerTransport *> receiver;
+		std::string externalIp;
+		int32_t externalPort;
+};
+
+
+// 
+// StreamSocketServer
+// 
+
+class StreamSocketServer : public SipSocketServer{
+	public:
+		StreamSocketServer(MRef<SipLayerTransport*> r, MRef<ServerSocket*> sock );
+		std::string getMemObjectType(){return "StreamSocketServer";}
+		virtual void inputReady();
+};
+
+
+// 
+// DatagramSocketServer
+// 
+class DatagramSocketServer : public SipSocketServer{
+	public:
+		DatagramSocketServer(MRef<SipLayerTransport*> r, MRef<DatagramSocket*> sock );
+		std::string getMemObjectType(){return "DatagramSocketServer";}
+		virtual void inputReady();
+};
+
+
+#endif

Modified: trunk/libmsip/source/SipStack.cxx
===================================================================
--- trunk/libmsip/source/SipStack.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipStack.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -22,10 +22,10 @@
 */
 #include<config.h>
 #include<libmsip/SipStack.h>
-#include<libmsip/SipStackInternal.h>
+#include"SipStackInternal.h"
 
-#include<libmsip/SipLayerTransport.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"SipLayerTransport.h"
+#include"SipCommandDispatcher.h"
 #include<libmsip/SipMessageContentIM.h>
 #include<libmsip/SipMessageContentMime.h>
 #include<libmutil/Timestamp.h>

Modified: trunk/libmsip/source/SipStackInternal.cxx
===================================================================
--- trunk/libmsip/source/SipStackInternal.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/SipStackInternal.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -22,10 +22,10 @@
  *          Mikael Magnusson <mikma at users.sourceforge.net>
 */
 #include<config.h>
-#include<libmsip/SipStackInternal.h>
+#include"SipStackInternal.h"
 
-#include<libmsip/SipLayerTransport.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"SipLayerTransport.h"
+#include"SipCommandDispatcher.h"
 #include<libmsip/SipMessageContentIM.h>
 #include<libmsip/SipMessageContentMime.h>
 #include<libmutil/Timestamp.h>

Copied: trunk/libmsip/source/SipStackInternal.h (from rev 3420, trunk/libmsip/include/libmsip/SipStackInternal.h)
===================================================================
--- trunk/libmsip/source/SipStackInternal.h	                        (rev 0)
+++ trunk/libmsip/source/SipStackInternal.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,121 @@
+/*
+ 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
+ */
+
+/* Copyright (C) 2004, 2005, 2006
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ *          Johan Bilien <jobi at via.ecp.fr>
+*/
+
+
+
+#ifndef _SIPSTACKINTERNAL_H
+#define _SIPSTACKINTERNAL_H
+
+
+#include<libmutil/CommandString.h>
+#include<libmsip/SipDialogConfig.h>
+#include<libmsip/SipTimers.h>
+
+#include"SipLayerTransport.h"
+#include"transactions/SipTransaction.h"
+#include<libmcrypto/cert.h>
+#include<libmutil/MessageRouter.h>
+#include<libmutil/TimeoutProvider.h>
+#include<libmutil/StateMachine.h>
+
+class SipDialog;
+
+class SipStackInternal : public SipSMCommandReceiver, public Runnable{
+
+	public:
+		SipStackInternal( MRef<SipStackConfig*> stackConfig );
+
+		void setTransactionHandlesAck(bool transHandleAck);
+
+		void setDefaultDialogCommandHandler(MRef<SipDefaultHandler*> cb);
+		MRef<SipDefaultHandler*> getDefaultDialogCommandHandler();
+
+		virtual std::string getMemObjectType() const {return "SipStackInternal";}
+		
+                virtual void run();
+		virtual void stopRunning();
+
+		MRef<SipCommandDispatcher*> getDispatcher();
+
+		bool handleCommand(const CommandString &cmd);
+
+		bool handleCommand(const SipSMCommand &command);
+		
+		void setCallback(MRef<CommandReceiver*> callback);	//Rename to setMessageRouterCallback?
+		MRef<CommandReceiver *> getCallback();
+
+		void setConfCallback(MRef<CommandReceiver*> callback); // Hack to make the conference calling work - should not be here FIXME
+		MRef<CommandReceiver *> getConfCallback();
+		
+		void addDialog(MRef<SipDialog*> d);
+
+		/**
+		 * Each SipStack object creates a TimeoutProvider that with
+		 * a thread of it's own keeps track of timers waiting to
+		 * fire. This method is used by the transactions and
+		 * dialogs that wish to use timeouts to retrieve which
+		 * timeout provider to use.
+		 */
+		MRef<TimeoutProvider<std::string, MRef<StateMachine<SipSMCommand,std::string>*> > *> getTimeoutProvider();
+
+		MRef<SipTimers*> getTimers();
+		MRef<SipStackConfig*> getStackConfig();
+
+		void addSupportedExtension(std::string extension);
+		std::string getAllSupportedExtensionsStr();
+		bool supports(std::string extension);
+                
+		std::string getStackStatusDebugString();
+
+		MRef<SipSocketServer *> createUdpServer( bool ipv6, const std::string &ipString );
+		MRef<SipSocketServer *> createTcpServer( bool ipv6, const std::string &ipString );
+		MRef<SipSocketServer *> createTlsServer( bool ipv6, const std::string &ipString );
+
+		void startUdpServer();
+		void startTcpServer();
+		void startTlsServer();
+
+		void free();
+
+	private:
+
+//		std::string getDialogDebugString(MRef<SipDialog*> d, list<MRef<SipTransaction*> > &trans,
+//				list <TPRequest<string,MRef<StateMachine<SipSMCommand,string>*> > > &torequests);
+
+		MRef<SipTimers*> timers;
+		MRef<SipStackConfig *> config;
+		MRef<CommandReceiver*> callback;
+		
+		MRef<CommandReceiver*> confCallback;	//hack to make conference calling work until the ConfMessageRouter is removed
+		
+		//
+		MRef<SipCommandDispatcher*> dispatcher;
+
+		MRef<TimeoutProvider<std::string, MRef<StateMachine<SipSMCommand,std::string>*> > *> timeoutProvider;
+
+		std::list<std::string> sipExtensions;
+};
+
+
+
+
+#endif

Modified: trunk/libmsip/source/dialogs/SipDialog.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialog.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/dialogs/SipDialog.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -30,9 +30,9 @@
 #include<libmsip/SipHeaderContact.h>
 #include<libmsip/SipHeaderFrom.h>
 #include<libmsip/SipHeaderTo.h>
-#include<libmsip/SipTransaction.h>
+#include"../transactions/SipTransaction.h"
 #include<libmsip/SipStack.h>
-#include<libmsip/SipStackInternal.h>
+#include"../SipStackInternal.h"
 #include<libmsip/SipDialogConfig.h>
 #include<libmsip/SipDialog.h>
 #include<libmsip/SipAuthenticationDigest.h>
@@ -49,7 +49,7 @@
 #include<libmsip/SipHeaderProxyAuthenticate.h>
 #include<libmsip/SipHeaderProxyAuthorization.h>
 #include<libmsip/SipHeaderWWWAuthenticate.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipCommandDispatcher.h"
 #include<libmutil/CommandString.h>
 #include<libmutil/termmanip.h>
 

Modified: trunk/libmsip/source/dialogs/SipDialogManagement.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialogManagement.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/dialogs/SipDialogManagement.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -31,8 +31,8 @@
 
 #include<libmsip/SipDialogManagement.h>
 #include<libmsip/SipStack.h>
-#include<libmsip/SipStackInternal.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipStackInternal.h"
+#include"../SipCommandDispatcher.h"
 
 #ifdef DEBUG_OUTPUT
 #include<libmutil/dbg.h>

Modified: trunk/libmsip/source/dialogs/SipDialogRegister.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialogRegister.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/dialogs/SipDialogRegister.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -25,13 +25,11 @@
 #include<config.h>
 
 
-#include<libmsip/SipTransaction.h>
 #include<libmsip/SipStack.h>
 #include<libmsip/SipDialogConfig.h>
 #include<libmsip/SipDialogRegister.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipTransitionUtils.h>
-#include<libmsip/SipTransactionNonInviteClient.h>
 #include<libmsip/SipRequest.h>
 #include<libmsip/SipResponse.h>
 #include<libmsip/SipHeaderContact.h>

Modified: trunk/libmsip/source/messages/SipRequest.cxx
===================================================================
--- trunk/libmsip/source/messages/SipRequest.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/messages/SipRequest.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -36,7 +36,7 @@
 #include<libmsip/SipStack.h>
 #include<libmsip/SipRequest.h>
 #include<libmsip/SipException.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipMessageContentIM.h>
 #include<libmsip/SipHeader.h>
 #include<libmsip/SipHeaderRoute.h>
@@ -271,12 +271,12 @@
 
 	// Skip white space
 	start = build_from.find_first_not_of( ' ', start );
-	if( start == (int)string::npos ){
+	if( (int)start == (int)string::npos ){
 		throw SipExceptionInvalidMessage("SipRequest malformed - first line did not contain any non whitespace character");
 	}
 
 	end = build_from.find_first_of( "\r\n", start );
-	if( end == (int)string::npos ){
+	if( (int)end == (int)string::npos ){
 		throw SipExceptionInvalidMessage("SipRequest malformed - only one line");
 	}
 
@@ -289,7 +289,7 @@
 
 	// Parse method
 	pos = requestLine.find( ' ', start );
-	if( pos == (int)string::npos ){
+	if( (int)pos == (int)string::npos ){
 		throw SipExceptionInvalidMessage("SipRequest malformed - could not find method");
 	}
 
@@ -300,7 +300,7 @@
 
 	// Parse version
 	pos2 = requestLine.rfind( ' ', end - 1 );
-	if( pos2 == (int)string::npos ){
+	if( (int)pos2 == (int)string::npos ){
 		throw SipExceptionInvalidMessage("SipRequest malformed - request line did not contain space between method and version");
 	}
 

Modified: trunk/libmsip/source/transactions/SipTransaction.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransaction.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/transactions/SipTransaction.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -33,19 +33,19 @@
 #include<config.h>
 
 
-#include<libmsip/SipTransaction.h>
-#include<libmsip/SipStackInternal.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"SipTransaction.h"
+#include"../SipStackInternal.h"
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipHeaderVia.h>
-#include<libmsip/SipLayerTransport.h>
+#include"../SipLayerTransport.h"
 #include<libmsip/SipCommandString.h>
 #include<libmutil/dbg.h>
 
-#include<libmsip/SipTransactionInviteClient.h>
-#include<libmsip/SipTransactionInviteServer.h>
-#include<libmsip/SipTransactionInviteServerUA.h>
-#include<libmsip/SipTransactionNonInviteServer.h>
-#include<libmsip/SipTransactionNonInviteClient.h>
+#include"SipTransactionInviteClient.h"
+#include"SipTransactionInviteServer.h"
+#include"SipTransactionInviteServerUA.h"
+#include"SipTransactionNonInviteServer.h"
+#include"SipTransactionNonInviteClient.h"
 #include<libmsip/SipTransitionUtils.h>
 
 using namespace std;

Copied: trunk/libmsip/source/transactions/SipTransaction.h (from rev 3420, trunk/libmsip/include/libmsip/SipTransaction.h)
===================================================================
--- trunk/libmsip/source/transactions/SipTransaction.h	                        (rev 0)
+++ trunk/libmsip/source/transactions/SipTransaction.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,155 @@
+/*
+  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>
+*/
+
+
+/* Name
+ * 	SipTransaction.h
+ * Author
+ * 	Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ * 
+*/
+
+
+#ifndef SIPTRANSACTION_H
+#define SIPTRANSACTION_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmutil/StateMachine.h>
+#include<libmutil/MemObject.h>
+#include<libmsip/SipSMCommand.h>
+#include<libmsip/SipDialogConfig.h>
+#include"../SipLayerTransport.h"
+
+class SipDialog;
+class SipMessage;
+class SipCommandDispatcher;
+class SipLayerTransport;
+class SipStackInternal;
+class Socket;
+
+/**
+ * SipTransaction
+ */
+class SipTransaction : public StateMachine<SipSMCommand,std::string>{
+	public:
+		
+		SipTransaction(MRef<SipStackInternal*> stackInternal, 
+				int cseq, 
+				const std::string &cseqMethod, 
+				const std::string &branch, 
+				const std::string &callid);
+                
+		virtual ~SipTransaction();
+
+		/**
+		 * Creates a new transaction and initiates it using
+		 * the values of a request. This is used by the
+		 * transaction layer to create transactions.
+		 *
+		 * @param stack All transactions operate within a SIP
+		 *              stack.
+		 * @param msg	SIP request that initiates a transaction
+		 * @param fromTU  true if the request is generated by the
+		 *                local UA (client transaction) and false if it has been 
+		 *                received from a remote one (server transaction).
+		 * @param handleAck  TRUE if the "UA" versions of the
+		 *                   INVITE server transactions should be used.
+		 */
+		static MRef<SipTransaction*> create(MRef<SipStackInternal*> stackInternal, 
+				MRef<SipRequest*> msg, 
+				bool fromTU, 
+				bool handleAck=false);
+		
+		virtual std::string getName()=0;
+
+		virtual bool handleCommand(const SipSMCommand &command);
+
+		virtual void handleTimeout(const std::string &c);
+		
+		std::string getBranch();
+		void setBranch(std::string branch);
+				
+		void send(MRef<SipMessage*>  pack, bool addVia, std::string branch=""); // if not specified branch, use the attribute one - ok in most cases.
+		void setSocket(Socket * sock);
+		MRef<Socket *> getSocket();
+
+		virtual std::string getMemObjectType() const;
+		void setDebugTransType(std::string t);
+		std::string getDebugTransType();
+
+		int getCSeqNo();
+		std::string getCSeqMethod();
+                
+		std::string getCallId();
+
+		//The transition to cancel a transaction is common to all
+		//transactions and is defined in this class.
+		bool a1000_anyState_terminated_canceltransaction(const SipSMCommand &command);
+
+		//FIXME: get the reliability correctly
+		bool isUnreliable();
+
+		
+	protected:
+		
+		void setCSeqNo(int n){cSeqNo=n;}
+		MRef<SipCommandDispatcher*> dispatcher;
+		MRef<SipStackInternal*> sipStackInternal;
+		MRef<SipLayerTransport*> transportLayer;
+		MRef<Socket *> socket;
+		
+		std::string callId;
+		
+	private:
+		int cSeqNo;
+		std::string cSeqMethod;
+		std::string branch;
+
+		std::string debugTransType;
+};
+
+
+//All sub-classes of SipTransaction are local to libmsip
+class SipTransactionClient: public SipTransaction{
+        public:
+                SipTransactionClient(MRef<SipStackInternal*> stackInternal, 
+				int seq_no, 
+				const std::string &cSeqMethod, 
+				const std::string &branch, 
+				const std::string &callid);
+                ~SipTransactionClient();
+};
+
+class SipTransactionServer: public SipTransaction{
+        public:
+                SipTransactionServer(MRef<SipStackInternal*> stackInternal, 
+				int seq_no, 
+				const std::string &cSeqMethod, 
+				const std::string &branch, 
+				const std::string &callid);
+                ~SipTransactionServer();
+};
+
+#endif

Modified: trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -78,12 +78,12 @@
 #include<config.h>
 
 
-#include<libmsip/SipTransactionInviteClient.h>
-#include<libmsip/SipTransactionNonInviteClient.h>
+#include"SipTransactionInviteClient.h"
+#include"SipTransactionNonInviteClient.h"
 #include<libmsip/SipResponse.h>
 #include<libmsip/SipHeaderRoute.h>
 #include<libmsip/SipTransitionUtils.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipSMCommand.h>
 #include<libmsip/SipCommandString.h>
 #include<libmsip/SipDialog.h>

Copied: trunk/libmsip/source/transactions/SipTransactionInviteClient.h (from rev 3420, trunk/libmsip/include/libmsip/SipTransactionInviteClient.h)
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteClient.h	                        (rev 0)
+++ trunk/libmsip/source/transactions/SipTransactionInviteClient.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,212 @@
+/*
+  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>
+*/
+
+
+/* Name
+ * 	SipTransactionInviteInitiator.h
+ * Author
+ * 	Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ * 
+*/
+
+
+
+#ifndef SIPTRANSACTIONINVITEICLIENT_H
+#define SIPTRANSACTIONINVITEICLIENT_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmsip/SipSMCommand.h>
+#include"SipTransaction.h"
+
+class SipResponse;
+
+/**
+	Implement an INVITE Transaction Client,
+	as defined in RFC 3261, section 17.1.1
+	
+	It is composed of the following states:
+		start, calling, proceeding, completed, terminated
+	
+	Transition functions between the states are axxx_description().
+	
+	There is a transition from any state into TERMINATED, defined in 
+	the base class SipTransaction::a1000_xxxx()
+	
+	This is a base class for an INVITE transaction client UA
+	(the handling of 2xx responses changes).
+*/
+class SipTransactionInviteClient: public SipTransactionClient{
+	public:
+		SipTransactionInviteClient(MRef<SipStackInternal*> stackInternal, 
+				int seq_no, 
+				const std::string &cSeqMethod, 
+				const std::string &callid);
+		
+		virtual ~SipTransactionInviteClient();
+
+		virtual std::string getMemObjectType() const {return "SipTransactionInvCli";}
+		virtual std::string getName(){return "transaction_invite_client[branch="+getBranch()+"]";}
+
+		void setUpStateMachine();
+		
+		/**
+			Update the parent dialog's route set. 
+			For now, only responses >= 200 update the route-set.
+			FIXME: PRACKs too
+			FIXME: Actually the route set would be better set in the dialog state machine.
+				But it is not possible until the ACK for 2xx responses are handled/sent by
+				the dialog/TU and not by the transaction (in violation of the RFC).
+		*/
+		void setDialogRouteSet(MRef<SipResponse *> resp);
+
+		void sendAck(MRef<SipResponse *>, bool provisional=false); //if no branch specified, use transaction branch attribute
+
+	private:
+		
+		/**
+			Transition from START to CALLING
+			It receives the INVITE message to send from the TU.
+			Start timer A (retx timer), only for unreliable protocols.
+			Start timer B, transaction timeout.
+			Send the INVITE message (transport layer).
+		*/
+		bool a0_start_calling_INVITE( const SipSMCommand &command);
+		
+		/**
+			No Transition, loop CALLING to CALLING
+			Timer A goes off, thus we re-tx the msg and reset the timer
+			using the backoff algorithm (multiply by 2).
+		*/
+		bool a1_calling_calling_timerA( const SipSMCommand &command);
+		
+		/**
+			Transition from CALLING to PROCEEDING
+			If a non final 1xx response is received, we move to the proceeding
+			state. 
+			Timer A is cancelled (no more retx)
+			Timer B is also cancelled, thus we stay in this state until we receive
+			some response from the proxy.
+			Forward the response to the TU.
+		*/
+		bool a2_calling_proceeding_1xx( const SipSMCommand &command);
+		
+		/**
+			Transition from CALLING to COMPLETED
+			If a final response 3xx,4xx,5xx or 6xx is received, we move to the COMPLETED
+			state. 
+			Timer A is cancelled (no more retx)
+			Timer B is also cancelled.
+			Timer D is set (response absorbtion timeout)
+			Forward the response to the TU.
+		*/
+		bool a3_calling_completed_resp36( const SipSMCommand &command);
+		
+		/**
+			Transition from CALLING to TERMINATED
+			A transport error, or timer B (transaction timeout), have happened.
+			Notify the TU about this and that the transaction_terminated.
+			Timer A is cancelled (no more retx)
+			Timer B is also cancelled.
+		*/
+		bool a4_calling_terminated_ErrOrTimerB( const SipSMCommand &command);
+		
+		/**
+			Transition from CALLING to TERMINATED
+			If a final 2xx response is received, we move to the TERMINATED
+			state. 
+			Forward the 2xx to the TU and notify the TU about transaction_terminated.
+			Timer A is cancelled (no more retx)
+			Timer B is also cancelled.
+			
+			Note: this transition does not exhist for INVITE client UA transaction
+		*/
+		bool a5_calling_terminated_2xx( const SipSMCommand &command);
+		
+		/**
+			Loop Transition in PROCEEDING
+			If a non-final 1xx response is received, just notify the TU 
+			about the reception of such.
+			Forward the response to the TU.
+		*/
+		bool a6_proceeding_proceeding_1xx( const SipSMCommand &command);
+		
+		/**
+			Transition from PROCEEDING to TERMINATED
+			Same as a5 transition.
+			
+			Note: this transition does not exhist for INVITE client UA transaction.
+		*/
+		bool a7_proceeding_terminated_2xx( const SipSMCommand &command);
+		
+		/**
+			Transition from PROCEEDING to COMPLETED
+			If a final 3xx,4xx,5xx or 6xx response is received, we move to the COMPLETED
+			state. 
+			Notify the TU about the reception of such response.
+			Timer A is cancelled (no more retx)
+			Timer B is also cancelled.
+			Timer D is set (response absorbtion timeout)
+		*/
+		bool a8_proceeding_completed_resp36( const SipSMCommand &command);
+		
+		/**
+			Loop Transition in COMPLETED
+			If a final 3xx,4xx, 5xx or 6xx response is received, we resend the
+			ACK we previously have sent. 
+			Do NOT forward this responses to the TU.
+		*/
+		bool a9_completed_completed_resp36( const SipSMCommand &command);
+		
+		/**
+			Transition from COMPLETED to TERMINATED
+			Transport Error transition. Notify the TU about the transport error
+			and transaction_terminated.
+			Timer D is cancelled (response absorbtion timeout)
+			Forward the response to the TU.
+		*/
+		bool a10_completed_terminated_TErr( const SipSMCommand &command);
+		
+		/**
+			Transition from COMPLETED to TERMINATED
+			Timer D goes off, thus we have absorbed enough re-txd responses.
+			Notify TU about transaction_terminated.
+		*/
+		bool a11_completed_terminated_timerD( const SipSMCommand &command);
+
+		/**
+		 * If the remote UA requires reliable transmission of 1xx
+		 * responses we need to do some extra processing. This
+		 * method should be called when ever receiving a 1XX
+		 * response to setup the reliable transmission (100rel SIP
+		 * extension, RFC3262)
+		 */
+		//void rel1xxProcessing(MRef<SipResponse*> resp);
+		
+		MRef<SipRequest*> lastInvite;
+//		int timerT1;
+		int timerA;
+};
+
+#endif

Modified: trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -79,11 +79,11 @@
 
 #include<config.h>
 
-#include<libmsip/SipTransactionInviteServer.h>
-#include<libmsip/SipTransactionNonInviteServer.h>
+#include"SipTransactionInviteServer.h"
+#include"SipTransactionNonInviteServer.h"
 #include<libmsip/SipResponse.h>
 #include<libmsip/SipTransitionUtils.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipCommandString.h>
 #include<libmsip/SipDialog.h>
 #include<libmsip/SipDialogConfig.h>

Copied: trunk/libmsip/source/transactions/SipTransactionInviteServer.h (from rev 3420, trunk/libmsip/include/libmsip/SipTransactionInviteServer.h)
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServer.h	                        (rev 0)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServer.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,216 @@
+/*
+  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>
+*/
+
+
+/* Name
+ * 	SipTransactionInviteServer.h
+ * Author
+ * 	Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ * 
+*/
+
+
+
+#ifndef SIPTRANSACTIONINVITESERVER_H
+#define SIPTRANSACTIONINVITESERVER_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmsip/SipSMCommand.h>
+#include"SipTransaction.h"
+
+class SipResponse;
+
+/**
+	Implement an INVITE Transaction Server
+	as defined in RFC 3261, section 17.2.1
+	
+	It is composed of the following states:
+		start, proceeding, completed, confirmed, terminated
+	
+	Transition functions between the states are axxx_description().
+	
+	There is a transition from any state into TERMINATED, defined in 
+	the base class SipTransaction::a1000_xxxx()
+	
+	This is a base class for an INVITE transaction server UA
+	(the handling of 2xx responses changes).
+*/
+class SipTransactionInviteServer : public SipTransactionServer{
+	public:
+		SipTransactionInviteServer(MRef<SipStackInternal *> stackInternal, 
+				int seq_no, 
+				const std::string &cSeqMethod, 
+				const std::string &branch, 
+				const std::string &callid);
+		
+		virtual ~SipTransactionInviteServer();
+
+		virtual std::string getMemObjectType() const {return "SipTransactionInvServer";}
+		virtual std::string getName(){return "transaction_INVITE_responder[branch="+getBranch()+"]";}
+
+		void setUpStateMachine();
+		
+		/**
+			Update the parent dialog's route set. 
+			We are in a server transaction, thus the record-route headers
+			are taken in reverse order to form the route set.
+			FIXME: Actually the route set would be better set in the dialog state machine.
+				But it is not possible until the ACK for 2xx responses are handled/sent by
+				the dialog/TU and not by the transaction (in violation of the RFC).
+		*/
+		void setDialogRouteSet(MRef<SipRequest*> inv);
+
+
+		void sendTrying();
+		void sendOk();
+		void sendRinging();
+		void sendReject();
+
+	protected:
+		MRef<SipResponse*> lastResponse;
+		MRef<SipResponse*> lastReliableResponse;
+		int timerG;
+		int timerRel1xxResend;
+
+	private:
+		
+		/**
+		Transition from START to PROCEEDING
+		The first command a INVITE server transaction receives is an INVITE
+		packet. It forwards the packet to the TU/call. We send no 1xx since we
+ 		expect a response from the TU in less than 200 ms.
+		*/
+		bool a0_start_proceeding_INVITE( const SipSMCommand &command);
+		
+		/**
+		Loop in PROCEEDING state
+		If we receive the INVITE packet _again_, our response was probably lost.
+		In that case we retransmit it. 
+		Note: We expected that the TU/Call would answer before the remote side
+		retransmitted. 
+		TODO: Implement an option to send 100 trying in action "a0".
+		*/
+		bool a1_proceeding_proceeding_INVITE( const SipSMCommand &command);
+
+		/**
+		Loop in PROCEEDING state.
+		If a "1xx" response is received from the TU(/call), 
+		send it to the remote side and 
+		save it in case we need to retransmit it.
+		*/		
+		bool a2_proceeding_proceeding_1xx( const SipSMCommand &command);
+		
+		/**
+		Transition from PROCEEDING to COMPLETED
+		If a response (non 2xx/1xx) is received from the TU/Call, we send it to
+		the remote side. 
+		We save it in case we need to retransmit it later.
+		Set "timerH", wait time for an ACK.
+		Set "timerG", response re-tx interval (only if unreliable transport)
+		*/
+		bool a3_proceeding_completed_resp36( const SipSMCommand &command);
+		
+		/**
+		Transition from PROCEEDING to TERMINATED
+		If we receive a "transport_error" indication, 
+		we inform the TU and go to the terminated state.
+		//FIXME: There is currently no one giving this command to the transaction
+		layer (EE, r241).
+		*/
+		bool a4_proceeding_terminated_err( const SipSMCommand &command);
+
+		/**
+		Transiton from PROCEEDING to TERMINATED
+		If a 2xx response is received from the TU/Call,
+		  it is sent to the remote side 
+		  and the transaction terminates. 
+		Note that the ACK is not yet handled when a 
+		  2xx terminates the INVITE server transaction.
+		*/
+		bool a5_proceeding_terminated_2xx( const SipSMCommand &command);
+		
+		/**
+		Loop in COMPLETED state.
+		If we receive the INVITE again from the TU, the response has been lost. 
+		We retransmit the response again without informing the TU.
+		*/
+		bool a6_completed_completed_INVITE( const SipSMCommand &command);
+
+		/**
+		Transition from COMPLETED to CONFIRMED state.
+		If we receive an ACK while in COMPLETED, we go to the "confirmed" state
+		without informing the TU.
+		Schedule for transaction termination using timer I.
+		All other timers are cancelled.
+		*/
+		bool a7_completed_confirmed_ACK( const SipSMCommand &command);
+		
+		/**
+		Loop in COMPLETED state.
+		If timer G fires when in the "completed" state, we have not received an
+		"ACK" to our response (3xx-6xx). 
+		Resend the response and hope for an "ACK" before a transaction
+		timeout (timer H).
+		*/
+		bool a8_completed_completed_timerG( const SipSMCommand &command);
+
+		/**
+		Transition from COMPLETED to TERMINATED
+		If there is a transport error 
+		or 
+		if timerH fires, 
+		we failed to receive an ACK after several re-sends. 
+		We inform the TU/Call and go to the terminated state.
+		*/
+		bool a9_completed_terminated_errOrTimerH( const SipSMCommand &command);
+		
+		/**
+		Transition from CONFIRMED to TERMINATED
+		When timer I fires, we stop absorbing ACKs.
+		Move to TERMINATED and inform TU.
+		*/
+		bool a10_confirmed_terminated_timerI( const SipSMCommand &command);
+
+		/**
+		Absorb ACKs while in confirmed state.
+		*/
+		bool a11_confirmed_confirmed_ACK(const SipSMCommand&);
+
+		/**
+		Transition from PROCEEDING to PROCEEDING
+		When timer timerRel1xxResend fires, we resend the 1XX response
+		and double the timer value.
+		This is used for the RFC3262 "100rel" SIP extension.
+		*/
+		bool a20_proceeding_proceeding_timerRel1xxResend( const SipSMCommand &command);
+		
+		bool user_has_accepted;
+		bool user_has_rejected;
+
+		std::string key_mgmt;
+		int32_t key_mgmt_method;
+};
+
+#endif

Modified: trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -81,10 +81,10 @@
 #include<config.h>
 
 #include<libmutil/massert.h>
-#include<libmsip/SipTransactionInviteServerUA.h>
+#include"SipTransactionInviteServerUA.h"
 #include<libmsip/SipResponse.h>
 #include<libmsip/SipTransitionUtils.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipDialog.h>
 #include<libmsip/SipDialogConfig.h>
 

Copied: trunk/libmsip/source/transactions/SipTransactionInviteServerUA.h (from rev 3420, trunk/libmsip/include/libmsip/SipTransactionInviteServerUA.h)
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServerUA.h	                        (rev 0)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServerUA.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,83 @@
+/*
+  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>
+*/
+
+
+/* Name
+ * 	SipTransactionInviteInitiator.h
+ * Author
+ * 	Erik Eliasson, eliasson at it.kth.se
+ * Purpose
+ * 
+*/
+
+
+
+#ifndef SIPTRANSACTIONINVITESERVERUA_H
+#define SIPTRANSACTIONINVITESERVERUA_H
+
+#include<libmsip/libmsip_config.h>
+
+#include<libmsip/SipSMCommand.h>
+#include"SipTransactionInviteServer.h"
+
+class SipResponse;
+
+/**
+	Implement an INVITE Transaction Server UAC,
+	as defined in RFC 3261, section 17.2.1
+	
+	It is composed of the following states:
+		start, proceeding, completed, confirmed, terminated
+
+	Transition functions between the states are axxx_description().
+	
+	There is a transition from any state into TERMINATED, defined in 
+	the base class SipTransaction::a1000_xxxx()
+	
+	All transitions are the same as for the parent class, except for
+	a5, which is substituted by a1001.
+*/
+class SipTransactionInviteServerUA: public SipTransactionInviteServer{
+	public:
+		SipTransactionInviteServerUA(MRef<SipStackInternal*> stackInternal, 
+				int seq_no, 
+				const std::string &cSeqMethod, 
+				const std::string &branch, 
+				const std::string &callid);
+		
+		virtual ~SipTransactionInviteServerUA();
+
+		virtual std::string getMemObjectType() const {return "SipTransactionInvServerUA";}
+		virtual std::string getName(){return "transaction_ua_invite_server[branch="+getBranch()+"]";}
+
+		void changeStateMachine();
+
+	private:
+		/**
+		Transiton from PROCEEDING to COMPLETED
+		(substitutes a5 from the parent class).
+		*/
+		bool a1001_proceeding_completed_2xx( const SipSMCommand &command);
+};
+
+#endif

Modified: trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx	2007-09-06 16:34:31 UTC (rev 3420)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx	2007-09-06 18:44:33 UTC (rev 3421)
@@ -84,8 +84,8 @@
 #include<config.h>
 
 #include<libmutil/massert.h>
-#include<libmsip/SipTransactionNonInviteClient.h>
-#include<libmsip/SipCommandDispatcher.h>
+#include"SipTransactionNonInviteClient.h"
+#include"../SipCommandDispatcher.h"
 #include<libmsip/SipResponse.h>
 #include<libmsip/SipTransitionUtils.h>
 #include<libmsip/SipCommandString.h>

Copied: trunk/libmsip/source/transactions/SipTransactionNonInviteClient.h (from rev 3420, trunk/libmsip/include/libmsip/SipTransactionNonInviteClient.h)
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteClient.h	                        (rev 0)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteClient.h	2007-09-06 18:44:33 UTC (rev 3421)
@@ -0,0 +1,164 @@
+/*
+  Copyr