realtimenetprots/sipfw/SIP/sipapi/src/sipdialog.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2003-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          : SIPDialog.cpp
       
    15 // Part of       : SIPAPI
       
    16 // Version       : SIP/4.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include <uri8.h>
       
    22 #include "SipDialogImplementation.h"
       
    23 #include "SipConnectionImplementation.h"
       
    24 #include "sipfromheader.h"
       
    25 #include "siptoheader.h"
       
    26 
       
    27 #ifdef CPPUNIT_TEST
       
    28 
       
    29 #include "TestCleanupStack.h"
       
    30 
       
    31 #undef EXPORT_C
       
    32 #define EXPORT_C
       
    33 
       
    34 #endif
       
    35 
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CSIPDialog::NewL
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CSIPDialog* CSIPDialog::NewL(CSIPConnectionImplementation& aConnImplementation)
       
    42     {
       
    43     CSIPDialog* self = CSIPDialog::NewLC(aConnImplementation);
       
    44     CleanupStack::Pop(self);
       
    45     return self;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CSIPDialog::NewLC
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CSIPDialog* CSIPDialog::NewLC(CSIPConnectionImplementation& aConnImplementation)
       
    53     {
       
    54     CSIPDialog* self = new (ELeave) CSIPDialog();
       
    55     CleanupStack::PushL(self);
       
    56     self->ConstructL(aConnImplementation);
       
    57     return self;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CSIPDialog::NewL
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CSIPDialog* CSIPDialog::NewL(CSIPConnectionImplementation& aConnImplementation,
       
    65                              const MSIPRegistrationContext& aContext)
       
    66     {
       
    67     CSIPDialog* self = CSIPDialog::NewLC(aConnImplementation, aContext);
       
    68     CleanupStack::Pop(self);
       
    69     return self;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CSIPDialog::NewLC
       
    74 // -----------------------------------------------------------------------------
       
    75 //	
       
    76 CSIPDialog* CSIPDialog::NewLC(CSIPConnectionImplementation& aConnImplementation,
       
    77                               const MSIPRegistrationContext& aContext)
       
    78     {    
       
    79     CSIPDialog* self = new (ELeave) CSIPDialog();
       
    80     CleanupStack::PushL(self);
       
    81     self->ConstructL(aConnImplementation, aContext);
       
    82     return self;
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CSIPDialog::CSIPDialog
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 CSIPDialog::CSIPDialog()
       
    90     {
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CSIPDialog::ConstructL
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void CSIPDialog::ConstructL(CSIPConnectionImplementation& aConnImplementation)
       
    98     {    
       
    99     iImplementation = CSIPDialogImplementation::NewL(this, aConnImplementation);
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CSIPDialog::ConstructL
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 void CSIPDialog::ConstructL(CSIPConnectionImplementation& aConnImplementation,
       
   107                    			const MSIPRegistrationContext& aContext)
       
   108 	{
       
   109 	iImplementation = CSIPDialogImplementation::NewL(this,
       
   110 													 aConnImplementation,
       
   111 													 aContext);
       
   112 	}
       
   113                		
       
   114 // -----------------------------------------------------------------------------
       
   115 // CSIPDialog::~CSIPDialog
       
   116 // Doesn't own iImplementation
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 CSIPDialog::~CSIPDialog()
       
   120     {    
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CSIPDialog::State
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 EXPORT_C CSIPDialog::TState CSIPDialog::State() const
       
   128     {
       
   129     __TEST_INVARIANT;
       
   130     return iImplementation->State();   
       
   131     }
       
   132 
       
   133 // -----------------------------------------------------------------------------
       
   134 // CSIPDialog::SIPDialogAssociations
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 EXPORT_C const RPointerArray<CSIPDialogAssocBase>&
       
   138 CSIPDialog::SIPDialogAssociations() const
       
   139     {
       
   140     __TEST_INVARIANT;
       
   141     return iImplementation->SIPDialogAssociations();
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CSIPDialog::RegistrationContext
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C const MSIPRegistrationContext* CSIPDialog::RegistrationContext() const
       
   149     {
       
   150     __TEST_INVARIANT;
       
   151     return iImplementation->RegistrationContext();
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CSIPDialog::IsAssociated
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 EXPORT_C TBool
       
   159 CSIPDialog::IsAssociated(const CSIPDialogAssocBase& aDialogAssoc) const
       
   160     {
       
   161     __TEST_INVARIANT;
       
   162     return iImplementation->IsAssociated(aDialogAssoc);
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // CSIPDialog::Connection
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 EXPORT_C CSIPConnection* CSIPDialog::Connection()
       
   170     {
       
   171     __TEST_INVARIANT;
       
   172    	return iImplementation->Connection();
       
   173     }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CSIPDialog::Connection
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 EXPORT_C const CSIPConnection* CSIPDialog::Connection() const
       
   180     {
       
   181     __TEST_INVARIANT;
       
   182 	return iImplementation->Connection();
       
   183     }
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // CSIPDialog::FromHeader
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 EXPORT_C const CSIPFromHeader& CSIPDialog::FromHeader() const
       
   190     {
       
   191     __TEST_INVARIANT;
       
   192     return iImplementation->FromHeader();
       
   193     }
       
   194 
       
   195 // -----------------------------------------------------------------------------
       
   196 // CSIPDialog::ToHeader
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 EXPORT_C const CSIPToHeader& CSIPDialog::ToHeader() const
       
   200     {
       
   201     __TEST_INVARIANT;
       
   202     return iImplementation->ToHeader();
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CSIPDialog::RemoteURI
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 EXPORT_C const CUri8& CSIPDialog::RemoteURI() const
       
   210     {
       
   211     __TEST_INVARIANT;
       
   212     return iImplementation->RemoteURI();
       
   213     }
       
   214 
       
   215 // -----------------------------------------------------------------------------
       
   216 // CSIPDialog::CallIdL
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 EXPORT_C const CSIPCallIDHeader& CSIPDialog::CallIdL() const
       
   220 	{
       
   221 	__TEST_INVARIANT;
       
   222 	return iImplementation->CallIdL();	
       
   223 	}
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CSIPDialog::operator==
       
   227 // -----------------------------------------------------------------------------
       
   228 //
       
   229 EXPORT_C TBool CSIPDialog::operator==(const CSIPDialog& aDialog) const    
       
   230     {
       
   231     __TEST_INVARIANT;
       
   232     return *iImplementation == *aDialog.iImplementation;
       
   233     }
       
   234 
       
   235 // -----------------------------------------------------------------------------
       
   236 // CSIPDialog::ReuseInitialRequestData
       
   237 // -----------------------------------------------------------------------------
       
   238 //
       
   239 EXPORT_C TInt CSIPDialog::ReuseInitialRequestData()
       
   240     {
       
   241     __TEST_INVARIANT;
       
   242     return iImplementation->ReuseInitialRequestData();
       
   243     }
       
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // CSIPDialog::Implementation
       
   247 // -----------------------------------------------------------------------------
       
   248 //
       
   249 CSIPDialogImplementation& CSIPDialog::Implementation()
       
   250 	{
       
   251 	__TEST_INVARIANT;
       
   252 	return *iImplementation;
       
   253 	}
       
   254 	
       
   255 // -----------------------------------------------------------------------------
       
   256 // CSIPDialog::__DbgTestInvariant
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 
       
   260 void CSIPDialog::__DbgTestInvariant() const
       
   261 	{
       
   262 	if (!iImplementation)
       
   263 		{		
       
   264 		User::Invariant();
       
   265 		}
       
   266 	}