epoc32/include/wsp/wsptypes.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 wsptypes.h
     1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file WspTypes.h
       
    20  @warning : This file contains Rose Model ID comments - please do not delete
       
    21 */
       
    22 
       
    23 #ifndef __WSPTYPES_H__
       
    24 #define __WSPTYPES_H__
       
    25 
       
    26 // System includes
       
    27 #include <e32base.h>
       
    28 #include <stringpool.h>
       
    29 
       
    30 //TODO - These will move to a common WAPMSG/WSPTransport file at a later stage,
       
    31 //in the wap-stack subsystem, to be shared with the WAP Messaging API.
       
    32 
       
    33 namespace Wap
       
    34 /**
       
    35 All type definitions and enumerations used in WSP are in placed in a wider WAP
       
    36 namespace, to avoid name conflicts with other components.
       
    37 @publishedAll
       
    38 @released
       
    39 */
       
    40 {
       
    41 
       
    42 /** The TWspPrimitive type represents the WSP primitives defined in the WSP
       
    43 	Specification, July 2001.
       
    44 */
       
    45 enum TWspPrimitive
       
    46 	{
       
    47 	/**
       
    48 	*/
       
    49 	ESConnect			= 0,
       
    50 	/**
       
    51 	*/
       
    52 	ESDisconnect,
       
    53 	/**
       
    54 	*/
       
    55 	ESSuspend,
       
    56 	/**
       
    57 	*/
       
    58 	ESResume,
       
    59 	/**
       
    60 	*/
       
    61 	ESException,
       
    62 	/**
       
    63 	*/
       
    64 	ESMethodInvoke,
       
    65 	/**
       
    66 	*/
       
    67 	ESMethodInvokeData,
       
    68 	/**
       
    69 	*/
       
    70 	ESMethodResult,
       
    71 	/**
       
    72 	*/
       
    73 	ESMethodResultData,
       
    74 	/**
       
    75 	*/
       
    76 	ESMethodAbort,
       
    77 	/**
       
    78 	*/
       
    79 	ESPush,
       
    80 	/**
       
    81 	*/
       
    82 	ESConfirmedPush,
       
    83 	/**
       
    84 	*/
       
    85 	ESPushAbort
       
    86 	};
       
    87 
       
    88 /** The TWspProtocolOptions type represents the optional protocol functions 
       
    89 	defined in the WSP Specification, July 2001. When the client sends the 
       
    90 	Protocol Capability to the server, it indicates which functions it will
       
    91 	accept from the server. The server returns from the set of functions sent
       
    92 	by the client those that it will perform.
       
    93 */
       
    94 enum TWspProtocolOptions
       
    95 	{
       
    96 	/** The Large Data Transfer feature includes support for multiple SDU's and
       
    97 		support for the Data Fragment PDU. Setting this falg indicates support 
       
    98 		for sending and receiving large data. If a client only wishes to receive
       
    99 		large data, then it should set the Client and Server Message size fields
       
   100 		appropriately.
       
   101 	*/
       
   102 	ELargeDataTransfer			= 0x08,
       
   103 	/** The acknowledgement headers flag specifies that the client wishes to send
       
   104 		acknowledgement headers. If the server cannot process them (indicated by
       
   105 		negotiating down the flag) the client should not send the headers as they
       
   106 		will be ignored.
       
   107 	*/
       
   108 	EAcknowledgementHeaders		= 0x10,
       
   109 	/** The client enables the Suspend Resume facility when it wishes to suspend
       
   110 		and resume the session. If the server does not support suspend and resume
       
   111 		then this flag must be cleared in the negotiated capabilities.
       
   112 	*/
       
   113 	ESessionResumeFacility		= 0x20,
       
   114 	/** The client uses this flag to indicate that it is able and willing to 
       
   115 		receive push information. If the server cannot send pushes then this flag 
       
   116 		must be cleared in the negotiated capabilities.
       
   117 	*/
       
   118 	EPushFacility				= 0x40,
       
   119 	/** The client uses this flag to indicate that it is able and willing to 
       
   120 		receive confirmed push information. If the server cannot send pushes 
       
   121 		then this flag must be cleared in the negotiated capabilities.
       
   122 	*/
       
   123 	EConfirmedPushFacility		= 0x80
       
   124 	};
       
   125 
       
   126 /** The TWspSessionState type represents the states of a WSP session, as defined
       
   127 	by the WSP Specification, July 2001.
       
   128 */
       
   129 enum TWspSessionState
       
   130 	{
       
   131 	/** 
       
   132 	*/
       
   133 	ENull			= 0,
       
   134 	/**
       
   135 	*/
       
   136 	EConnecting,
       
   137 	/**
       
   138 	*/
       
   139 	EConnected,
       
   140 	/**
       
   141 	*/
       
   142 	ESuspending,
       
   143 	/**
       
   144 	*/
       
   145 	ESuspended,
       
   146 	/**
       
   147 	*/
       
   148 	EClosing,
       
   149 	/**
       
   150 	*/
       
   151 	EResuming
       
   152 	};
       
   153 
       
   154 /** The TWspMethodState type represents the states of a WSP method transaction,
       
   155 	as defined by the WSP Specification, July 2001.
       
   156 */
       
   157 enum TWspMethodState
       
   158 	{
       
   159 	/**
       
   160 	*/
       
   161 	ENullMethod			=0,
       
   162 	/**
       
   163 	*/
       
   164 	ERequesting,
       
   165 	/**
       
   166 	*/
       
   167 	EWaiting,
       
   168 	/**
       
   169 	*/
       
   170 	EWaiting2,
       
   171 	/**
       
   172 	*/
       
   173 	ECompleting,
       
   174 	/**
       
   175 	*/
       
   176 	EAborting
       
   177 	};
       
   178 
       
   179 /** The TWspBearer type defines the set of supported bearers.
       
   180 */
       
   181 enum TWspBearer
       
   182 	{
       
   183 	/** Specifier for any bearer.
       
   184 	*/
       
   185 	EAny		= 0,
       
   186 	/** IP bearer.
       
   187 	*/
       
   188 	EIP,
       
   189 	/** A 7-bit SMS bearer.
       
   190 	*/
       
   191 	ESMS7,
       
   192 	/** An 8-bit SMS bearer.
       
   193 	*/
       
   194 	ESMS,
       
   195 	/** A 7-bit WAP SMS bearer.
       
   196 	*/
       
   197 	EWAPSMS7,
       
   198 	/** An 8-bit WAP SMS bearer.
       
   199 	*/
       
   200 	EWAPSMS
       
   201 	};
       
   202 
       
   203 /** The TWspSession type defines the 2 types of WSP Session Service; Connection
       
   204 	Oriented and Connectionless.
       
   205 */
       
   206 enum TWspSession
       
   207 	{
       
   208 	/** Specifier for Connection Oriented Session Service.
       
   209 	*/
       
   210 	EWspConnectionOriented			= 0,
       
   211 	/** Specifier for Connectionless Session Service.
       
   212 	*/
       
   213 	EWspConnectionLess
       
   214 	};
       
   215 
       
   216 /** The TWspReason type is used by to report the cause of a particular indication 
       
   217 	primitive. The WSP Specification, July 2001, specifies a given set that MUST
       
   218 	be recognised (6.2.5). Further values may be added.
       
   219 */
       
   220 enum TWspReason
       
   221 	{
       
   222 	/** The rules of the protocol were broken and in its current state, the peer
       
   223 		could not perform the specified operation. E.g. the PDU was not allowed.
       
   224 	*/
       
   225 	EProtoErr			= 0xE0,
       
   226 	/** The session was disconnected while the operation was still in progress.
       
   227 	*/
       
   228 	EDisconnect			= 0xE1,
       
   229 	/** The session was suspended while the operation was still in progress.
       
   230 	*/
       
   231 	ESuspend			= 0xE2,
       
   232 	/** The session was resumed while the operation was still in progress.
       
   233 	*/
       
   234 	EResume				= 0xE3,
       
   235 	/** The request could not be processed due to a lack of resources.
       
   236 	*/
       
   237 	ECongestion			= 0xE4,
       
   238 	/** The connection was prevented due to an error.
       
   239 	*/ 
       
   240 	EConnectErr			= 0xE5,
       
   241 	/** The SDU size in a request exceeded the maximum negotiated SDU size.
       
   242 	*/
       
   243 	EMRUExceeded		= 0xE6,
       
   244 	/** The negotiated value of the maximum outstanding transactions (either for
       
   245 		push or method transactions) has been exceeded.
       
   246 	*/
       
   247 	EMORExceeded		= 0xE7,
       
   248 	/** The operation was aborted by the Provider. 
       
   249 	*/
       
   250 	EPeerReq			= 0xE8,
       
   251 	/** An underlying network error prevented the completion of a request.
       
   252 	*/
       
   253 	ENetErr				= 0xE9,
       
   254 	/** The cause of the indication was an action by the Client.
       
   255 	*/
       
   256 	EUserReq			= 0xEA,
       
   257 	/** The client has refesed the Push message, no specific reason, no retries.
       
   258 	*/
       
   259 	EUserRfs			= 0xEB,
       
   260 	/** The Push message cannot be delivered to the intended destination.
       
   261 	*/
       
   262 	EUserPnd			= 0xEC,
       
   263 	/** The Push message was discarded due to resource shortage.
       
   264 	*/
       
   265 	EUserDcr			= 0xED,
       
   266 	/** The content-type of the Push message cannot be processed.
       
   267 	*/
       
   268 	EUserDcu			= 0xEE,
       
   269 	/** The session connect request has been redirected to a new proxy. This is
       
   270 		a temporary redirection and the original proxy should be used in the
       
   271 		future when trying to access this service. This is not defined by the 
       
   272 		WSP Specification.
       
   273 	*/
       
   274 	ETemporaryRedirectedProxy	=0,
       
   275 	/** The session connect request has been redirected to a new proxy. This is
       
   276 		a permanent redirection and the new proxy should be used in the future 
       
   277 		when trying to access this service. The client will be notified of this
       
   278 		event and the HTTP session property EWspProxyAddressnew will contain the
       
   279 		new proxy's address. The client should update its access point database.
       
   280 		This is not defined by the WSP Specification.
       
   281 	*/
       
   282 	EPermanentRedirectedProxy,
       
   283 	/** The client had disconnected the session, but as Suspend Resume facility
       
   284 		was being used, the session was suspended. The client then changed the
       
   285 		proxy and did a connect. The suspended session cannot be resumed, so the
       
   286 		the current session must be disconnected (with this reason) and a 
       
   287 		session connect initiated with the new proxy. This is not defined by the
       
   288 		WSP Specification.
       
   289 	*/
       
   290 	EChangedProxyInSuspendedSession,
       
   291 	/** The client's WSP session was disconnected in the Connecting state because
       
   292 		configuration of the underlying WTLS layer failed prior to the phase 1
       
   293 		WTLS handshake.
       
   294 	*/
       
   295 	EWtlsConfigurationFailed,
       
   296 	/** The client's WSP session was disconnected in the Connecting state because
       
   297 		phase 1 of the WTLS handshake failed.
       
   298 	*/
       
   299 	EWtlsPhase1HandshakeFailed,
       
   300 	/** The client's WSP session was disconnected in the Connecting state because
       
   301 		phase 2 of the WTLS handshake failed.
       
   302 	*/
       
   303 	EWtlsPhase2HandshakeFailed,
       
   304 	/** The client's WSP session was disconnected in the Connecting state because
       
   305 		the proxy's WTLS certificate was invalid - e.g. badly formed, or out of date.
       
   306 	*/
       
   307 	EWtlsInvalidServerCert,
       
   308 	/** The client's WSP session was disconnected in the Connecting state because
       
   309 		the proxy's WTLS certificate could not be trusted.  This means it was not signed
       
   310 		by any root certificate on the device, and the security policy criteria could not
       
   311 		determine further whether it could be trusted or not.
       
   312 	*/
       
   313 	EWtlsUntrustedServerCert,
       
   314 	/** The client's WSP session was disconnected in the Connecting state because
       
   315 		the negotiated WTLS configuration at completion of the secure handshake was
       
   316 		rejected by criteria in the security policy.
       
   317 	*/
       
   318 	EWtlsNegotiatedConfigRejected,
       
   319 	/** The client's transaction or session has failed due to an out-of-memory situation.
       
   320 	*/
       
   321 	EOutOfMemory,
       
   322 	/** The client's session has entered an inconsistent state, probably due to a failure caused
       
   323 		by an out-of-memory situation.
       
   324 	*/
       
   325 	ESessionStateFailure
       
   326 	};
       
   327 
       
   328 /**	The enum TWspCapabilty is used to select a capability to reset (if required) 
       
   329 	before setting the value of the capability.
       
   330 */
       
   331 enum TWspCapability
       
   332 	{
       
   333 	/** Specifies the Alias Addresses capability.
       
   334 	*/
       
   335 	EAliasAddresses				= 0,
       
   336 	/** Specifies the Extended Methods capability.
       
   337 	*/
       
   338 	EExtendedMethods,
       
   339 	/** Specifies the Header Code Pages capability.
       
   340 	*/
       
   341 	EHeaderCodePages,
       
   342 	/** Specifies the Method Maximum Outstanding Requests capability. Default value is 1.
       
   343 	*/
       
   344 	EMethodMOR,
       
   345 	/** Specifies the Push Maximum Outstanding Requests capability. Default value is 1.
       
   346 	*/
       
   347 	EPushMOR,
       
   348 	/** Specifies the Protocol Options capability. Default value is 0x00.
       
   349 	*/
       
   350 	EProtocolOptions,
       
   351 	/** Specifies the Client SDU size capability. Default value is 1400 octets.
       
   352 	*/
       
   353 	EClientSDUSize,
       
   354 	/** Specifies the Server SDU size capability. Default value is 1400 octets.
       
   355 	*/
       
   356 	EServerSDUSize,
       
   357 	/** Specifies the Client Message size capability. Default value is 1400 octets.
       
   358 	*/
       
   359 	EClientMessageSize,
       
   360 	/** Specifies the Server Message size capability. Default value is 1400 octets.
       
   361 	*/
       
   362 	EServerMessageSize,
       
   363 	/** Specifies the Unknown capabilities.
       
   364 	*/
       
   365 	EUnknownCapabilities,
       
   366 	/** Specifies all the capabilities.
       
   367 	*/
       
   368 	EAllCapabilities
       
   369 	};
       
   370 
       
   371 } // end of namespace Wap
       
   372 
       
   373 
       
   374 /**
       
   375 Maximum Proxy address length, this is large enough for a full IPv6 address.
       
   376 @publishedAll
       
   377 @released
       
   378 */
       
   379 const TInt KMaxProxyAddrLen = 40;
       
   380 
       
   381 //##ModelId=3C4C41B20079
       
   382 class TWspRedirectedAddress
       
   383 /**	
       
   384 The TWspRedirectedAddress type represents an alternate address to which 
       
   385 Clients must use to establish a session with the same service that was 
       
   386 initially contacted. If the bearer or port fields have been excluded, then
       
   387 the orginal bearer and port should be used to contact the new server. The 
       
   388 WSP Specification, July 2001, defines an Address Type (8.2.2.3) upon which 
       
   389 this class is based.
       
   390 @publishedAll
       
   391 @released
       
   392 */
       
   393 	{
       
   394 public:	// Attributes
       
   395 
       
   396 	/** A flag to indicate that the port field is set.
       
   397 	*/
       
   398 	//##ModelId=3C4C41B200DD
       
   399 	TBool		iHasPort;
       
   400 
       
   401 	/** A flag to indicate that the bearer field is set.
       
   402 	*/
       
   403 	//##ModelId=3C4C41B200CB
       
   404 	TBool		iHasBearer;
       
   405 
       
   406 	/** The proxy address.
       
   407 	*/
       
   408 	//##ModelId=3C4C41B200C1
       
   409 	TBuf8<KMaxProxyAddrLen>	iProxyAddress;
       
   410 
       
   411 	/** The port number. 
       
   412 	*/
       
   413 	//##ModelId=3C4C41B200B5
       
   414 	TUint16		iPort;
       
   415 
       
   416 	/** The bearer type.
       
   417 	*/
       
   418 	//##ModelId=3C4C41B200A3
       
   419 	Wap::TWspBearer	iBearer;
       
   420 	};
       
   421 
       
   422 /**
       
   423 Maximum length of a key ID for WTLS
       
   424 @publishedAll
       
   425 @released
       
   426 */
       
   427 const TInt KWtlsMaxKeyIdLength = 512;
       
   428 
       
   429 class TWtlsKeyExchangeSuite
       
   430 /**
       
   431 The class TWtlsKeyExchangeSuite contain the definitions of WTLS
       
   432 Key Exchange Suites as defined in the WAP WTLS Specification, July 2001
       
   433 @publishedAll
       
   434 @released 
       
   435 */
       
   436 	{
       
   437 public:
       
   438 	enum TKeyExchangeSuite
       
   439 		{
       
   440 		ENULL					=0,
       
   441 		ESHARED_SECRET			=1,
       
   442 		EDH_anon				=2,
       
   443 		EDH_anon_512			=3,
       
   444 		EDH_anon_768			=4,
       
   445 		ERSA_anon				=5,
       
   446 		ERSA_anon_512			=6,
       
   447 		ERSA_anon_768			=7,
       
   448 		ERSA					=8,
       
   449 		ERSA_512				=9,
       
   450 		ERSA_768				=10,
       
   451 		EECDH_anon				=11,
       
   452 		EECDH_anon_113			=12,
       
   453 		EECDH_anon_131			=13,
       
   454 		EECDH_ECDSA				=14,
       
   455 		EECDH_anon_uncomp		=15,
       
   456 		EECDH_anon_uncomp_113	=16,
       
   457 		EECDH_anon_uncomp_131	=17,
       
   458 		EECDH_ECDSA_uncomp		=18
       
   459 		};
       
   460 	enum TKeyIdType 
       
   461 		{
       
   462 		EIdNull			= 0,
       
   463 		EText			= 1, 
       
   464 		EBinary			= 2, 
       
   465 		EKeyHashSha		= 254, 
       
   466 		EX509Name		= 255
       
   467 		};
       
   468 
       
   469 public:
       
   470 	TWtlsKeyExchangeSuite(TKeyExchangeSuite aKeyExchangeSuite, TKeyIdType aKeyIdType, const TBuf8<KWtlsMaxKeyIdLength>& aKeyId);
       
   471 
       
   472 public:
       
   473 	TKeyExchangeSuite iKeyExchangeSuite;
       
   474 	TKeyIdType iKeyIdType;
       
   475 	TBuf8<KWtlsMaxKeyIdLength> iKeyId;
       
   476 	};
       
   477 
       
   478 class TWtlsCipherSuite
       
   479 /**
       
   480 The class TWtlsCipherSuite encapsulates a WTLS cipher suite as defined in
       
   481 the WAP WTLS Specification, July 2001
       
   482 This is a pair made up of a Bulk Encryption Algorithm and a Mac Algorithm
       
   483 @publishedAll
       
   484 @released
       
   485 */
       
   486 	{
       
   487 public:
       
   488 			
       
   489 	enum TBulkEncryptionAlgorithm
       
   490 		{
       
   491 		ENULL			=0,
       
   492 		ERC5_CBC_40		=1,
       
   493 		ERC5_CBC_56		=2,
       
   494 		ERC5_CBC		=3,
       
   495 		EDES_CBC_40		=4,
       
   496 		EDES_CBC		=5,
       
   497 		E3DES_CBC_EDE	=6,
       
   498 		EIDEA_CBC_40	=7,
       
   499 		EIDEA_CBC_56	=8,
       
   500 		EIDEA_CBC		=9,
       
   501 		ERC5_CBC_64		=10,
       
   502 		EIDEA_CBC_64	=11
       
   503 		};
       
   504 
       
   505 	enum TMacAlgorithm
       
   506 		{
       
   507 		ESHA_0			=0,
       
   508 		ESHA_40			=1,
       
   509 		ESHA_80			=2,
       
   510 		ESHA			=3,
       
   511 //		N/A (removed)	=4,
       
   512 		EMD5_40			=5,
       
   513 		EMD5_80			=6,
       
   514 		EMD5			=7,
       
   515 		};
       
   516 
       
   517 	TWtlsCipherSuite(TBulkEncryptionAlgorithm aBulkEncryptionAlgorithm, TMacAlgorithm aMacAlgorithm);
       
   518 
       
   519 public:
       
   520 	TBulkEncryptionAlgorithm iBulkEncryptionAlgorithm;
       
   521 	TMacAlgorithm iMacAlgorithm;
       
   522 	};
       
   523 
       
   524 inline TWtlsCipherSuite::TWtlsCipherSuite(TBulkEncryptionAlgorithm aBulkEncryptionAlgorithm, TMacAlgorithm aMacAlgorithm)
       
   525 	: iBulkEncryptionAlgorithm(aBulkEncryptionAlgorithm), iMacAlgorithm(aMacAlgorithm)
       
   526 	{
       
   527 	}
       
   528 
       
   529 inline TWtlsKeyExchangeSuite::TWtlsKeyExchangeSuite(TKeyExchangeSuite aKeyExchangeSuite, TKeyIdType aKeyIdType, const TBuf8<KWtlsMaxKeyIdLength>& aKeyId)
       
   530 	: iKeyExchangeSuite(aKeyExchangeSuite), iKeyIdType(aKeyIdType), iKeyId(aKeyId)
       
   531 	{
       
   532 	}
       
   533 
       
   534 
       
   535 #endif	// __WSPTYPES_H__