realtimenetprots/sipfw/SIP/TransactionUser/src/NormalUAS.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : NormalUAS.cpp
       
    15 // Part of       : TransactionUser
       
    16 // Version       : SIP/4.0
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "SipAssert.h"
       
    22 #include "TransactionMgr.h"
       
    23 
       
    24 #include "NormalUAS.h"
       
    25 #include "UserAgentTimer.h"
       
    26 
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CNormalUAS::NewL
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CNormalUAS* CNormalUAS::NewL(CUserAgentCreateParams& aParams,							
       
    33 							 MSipConnectionMgr& aConnectionMgr,					
       
    34 							 MSIPRequestRouter& aRouter,
       
    35                              MSipDialogs& aDialogs)
       
    36 	{
       
    37 	CNormalUAS* self = new (ELeave) CNormalUAS(aParams, aDialogs, aRouter);
       
    38 	CleanupStack::PushL(self);	
       
    39 	self->ConstructL(aConnectionMgr);
       
    40 	CleanupStack::Pop(self);
       
    41 	return self;
       
    42 	}
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CNormalUAS::CNormalUAS
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CNormalUAS::CNormalUAS(CUserAgentCreateParams& aParams,
       
    49 					   MSipDialogs& aDialogs,
       
    50 					   MSIPRequestRouter& aRouter) :
       
    51 	CUserAgentServer(aParams, aDialogs, aRouter)
       
    52 	{
       
    53 	}
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CNormalUAS::ConstructL
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void CNormalUAS::ConstructL(MSipConnectionMgr& aConnectionMgr)
       
    60 	{
       
    61 	CUserAgent::ConstructL(aConnectionMgr);
       
    62 	CreateTransactionL();
       
    63 	}
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CNormalUAS::~CNormalUAS
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CNormalUAS::~CNormalUAS()
       
    70 	{
       
    71 	CancelAllTimers();
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CNormalUAS::CreateTransactionL
       
    76 // Creates the kind of CTransaction used by NormalUAS
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 void CNormalUAS::CreateTransactionL()
       
    80 	{
       
    81     __SIP_ASSERT_LEAVE(!iTransaction, KErrAlreadyExists);
       
    82     __SIP_ASSERT_LEAVE(iTransmitter, KErrNotFound);
       
    83 
       
    84 	iTransaction = iTransactionMgr.CreateTransactionL(
       
    85 										CTransactionBase::KServerTransaction,
       
    86 										*this,
       
    87 										*iTransmitter,
       
    88 										iTimerValues);
       
    89 	}
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CNormalUAS::DeleteTimer
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CNormalUAS::DeleteTimer(const CUserAgentTimer& aTimer)
       
    96 	{	
       
    97     if (&aTimer == iTimerOwnerResolver)
       
    98         {
       
    99         StopTimerOwnerResolver();
       
   100         }	
       
   101 	}
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CNormalUAS::CancelAllTimers
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CNormalUAS::CancelAllTimers()
       
   108 	{	
       
   109 	StopTimerOwnerResolver();
       
   110 	}
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CNormalUAS::Ptr
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 CNormalUAS& CNormalUAS::Ptr(CUserAgent& aUserAgent)
       
   117 	{
       
   118 	return static_cast<CNormalUAS&>(aUserAgent);
       
   119 	}