realtimenetprots/sipfw/ProfileAgent/profile_fsm/src/Sipprflstatebase.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2007-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        : sipprflstatebase.cpp
       
    15 // Part of     : sip profile fsm
       
    16 // implementation
       
    17 // Version     : %version: 2.1.1 %
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "sipprflstatebase.h"
       
    24 #include "sipconcreteprofile.h"
       
    25 #include "sipprofileagentobserver.h"
       
    26 #include "sipregistrationbinding.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CSIPPrflStateBase::CSIPPrflStateBase
       
    32 // (other items were commented in a header).
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CSIPPrflStateBase::CSIPPrflStateBase(
       
    36     MSIPProfileFSMUser& aUser,
       
    37     MSIPProfileContext::TSIPProfileState aName)
       
    38     : iUser(aUser), 
       
    39       iName(aName)
       
    40 	{
       
    41 	}
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CSIPPrflStateBase::CSIPPrflStateBase
       
    45 // (other items were commented in a header).
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CSIPPrflStateBase::~CSIPPrflStateBase()
       
    49 	{
       
    50 	}
       
    51 	
       
    52 // -----------------------------------------------------------------------------
       
    53 // CSIPPrflStateBase::Name()
       
    54 // (other items were commented in a header).
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C MSIPProfileContext::TSIPProfileState CSIPPrflStateBase::Name() const
       
    58 	{
       
    59 	return iName;
       
    60 	}	
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CSIPPrflStateBase::RegisterL()
       
    64 // (other items were commented in a header).
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CSIPPrflStateBase::RegisterL(
       
    68 	MSIPProfileContext& /*aContext*/)
       
    69 	{
       
    70 	User::Leave(KErrTotalLossOfPrecision);
       
    71 	}
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CSIPPrflStateBase::DeregisterL()
       
    75 // (other items were commented in a header).
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CSIPPrflStateBase::DeregisterL(
       
    79 	MSIPProfileContext& /*aContext*/)
       
    80 	{
       
    81 	User::Leave(KErrTotalLossOfPrecision);
       
    82 	}
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CSIPPrflStateBase::UpdateL()
       
    86 // (other items were commented in a header).
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CSIPPrflStateBase::UpdateL(
       
    90 	MSIPProfileContext& /*aContext*/,
       
    91 	CSIPConcreteProfile& /*aNewProfile*/)
       
    92 	{
       
    93 	User::Leave(KErrTotalLossOfPrecision);
       
    94 	}
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CSIPPrflStateBase::ResponseReceived()
       
    98 // (other items were commented in a header).
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CSIPPrflStateBase::ResponseReceived(
       
   102 	MSIPProfileContext& /*aContext*/,
       
   103 	CSIPClientTransaction& /*aTransaction*/)
       
   104 	{
       
   105 	}
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CSIPPrflStateBase::ErrorOccurred()
       
   109 // (other items were commented in a header).
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 void CSIPPrflStateBase::ErrorOccured(
       
   113 	MSIPProfileContext& /*aContext*/,
       
   114 	TInt /*aError*/)
       
   115 	{
       
   116 	}
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CSIPPrflStateBase::ConnectionStateChanged()
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 void CSIPPrflStateBase::ConnectionStateChanged(
       
   124 	MSIPProfileContext& /*aContext*/,
       
   125 	CSIPConnection::TState /*aState*/)
       
   126 	{
       
   127 	}
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CSIPPrflStateBase::ChangeRegistrationStateL()
       
   131 // (other items were commented in a header).
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CSIPPrflStateBase::ChangeRegistrationStateL(
       
   135 	MSIPProfileContext& /*aContext*/)
       
   136 	{
       
   137 	User::Leave(KErrTotalLossOfPrecision);
       
   138 	}
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CSIPPrflStateBase::IsRegisterPending()
       
   142 // (other items were commented in a header).
       
   143 // -----------------------------------------------------------------------------
       
   144 //	
       
   145 TBool CSIPPrflStateBase::IsRegisterPending() const
       
   146     {
       
   147     return EFalse;
       
   148     }
       
   149     
       
   150 // -----------------------------------------------------------------------------
       
   151 // CSIPPrflStateBase::ProxyResolvingRequestCompleteL()
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 void CSIPPrflStateBase::ProxyResolvingRequestCompleteL(
       
   155     MSIPProfileContext& /*aContext*/,
       
   156     MDesC8Array& /*aProxies*/)
       
   157     {
       
   158     User::Leave(KErrTotalLossOfPrecision);
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CSIPPrflStateBase::ProxyResolvingRequestFailed()
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 void CSIPPrflStateBase::ProxyResolvingRequestFailed(
       
   166     MSIPProfileContext& /*aContext*/,
       
   167     TInt /*aError*/)
       
   168     {
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CSIPPrflStateBase::IsIdle()
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 TBool CSIPPrflStateBase::IsIdle( MSIPProfileContext& /*aContext*/ )
       
   176     {
       
   177     return EFalse;
       
   178     }
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CSIPPrflStateBase::HandleError()
       
   182 // (other items were commented in a header).
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 void CSIPPrflStateBase::HandleError(
       
   186 	MSIPProfileContext& aContext,
       
   187 	TInt aError,
       
   188 	CSIPPrflStateBase* aNextState)
       
   189 	{
       
   190 	__ASSERT_DEBUG(aContext.Profile()!=0, User::Invariant());
       
   191 	TUint32	contextId(0);
       
   192 	CSIPConcreteProfile& profile = DoCleanup(aContext,contextId);
       
   193 	aContext.SetNextState(*aNextState);
       
   194 	aContext.AgentObserver().SIPProfileErrorEvent(profile,aError);
       
   195 	}
       
   196 
       
   197 // -----------------------------------------------------------------------------
       
   198 // CSIPPrflStateBase::DoCleanup()
       
   199 // (other items were commented in a header).
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 CSIPConcreteProfile& CSIPPrflStateBase::DoCleanup(
       
   203 	MSIPProfileContext& aContext, 
       
   204 	TUint32& aContextId)
       
   205 	{
       
   206 	__ASSERT_DEBUG(aContext.Profile()!=0, User::Invariant());
       
   207 	CSIPConcreteProfile& profile = *(aContext.Profile());
       
   208 	aContext.ForgetProfile();
       
   209 	aContextId = 0;
       
   210 	if (aContext.Registration())
       
   211 	    {
       
   212 	    aContextId = aContext.Registration()->ContextId();
       
   213 	    }
       
   214 	aContext.DestroyRegistration();
       
   215 	return profile;
       
   216 	}