applayerprotocols/httpexamples/nwsswsptrhnd/CNwssWspTransportHandler.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2002-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 //
       
    15 
       
    16 
       
    17 // System includes
       
    18 //
       
    19 #include <wsp/mwspcosessioncallback.h>
       
    20 #include <wsp/mwspcomethodcallback.h>
       
    21 #include <wsp/mwspproxyinfoprovider.h>
       
    22 #include <wsp/mwspsessionheadersprovider.h>
       
    23 #include <wsp/mwspcapabilityprovider.h>
       
    24 #include <wsp/mwspcapabilityviewer.h>
       
    25 #include <wsp/mwspcapabilitysetter.h>
       
    26 #include <wsp/mwspextendedmethods.h>
       
    27 #include <wsp/mwspheadercodepages.h>
       
    28 #include <wsp/mwspaliasaddresses.h>
       
    29 #include <wsp/mwspunknowncapabilities.h>
       
    30 #include <http/mhttpdatasupplier.h>
       
    31 #include <uri8.h>
       
    32 
       
    33 // Local includes
       
    34 //
       
    35 #include "tnwsswsptrhndpanic.h"
       
    36 #include "testoom.h"
       
    37 
       
    38 // Class signature
       
    39 //
       
    40 #include "CNwssWspTransportHandler.h"
       
    41 
       
    42 
       
    43 // Constants used in this file
       
    44 //
       
    45 
       
    46 
       
    47 //
       
    48 // Implementation of class  'CNwssWspTransportHandler'
       
    49 //
       
    50 
       
    51 CNwssWspTransportHandler* CNwssWspTransportHandler::NewL(TAny* aInstantiationParams)
       
    52 	{
       
    53 	CNwssWspTransportHandler* me = new(ELeave)CNwssWspTransportHandler(aInstantiationParams);
       
    54 	CleanupStack::PushL(me);
       
    55 	me->ConstructL();
       
    56 	CleanupStack::Pop(me);
       
    57 	return me;
       
    58 	}
       
    59 
       
    60 CNwssWspTransportHandler::CNwssWspTransportHandler(TAny* aInstantiationParams)
       
    61 : CWspTransportHandler(*(REINTERPRET_CAST(CWspTransportHandler::SInstantiationParams*, aInstantiationParams)->iStringPool),
       
    62 					    (REINTERPRET_CAST(CWspTransportHandler::SInstantiationParams*, aInstantiationParams)->iSecurityPolicy),
       
    63 					   *(REINTERPRET_CAST(CWspTransportHandler::SInstantiationParams*, aInstantiationParams)->iSessionCB),
       
    64 					   *(REINTERPRET_CAST(CWspTransportHandler::SInstantiationParams*, aInstantiationParams)->iProxyInfoProv),
       
    65 					   *(REINTERPRET_CAST(CWspTransportHandler::SInstantiationParams*, aInstantiationParams)->iCapProv),
       
    66 					   *(REINTERPRET_CAST(CWspTransportHandler::SInstantiationParams*, aInstantiationParams)->iSessHdrProv))
       
    67 	{
       
    68 	}
       
    69 
       
    70 CNwssWspTransportHandler::~CNwssWspTransportHandler()
       
    71 	{
       
    72 	delete iWspCOSession;
       
    73 	iWapStackHnd.Close();
       
    74 	}
       
    75 
       
    76 CWspTransportHandler::TWspSupportedServices CNwssWspTransportHandler::SupportedServices() const
       
    77 	{
       
    78 	// report what this plug-in can support
       
    79 	return CWspTransportHandler::ECOSessionService | CWspTransportHandler::ECOMethodInvocationService;
       
    80 	}
       
    81 
       
    82 void CNwssWspTransportHandler::ConstructL()
       
    83 	{
       
    84 	// Create a Connection-Oriented session handler
       
    85 	MSecurityPolicy* secPol = (iSecurityPolicy? iSecurityPolicy : this);
       
    86 	iWspCOSession = CNwssWspCOSession::NewL(iStringPool, *this, *this, *secPol, iSessionCB);
       
    87 
       
    88 	// Connect to the WAP Stack server.  Leave if this fails.
       
    89 	__TESTOOMD(stkErr, iWapStackHnd.Connect());
       
    90 	User::LeaveIfError(stkErr);
       
    91 	}
       
    92 
       
    93 MWspCOSessionInvoker& CNwssWspTransportHandler::COSessionInvoker()
       
    94 	{
       
    95 	return *iWspCOSession;
       
    96 	}
       
    97 
       
    98 MWspCOMethodInvoker& CNwssWspTransportHandler::COTransactionInvoker()
       
    99 	{
       
   100 	return *iWspCOSession;
       
   101 	}
       
   102 
       
   103 MWspCOPushInvoker& CNwssWspTransportHandler::COPushInvoker()
       
   104 	{
       
   105 	TNwssWspTrHndPanic::Panic(TNwssWspTrHndPanic::ECOPushNotSupported);
       
   106 	return (MWspCOPushInvoker&)(*(MWspCOSessionInvoker*)NULL);
       
   107 	}
       
   108 
       
   109 MWspCLMethodInvoker& CNwssWspTransportHandler::CLMethodInvoker()
       
   110 	{
       
   111 	TNwssWspTrHndPanic::Panic(TNwssWspTrHndPanic::EConnectionLessNotSupported);
       
   112 	return (MWspCLMethodInvoker&)(*(MWspCOSessionInvoker*)NULL);
       
   113 	}
       
   114 
       
   115 MWspCLPushInvoker& CNwssWspTransportHandler::CLPushInvoker()
       
   116 	{
       
   117 	TNwssWspTrHndPanic::Panic(TNwssWspTrHndPanic::EConnectionLessNotSupported);
       
   118 	return (MWspCLPushInvoker&)(*(MWspCOSessionInvoker*)NULL);
       
   119 	}
       
   120 
       
   121 RWAPServ& CNwssWspTransportHandler::WapStack()
       
   122 	{
       
   123 	return iWapStackHnd;
       
   124 	}
       
   125 
       
   126 MWspProxyInfoProvider& CNwssWspTransportHandler::ProxyInfoProvider() const
       
   127 	{
       
   128 	return iProxyInfoProv;
       
   129 	}
       
   130 
       
   131 MWspCapabilityProvider& CNwssWspTransportHandler::CapabilityProvider() const
       
   132 	{
       
   133 	return iCapProv;
       
   134 	}
       
   135 
       
   136 MWspSessionHeadersProvider& CNwssWspTransportHandler::SessionHeadersProvider() const
       
   137 	{
       
   138 	return iSessHdrProv;
       
   139 	}
       
   140 
       
   141 void
       
   142 CNwssWspTransportHandler::ValidateUntrustedServerCert(TCertInfo& /*aServerCert*/,
       
   143 													  TRequestStatus& aStatus) const
       
   144 	{
       
   145 	TRequestStatus* stat = &aStatus;
       
   146 	User::RequestComplete(stat, KErrNone);
       
   147 	}
       
   148 
       
   149 void CNwssWspTransportHandler::CancelValidateUntrustedServerCert()
       
   150 	{
       
   151 	}
       
   152 
       
   153 const RArray<TWtlsCipherSuite>& CNwssWspTransportHandler::GetWtlsCipherSuites()
       
   154 	{
       
   155 	return iDefSecPolCipherSuites;
       
   156 	}
       
   157 
       
   158 const TDesC8&
       
   159 CNwssWspTransportHandler::GetTlsCipherSuites()
       
   160 	{
       
   161 	return KNullDesC8();
       
   162 	}
       
   163 
       
   164 const RArray<TWtlsKeyExchangeSuite>& CNwssWspTransportHandler::GetWtlsKeyExchangeSuites()
       
   165 	{
       
   166 	return iDefSecPolKeyExchSuite;
       
   167 	}
       
   168 
       
   169 TInt
       
   170 CNwssWspTransportHandler::GetNamedPolicyProperty(RStringF /*aPropertyName*/, RString& /*aPropertyValue*/)
       
   171 	{
       
   172 	return KErrNotFound;
       
   173 	}
       
   174 
       
   175 void CNwssWspTransportHandler::Reserved1()
       
   176 	{
       
   177 	}
       
   178 
       
   179 void CNwssWspTransportHandler::Reserved2()
       
   180 	{
       
   181 	}
       
   182 
       
   183 TInt CNwssWspTransportHandler::ServerCert(TCertInfo& aCertInfo) const
       
   184 	{
       
   185 	return iWspCOSession->ServerCert(aCertInfo);
       
   186 	}
       
   187