applayerprotocols/httpexamples/nwsswsptrhnd/CNwssWspTransportHandler.h
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 #ifndef __CNWSSWSPTRANSPORTHANDLER_H__
       
    17 #define __CNWSSWSPTRANSPORTHANDLER_H__
       
    18 
       
    19 // System includes
       
    20 #include <wsp/cwsptransporthandler.h>
       
    21 #include <wsp/mwspcosessioninvoker.h>
       
    22 #include <wsp/mwspcomethodinvoker.h>
       
    23 #include <wapcli.h>
       
    24 
       
    25 // Local includes
       
    26 #include "cnwsswspsession.h"
       
    27 #include "mnwsswapserver.h"
       
    28 #include "mconnectioninfoprovider.h"
       
    29 #include "cnwsswspcosession.h"
       
    30 
       
    31 // Forward declarations
       
    32 class MWspCOPushInvoker;
       
    33 class MWspCLMethodInvoker;
       
    34 class MWspCLPushInvoker;
       
    35 
       
    36 /**
       
    37 	@since			7.0
       
    38 	This class provides a concrete implementation of the CWspTransportHandler
       
    39 	interface, specifically for the NWSS Rainbow 2.1 WAP Stack, which is used on
       
    40 	the Hurricane release of Symbian OS.  The present implementation supports only
       
    41 	the Connection-Oriented Session and Method services.  In the future,
       
    42 	Connectionless and Push may be added.
       
    43 
       
    44 	There is no real behaviour in this class.  It acts mainly as a container for
       
    45 	the objects that provide the various services.  Also, it implements a set of
       
    46 	additional Mix-in interfaces, which provide internal services to other classes
       
    47 	in the transport handler.
       
    48 
       
    49 	By implementing MSecurityPolicy, it can supply default policy values when the
       
    50 	WTLS handshake takes place, if a security policy plug-in is not provided by the
       
    51 	client.
       
    52 
       
    53 	The class owns the main WAP protocol stack server handle, RWAPServ.  It
       
    54 	provides access to this for other classes in the transport handler by
       
    55 	implementing the narrow interface MNwssWapServer.  It provides access to the
       
    56 	client's Capability Info, Session Headers and Proxy Info services by
       
    57 	implementing the MConnectionInfoProvider interface and offering it to other
       
    58 	classes in the transport handler.
       
    59  */
       
    60 
       
    61 //##ModelId=3BBD8B17018B
       
    62 class CNwssWspTransportHandler : public CWspTransportHandler,
       
    63 								 public MNwssWapServer,
       
    64 								 public MConnectionInfoProvider
       
    65 	{
       
    66 public: // creation/deletion
       
    67 
       
    68 /**Factory construction of the transport handler.
       
    69 	@since			7.0
       
    70 	@param			aInstantiationParams	(in) Points to a structure containing
       
    71 												 the parameters sent to the parent
       
    72 												 class constructor.
       
    73 	@return			The newly-created transport handler object.
       
    74 	@leave			KErrNoMemory.
       
    75  */
       
    76 	//##ModelId=3C4C49C0033B
       
    77 	static CNwssWspTransportHandler* NewL(TAny* aInstantiationParams);
       
    78 
       
    79 /** Destructor.
       
    80 	@since			7.0
       
    81  */
       
    82 	//##ModelId=3C4C49C00286
       
    83 	virtual ~CNwssWspTransportHandler();
       
    84 
       
    85 public: // API methods inherited from CWspTransportHandler
       
    86 
       
    87 /** Query the services supported by this instantiation of the WSP
       
    88 					transport handler plug-in.
       
    89 	@since			7.0
       
    90 	@return			A bit-field set of flags indicating the service supported.
       
    91 	@see			CWspTransportHandler
       
    92  */
       
    93 	//##ModelId=3C4C49BF0112
       
    94 	virtual CWspTransportHandler::TWspSupportedServices SupportedServices() const;
       
    95 
       
    96 /**Obtain the connection-oriented session invocation API.
       
    97 	@since			7.0
       
    98 	@return			The interface to be used by a client to make invocations on the
       
    99 					connection-oriented session service.
       
   100 	@see MWspCOSessionInvoker
       
   101  */
       
   102 	//##ModelId=3C4C49BF005E
       
   103 	virtual MWspCOSessionInvoker& COSessionInvoker();
       
   104 
       
   105 /** Obtain the connection-oriented method invocation API.
       
   106 	@since			7.0
       
   107 	@return			The interface to be used by a client to make invocations on the
       
   108 					connection-oriented transaction service.
       
   109 	@see MWspCOMethodInvoker
       
   110  */
       
   111 	//##ModelId=3C4C49BE0392
       
   112 	virtual MWspCOMethodInvoker& COTransactionInvoker();
       
   113 
       
   114 /** Obtain the connection-oriented push invocation API.
       
   115 	@since			7.0
       
   116 	@return			The interface to be used by a client to make invocations on the
       
   117 					connection-oriented push service.
       
   118 	@see MWspCOPushInvoker
       
   119  */
       
   120 	//##ModelId=3C4C49BE02DE
       
   121 	virtual MWspCOPushInvoker& COPushInvoker();
       
   122 
       
   123 /** Obtain the connectionless method invocation API.
       
   124 	@since			7.0
       
   125 	@return			The interface to be used by a client to make invocations on the
       
   126 					connectionless transaction service.
       
   127 	@see MWspCLMethodInvoker
       
   128  */
       
   129 	//##ModelId=3C4C49BE0229
       
   130 	virtual MWspCLMethodInvoker& CLMethodInvoker();
       
   131 
       
   132 /** Obtain the connectionless push invocation API.
       
   133 	@since			7.0
       
   134 	@return			The interface to be used by a client to make invocations on the
       
   135 					connectionless push service.
       
   136 	@see MWspCLPushInvoker
       
   137  */
       
   138 	//##ModelId=3C4C49BE0175
       
   139 	virtual MWspCLPushInvoker& CLPushInvoker();
       
   140 
       
   141 	/** Get the Server Certificate for the current session.
       
   142 	@param	aServerCert A TCertInfo which will be filled with the certificate information
       
   143 	@return	An error code.  KErrNone if aServerCert has been completed, otherwise one of 
       
   144 			the system wide error codes
       
   145 	*/
       
   146 	//##ModelId=3C9B0947024C
       
   147 	virtual TInt ServerCert(TCertInfo& aCertInfo) const;
       
   148 
       
   149 private: // methods inherited from MNwssWapServer
       
   150 
       
   151 /**Obtain a handle for the WAP Stack server.
       
   152 	@since			7.0
       
   153 	@return			The WAP Stack server session handle.
       
   154  */
       
   155 	//##ModelId=3C4C49BE00AD
       
   156 	virtual RWAPServ& WapStack();
       
   157 
       
   158 private: // methods inherited from MConnectionInfoProvider
       
   159 
       
   160 /** Obtain the client's provider of proxy information.
       
   161 	@since			7.0
       
   162 	@return			The interface supplied by the client through which proxy
       
   163 					information is obtained.
       
   164  */
       
   165 	//##ModelId=3C4C49BD03C2
       
   166 	virtual MWspProxyInfoProvider& ProxyInfoProvider() const;
       
   167 
       
   168 /** Obtain the client's provider of capability information.
       
   169 	@since			7.0
       
   170 	@return			The interface supplied by the client through which capability
       
   171 					information is obtained.
       
   172  */
       
   173 	//##ModelId=3C4C49BD0304
       
   174 	virtual MWspCapabilityProvider& CapabilityProvider() const;
       
   175 
       
   176 /** Obtain the client's provider of session headers.
       
   177 	@since			7.0
       
   178 	@return			The interface supplied by the client through which client
       
   179 					session headers are obtained, and to which server (i.e. proxy)
       
   180 					session headers are returned.
       
   181  */
       
   182 	//##ModelId=3C4C49BD023C
       
   183 	virtual MWspSessionHeadersProvider& SessionHeadersProvider() const;
       
   184 
       
   185 private: // methods inherited from MSecurityPolicy
       
   186 
       
   187 /** Ask the client to accept or reject a certificate. Not
       
   188 					applicable to TLS, as the SSL layer does this itself.
       
   189 					The call is asynchronous, returning the result via the TRequestStatus.
       
   190 	@since			7.0
       
   191 	@param			aServerCert		(in) A structure containing the certificate details.
       
   192 	@param			aStatus			(out) A status flag used to indicate errors. A value of 0 is used to indicate
       
   193 									that the cert is untrusted and 1 that it is trusted
       
   194  */
       
   195 	//##ModelId=3C4C49BC03DF
       
   196 	virtual void ValidateUntrustedServerCert(TCertInfo& aServerCert, TRequestStatus& aStatus) const;
       
   197 
       
   198 /** Cancel a previous request to ask the client to accept or reject
       
   199 					an untrusted WTLS server certificate.
       
   200 	@since			7.0
       
   201  */
       
   202 	//##ModelId=3C4C49BC032B
       
   203 	virtual void CancelValidateUntrustedServerCert();
       
   204 
       
   205 /** Obtain an array of WTLS cipher suites.  Not applicable to TLS clients.
       
   206 	@since			7.0
       
   207 	@return			An array of cipher suites, consisting of paired bulk encryption
       
   208 					algorithms and MAC algorithms.  The array must be ordered with
       
   209 					strongest cipher suites at the start.
       
   210  */
       
   211 	//##ModelId=3C4C49BC026D
       
   212 	virtual const RArray<TWtlsCipherSuite>& GetWtlsCipherSuites();
       
   213 
       
   214 /** Obtain a list of TLS cipher suites.  Not applicable to WTLS
       
   215 					clients.
       
   216 	@since			7.0
       
   217 	@return			An descriptor containing a list of the TLS cipher suites. Each cipher suite is a 2 byte pair
       
   218  */
       
   219 	//##ModelId=3C4C49BC01B8
       
   220 	virtual const TDesC8& GetTlsCipherSuites();
       
   221 
       
   222 /** Obtain the WTLS key exchange suites.  Not applicable
       
   223 					to TLS clients.
       
   224 	@since			7.0
       
   225 	@return			An array of the WTLS key exchange suites.  The array must be ordered
       
   226 					with authenticating key exchange suites at the start followed by
       
   227 					anonymous key exchange suites if desired.  Within each group of keys
       
   228 					longer keys should precede shorter ones.
       
   229  */
       
   230 	//##ModelId=3C4C49BC010E
       
   231 	virtual const RArray<TWtlsKeyExchangeSuite>& GetWtlsKeyExchangeSuites();
       
   232 
       
   233 /** Obtain arbitrary, named security policy properties, in a generic
       
   234 					'stringified' form.
       
   235 	@since			7.0
       
   236 	@param			aPropertyName	(in) The policy property name.
       
   237 	@param			aPropertyValue	(out) The property value. Parsing of the value is
       
   238 									left to the caller. The caller must close the
       
   239 									RString.
       
   240 	@return			An error code: KErrNone if the property exists or KErrNotFound if
       
   241 					it doesn't.
       
   242  */
       
   243 	//##ModelId=3C4C49BB02E3
       
   244 	virtual TInt GetNamedPolicyProperty(RStringF aPropertyName, RString& aPropertyValue);
       
   245 
       
   246 /**	Reserve a slot in the v-table to preserve future BC
       
   247 	@since			7.0
       
   248  */
       
   249 	//##ModelId=3C4C49BB0239
       
   250 	virtual void Reserved1();
       
   251 
       
   252 /**Reserve a slot in the v-table to preserve future BC
       
   253 	@since			7.0
       
   254  */
       
   255 	//##ModelId=3C4C49BB0199
       
   256 	virtual void Reserved2();
       
   257 
       
   258 private: // methods
       
   259 
       
   260 /** Normal constructor.  The bundled instantiation params are
       
   261 					passed to the parent class constructor. Ownership of the
       
   262 					parameters is _not_ passed across.
       
   263 	@since			7.0
       
   264 	@param			aInstantiationParams	(in) The set of instantiation parameters.
       
   265  */
       
   266 	//##ModelId=3C4C49BB0080
       
   267 	CNwssWspTransportHandler(TAny* aInstantiationParams);
       
   268 
       
   269 /** Second phase construction.  Initial allocation of class data
       
   270 					members is done here.
       
   271 	@since			7.0
       
   272 	@leave			System error codes, eg. KErrNoMemory.
       
   273  */
       
   274 	//##ModelId=3C4C49BB001C
       
   275 	void ConstructL();
       
   276 
       
   277 private: // attributes
       
   278 
       
   279 	/** Session with the WAP Stack server
       
   280 	*/
       
   281 	//##ModelId=3C4C49BB0012
       
   282 	RWAPServ iWapStackHnd;
       
   283 
       
   284 	/** Adapter for Connection-Oriented WSP sessions
       
   285 	*/
       
   286 	//##ModelId=3C4C49BA03E6
       
   287 	CNwssWspCOSession* iWspCOSession;
       
   288 
       
   289 	/** Default security policy values for WTLS cipher suites
       
   290 	*/
       
   291 	//##ModelId=3C4C49BA03D2
       
   292 	RArray<TWtlsCipherSuite> iDefSecPolCipherSuites;
       
   293 
       
   294 	/** Default security policy values for WTLS key exchange suites
       
   295 	*/
       
   296 	//##ModelId=3C4C49BA03BE
       
   297 	RArray<TWtlsKeyExchangeSuite> iDefSecPolKeyExchSuite;
       
   298 	};
       
   299 
       
   300 
       
   301 #endif // __CNWSSWSPTRANSPORTHANDLER_H__