realtimenetprots/sipfw/SIP/sipapi/src/sip.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          : sip.cpp
       
    15 // Part of       : SIPAPI
       
    16 // Version       : SIP/4.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "SipAssert.h"
       
    22 #include "sipstrings.h"
       
    23 #include "sip.h"
       
    24 #include "SipImplementation.h"
       
    25 
       
    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 // CSIP::NewL
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CSIP* CSIP::NewL(const TUid& aUid, MSIPObserver& aObserver)
       
    42 	{
       
    43     CSIP* self = CSIP::NewLC(aUid, aObserver);
       
    44     CleanupStack::Pop(self);
       
    45     return self;
       
    46 	}
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CSIP::NewLC
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CSIP* CSIP::NewLC(const TUid& aUid, MSIPObserver& aObserver)
       
    53 	{   
       
    54     CSIP* self = new (ELeave) CSIP();
       
    55     CleanupStack::PushL(self);
       
    56     self->ConstructL(aUid, aObserver);
       
    57     return self;
       
    58 	}
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CSIP::CSIP
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CSIP::CSIP()
       
    65 	{
       
    66 	}
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSIP::ConstructL
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 void CSIP::ConstructL(const TUid& aUid, MSIPObserver& aObserver)
       
    73 	{
       
    74 	SIPStrings::OpenL();
       
    75 
       
    76 	iImplementation = CSIPImplementation::NewL(aUid, aObserver);
       
    77 	}
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CSIP::~CSIP
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C CSIP::~CSIP()
       
    84 	{
       
    85     delete iImplementation;
       
    86     
       
    87     SIPStrings::Close();
       
    88 	}
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CSIP::SupportedSecurityMechanismsL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C CDesC8Array* CSIP::SupportedSecurityMechanismsL() const
       
    95     {
       
    96     __TEST_INVARIANT;
       
    97     return iImplementation->SupportedSecurityMechanismsL();
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CSIP::IsSigCompSupportedL
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 EXPORT_C TBool CSIP::IsSigCompSupportedL() const
       
   105     {
       
   106     __TEST_INVARIANT;
       
   107     return iImplementation->IsSigCompSupportedL();
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CSIP::NegotiatedSecurityMechanismL
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C HBufC8* CSIP::NegotiatedSecurityMechanismL(const TDesC8& aHop)
       
   115 	{
       
   116 	__TEST_INVARIANT;
       
   117 	return iImplementation->NegotiatedSecurityMechanismL(aHop);
       
   118 	}
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CSIP::Connection
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 EXPORT_C CSIPConnection* CSIP::Connection(TUint32 aIapId) const
       
   125     {
       
   126     __TEST_INVARIANT;
       
   127     return iImplementation->Connection(aIapId);
       
   128 	}
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CSIP::SetSecurityHandlingL
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C void CSIP::SetSecurityHandlingL(TBool aEnabled)
       
   135     {
       
   136     __TEST_INVARIANT;
       
   137     iImplementation->SetSecurityHandlingL(aEnabled);
       
   138     }
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CSIP::IsSecurityHandlingEnabled
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 EXPORT_C TBool CSIP::IsSecurityHandlingEnabled() const
       
   145     {
       
   146     __TEST_INVARIANT;
       
   147     return iImplementation->IsSecurityHandlingEnabled();
       
   148     }
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // CSIP::Implementation
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 CSIPImplementation& CSIP::Implementation()
       
   155 	{
       
   156 	__TEST_INVARIANT;
       
   157 	return *iImplementation;
       
   158 	}
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CSIP::__DbgTestInvariant
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 
       
   165 void CSIP::__DbgTestInvariant() const
       
   166 	{
       
   167     if (!iImplementation)
       
   168 		{	
       
   169 		User::Invariant();
       
   170 		}
       
   171 	}