epoc32/include/wsp/wsptypes.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/wsp/wsptypes.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/wsp/wsptypes.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,535 @@
     1.4 -wsptypes.h
     1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file WspTypes.h
    1.24 + @warning : This file contains Rose Model ID comments - please do not delete
    1.25 +*/
    1.26 +
    1.27 +#ifndef __WSPTYPES_H__
    1.28 +#define __WSPTYPES_H__
    1.29 +
    1.30 +// System includes
    1.31 +#include <e32base.h>
    1.32 +#include <stringpool.h>
    1.33 +
    1.34 +//TODO - These will move to a common WAPMSG/WSPTransport file at a later stage,
    1.35 +//in the wap-stack subsystem, to be shared with the WAP Messaging API.
    1.36 +
    1.37 +namespace Wap
    1.38 +/**
    1.39 +All type definitions and enumerations used in WSP are in placed in a wider WAP
    1.40 +namespace, to avoid name conflicts with other components.
    1.41 +@publishedAll
    1.42 +@released
    1.43 +*/
    1.44 +{
    1.45 +
    1.46 +/** The TWspPrimitive type represents the WSP primitives defined in the WSP
    1.47 +	Specification, July 2001.
    1.48 +*/
    1.49 +enum TWspPrimitive
    1.50 +	{
    1.51 +	/**
    1.52 +	*/
    1.53 +	ESConnect			= 0,
    1.54 +	/**
    1.55 +	*/
    1.56 +	ESDisconnect,
    1.57 +	/**
    1.58 +	*/
    1.59 +	ESSuspend,
    1.60 +	/**
    1.61 +	*/
    1.62 +	ESResume,
    1.63 +	/**
    1.64 +	*/
    1.65 +	ESException,
    1.66 +	/**
    1.67 +	*/
    1.68 +	ESMethodInvoke,
    1.69 +	/**
    1.70 +	*/
    1.71 +	ESMethodInvokeData,
    1.72 +	/**
    1.73 +	*/
    1.74 +	ESMethodResult,
    1.75 +	/**
    1.76 +	*/
    1.77 +	ESMethodResultData,
    1.78 +	/**
    1.79 +	*/
    1.80 +	ESMethodAbort,
    1.81 +	/**
    1.82 +	*/
    1.83 +	ESPush,
    1.84 +	/**
    1.85 +	*/
    1.86 +	ESConfirmedPush,
    1.87 +	/**
    1.88 +	*/
    1.89 +	ESPushAbort
    1.90 +	};
    1.91 +
    1.92 +/** The TWspProtocolOptions type represents the optional protocol functions 
    1.93 +	defined in the WSP Specification, July 2001. When the client sends the 
    1.94 +	Protocol Capability to the server, it indicates which functions it will
    1.95 +	accept from the server. The server returns from the set of functions sent
    1.96 +	by the client those that it will perform.
    1.97 +*/
    1.98 +enum TWspProtocolOptions
    1.99 +	{
   1.100 +	/** The Large Data Transfer feature includes support for multiple SDU's and
   1.101 +		support for the Data Fragment PDU. Setting this falg indicates support 
   1.102 +		for sending and receiving large data. If a client only wishes to receive
   1.103 +		large data, then it should set the Client and Server Message size fields
   1.104 +		appropriately.
   1.105 +	*/
   1.106 +	ELargeDataTransfer			= 0x08,
   1.107 +	/** The acknowledgement headers flag specifies that the client wishes to send
   1.108 +		acknowledgement headers. If the server cannot process them (indicated by
   1.109 +		negotiating down the flag) the client should not send the headers as they
   1.110 +		will be ignored.
   1.111 +	*/
   1.112 +	EAcknowledgementHeaders		= 0x10,
   1.113 +	/** The client enables the Suspend Resume facility when it wishes to suspend
   1.114 +		and resume the session. If the server does not support suspend and resume
   1.115 +		then this flag must be cleared in the negotiated capabilities.
   1.116 +	*/
   1.117 +	ESessionResumeFacility		= 0x20,
   1.118 +	/** The client uses this flag to indicate that it is able and willing to 
   1.119 +		receive push information. If the server cannot send pushes then this flag 
   1.120 +		must be cleared in the negotiated capabilities.
   1.121 +	*/
   1.122 +	EPushFacility				= 0x40,
   1.123 +	/** The client uses this flag to indicate that it is able and willing to 
   1.124 +		receive confirmed push information. If the server cannot send pushes 
   1.125 +		then this flag must be cleared in the negotiated capabilities.
   1.126 +	*/
   1.127 +	EConfirmedPushFacility		= 0x80
   1.128 +	};
   1.129 +
   1.130 +/** The TWspSessionState type represents the states of a WSP session, as defined
   1.131 +	by the WSP Specification, July 2001.
   1.132 +*/
   1.133 +enum TWspSessionState
   1.134 +	{
   1.135 +	/** 
   1.136 +	*/
   1.137 +	ENull			= 0,
   1.138 +	/**
   1.139 +	*/
   1.140 +	EConnecting,
   1.141 +	/**
   1.142 +	*/
   1.143 +	EConnected,
   1.144 +	/**
   1.145 +	*/
   1.146 +	ESuspending,
   1.147 +	/**
   1.148 +	*/
   1.149 +	ESuspended,
   1.150 +	/**
   1.151 +	*/
   1.152 +	EClosing,
   1.153 +	/**
   1.154 +	*/
   1.155 +	EResuming
   1.156 +	};
   1.157 +
   1.158 +/** The TWspMethodState type represents the states of a WSP method transaction,
   1.159 +	as defined by the WSP Specification, July 2001.
   1.160 +*/
   1.161 +enum TWspMethodState
   1.162 +	{
   1.163 +	/**
   1.164 +	*/
   1.165 +	ENullMethod			=0,
   1.166 +	/**
   1.167 +	*/
   1.168 +	ERequesting,
   1.169 +	/**
   1.170 +	*/
   1.171 +	EWaiting,
   1.172 +	/**
   1.173 +	*/
   1.174 +	EWaiting2,
   1.175 +	/**
   1.176 +	*/
   1.177 +	ECompleting,
   1.178 +	/**
   1.179 +	*/
   1.180 +	EAborting
   1.181 +	};
   1.182 +
   1.183 +/** The TWspBearer type defines the set of supported bearers.
   1.184 +*/
   1.185 +enum TWspBearer
   1.186 +	{
   1.187 +	/** Specifier for any bearer.
   1.188 +	*/
   1.189 +	EAny		= 0,
   1.190 +	/** IP bearer.
   1.191 +	*/
   1.192 +	EIP,
   1.193 +	/** A 7-bit SMS bearer.
   1.194 +	*/
   1.195 +	ESMS7,
   1.196 +	/** An 8-bit SMS bearer.
   1.197 +	*/
   1.198 +	ESMS,
   1.199 +	/** A 7-bit WAP SMS bearer.
   1.200 +	*/
   1.201 +	EWAPSMS7,
   1.202 +	/** An 8-bit WAP SMS bearer.
   1.203 +	*/
   1.204 +	EWAPSMS
   1.205 +	};
   1.206 +
   1.207 +/** The TWspSession type defines the 2 types of WSP Session Service; Connection
   1.208 +	Oriented and Connectionless.
   1.209 +*/
   1.210 +enum TWspSession
   1.211 +	{
   1.212 +	/** Specifier for Connection Oriented Session Service.
   1.213 +	*/
   1.214 +	EWspConnectionOriented			= 0,
   1.215 +	/** Specifier for Connectionless Session Service.
   1.216 +	*/
   1.217 +	EWspConnectionLess
   1.218 +	};
   1.219 +
   1.220 +/** The TWspReason type is used by to report the cause of a particular indication 
   1.221 +	primitive. The WSP Specification, July 2001, specifies a given set that MUST
   1.222 +	be recognised (6.2.5). Further values may be added.
   1.223 +*/
   1.224 +enum TWspReason
   1.225 +	{
   1.226 +	/** The rules of the protocol were broken and in its current state, the peer
   1.227 +		could not perform the specified operation. E.g. the PDU was not allowed.
   1.228 +	*/
   1.229 +	EProtoErr			= 0xE0,
   1.230 +	/** The session was disconnected while the operation was still in progress.
   1.231 +	*/
   1.232 +	EDisconnect			= 0xE1,
   1.233 +	/** The session was suspended while the operation was still in progress.
   1.234 +	*/
   1.235 +	ESuspend			= 0xE2,
   1.236 +	/** The session was resumed while the operation was still in progress.
   1.237 +	*/
   1.238 +	EResume				= 0xE3,
   1.239 +	/** The request could not be processed due to a lack of resources.
   1.240 +	*/
   1.241 +	ECongestion			= 0xE4,
   1.242 +	/** The connection was prevented due to an error.
   1.243 +	*/ 
   1.244 +	EConnectErr			= 0xE5,
   1.245 +	/** The SDU size in a request exceeded the maximum negotiated SDU size.
   1.246 +	*/
   1.247 +	EMRUExceeded		= 0xE6,
   1.248 +	/** The negotiated value of the maximum outstanding transactions (either for
   1.249 +		push or method transactions) has been exceeded.
   1.250 +	*/
   1.251 +	EMORExceeded		= 0xE7,
   1.252 +	/** The operation was aborted by the Provider. 
   1.253 +	*/
   1.254 +	EPeerReq			= 0xE8,
   1.255 +	/** An underlying network error prevented the completion of a request.
   1.256 +	*/
   1.257 +	ENetErr				= 0xE9,
   1.258 +	/** The cause of the indication was an action by the Client.
   1.259 +	*/
   1.260 +	EUserReq			= 0xEA,
   1.261 +	/** The client has refesed the Push message, no specific reason, no retries.
   1.262 +	*/
   1.263 +	EUserRfs			= 0xEB,
   1.264 +	/** The Push message cannot be delivered to the intended destination.
   1.265 +	*/
   1.266 +	EUserPnd			= 0xEC,
   1.267 +	/** The Push message was discarded due to resource shortage.
   1.268 +	*/
   1.269 +	EUserDcr			= 0xED,
   1.270 +	/** The content-type of the Push message cannot be processed.
   1.271 +	*/
   1.272 +	EUserDcu			= 0xEE,
   1.273 +	/** The session connect request has been redirected to a new proxy. This is
   1.274 +		a temporary redirection and the original proxy should be used in the
   1.275 +		future when trying to access this service. This is not defined by the 
   1.276 +		WSP Specification.
   1.277 +	*/
   1.278 +	ETemporaryRedirectedProxy	=0,
   1.279 +	/** The session connect request has been redirected to a new proxy. This is
   1.280 +		a permanent redirection and the new proxy should be used in the future 
   1.281 +		when trying to access this service. The client will be notified of this
   1.282 +		event and the HTTP session property EWspProxyAddressnew will contain the
   1.283 +		new proxy's address. The client should update its access point database.
   1.284 +		This is not defined by the WSP Specification.
   1.285 +	*/
   1.286 +	EPermanentRedirectedProxy,
   1.287 +	/** The client had disconnected the session, but as Suspend Resume facility
   1.288 +		was being used, the session was suspended. The client then changed the
   1.289 +		proxy and did a connect. The suspended session cannot be resumed, so the
   1.290 +		the current session must be disconnected (with this reason) and a 
   1.291 +		session connect initiated with the new proxy. This is not defined by the
   1.292 +		WSP Specification.
   1.293 +	*/
   1.294 +	EChangedProxyInSuspendedSession,
   1.295 +	/** The client's WSP session was disconnected in the Connecting state because
   1.296 +		configuration of the underlying WTLS layer failed prior to the phase 1
   1.297 +		WTLS handshake.
   1.298 +	*/
   1.299 +	EWtlsConfigurationFailed,
   1.300 +	/** The client's WSP session was disconnected in the Connecting state because
   1.301 +		phase 1 of the WTLS handshake failed.
   1.302 +	*/
   1.303 +	EWtlsPhase1HandshakeFailed,
   1.304 +	/** The client's WSP session was disconnected in the Connecting state because
   1.305 +		phase 2 of the WTLS handshake failed.
   1.306 +	*/
   1.307 +	EWtlsPhase2HandshakeFailed,
   1.308 +	/** The client's WSP session was disconnected in the Connecting state because
   1.309 +		the proxy's WTLS certificate was invalid - e.g. badly formed, or out of date.
   1.310 +	*/
   1.311 +	EWtlsInvalidServerCert,
   1.312 +	/** The client's WSP session was disconnected in the Connecting state because
   1.313 +		the proxy's WTLS certificate could not be trusted.  This means it was not signed
   1.314 +		by any root certificate on the device, and the security policy criteria could not
   1.315 +		determine further whether it could be trusted or not.
   1.316 +	*/
   1.317 +	EWtlsUntrustedServerCert,
   1.318 +	/** The client's WSP session was disconnected in the Connecting state because
   1.319 +		the negotiated WTLS configuration at completion of the secure handshake was
   1.320 +		rejected by criteria in the security policy.
   1.321 +	*/
   1.322 +	EWtlsNegotiatedConfigRejected,
   1.323 +	/** The client's transaction or session has failed due to an out-of-memory situation.
   1.324 +	*/
   1.325 +	EOutOfMemory,
   1.326 +	/** The client's session has entered an inconsistent state, probably due to a failure caused
   1.327 +		by an out-of-memory situation.
   1.328 +	*/
   1.329 +	ESessionStateFailure
   1.330 +	};
   1.331 +
   1.332 +/**	The enum TWspCapabilty is used to select a capability to reset (if required) 
   1.333 +	before setting the value of the capability.
   1.334 +*/
   1.335 +enum TWspCapability
   1.336 +	{
   1.337 +	/** Specifies the Alias Addresses capability.
   1.338 +	*/
   1.339 +	EAliasAddresses				= 0,
   1.340 +	/** Specifies the Extended Methods capability.
   1.341 +	*/
   1.342 +	EExtendedMethods,
   1.343 +	/** Specifies the Header Code Pages capability.
   1.344 +	*/
   1.345 +	EHeaderCodePages,
   1.346 +	/** Specifies the Method Maximum Outstanding Requests capability. Default value is 1.
   1.347 +	*/
   1.348 +	EMethodMOR,
   1.349 +	/** Specifies the Push Maximum Outstanding Requests capability. Default value is 1.
   1.350 +	*/
   1.351 +	EPushMOR,
   1.352 +	/** Specifies the Protocol Options capability. Default value is 0x00.
   1.353 +	*/
   1.354 +	EProtocolOptions,
   1.355 +	/** Specifies the Client SDU size capability. Default value is 1400 octets.
   1.356 +	*/
   1.357 +	EClientSDUSize,
   1.358 +	/** Specifies the Server SDU size capability. Default value is 1400 octets.
   1.359 +	*/
   1.360 +	EServerSDUSize,
   1.361 +	/** Specifies the Client Message size capability. Default value is 1400 octets.
   1.362 +	*/
   1.363 +	EClientMessageSize,
   1.364 +	/** Specifies the Server Message size capability. Default value is 1400 octets.
   1.365 +	*/
   1.366 +	EServerMessageSize,
   1.367 +	/** Specifies the Unknown capabilities.
   1.368 +	*/
   1.369 +	EUnknownCapabilities,
   1.370 +	/** Specifies all the capabilities.
   1.371 +	*/
   1.372 +	EAllCapabilities
   1.373 +	};
   1.374 +
   1.375 +} // end of namespace Wap
   1.376 +
   1.377 +
   1.378 +/**
   1.379 +Maximum Proxy address length, this is large enough for a full IPv6 address.
   1.380 +@publishedAll
   1.381 +@released
   1.382 +*/
   1.383 +const TInt KMaxProxyAddrLen = 40;
   1.384 +
   1.385 +//##ModelId=3C4C41B20079
   1.386 +class TWspRedirectedAddress
   1.387 +/**	
   1.388 +The TWspRedirectedAddress type represents an alternate address to which 
   1.389 +Clients must use to establish a session with the same service that was 
   1.390 +initially contacted. If the bearer or port fields have been excluded, then
   1.391 +the orginal bearer and port should be used to contact the new server. The 
   1.392 +WSP Specification, July 2001, defines an Address Type (8.2.2.3) upon which 
   1.393 +this class is based.
   1.394 +@publishedAll
   1.395 +@released
   1.396 +*/
   1.397 +	{
   1.398 +public:	// Attributes
   1.399 +
   1.400 +	/** A flag to indicate that the port field is set.
   1.401 +	*/
   1.402 +	//##ModelId=3C4C41B200DD
   1.403 +	TBool		iHasPort;
   1.404 +
   1.405 +	/** A flag to indicate that the bearer field is set.
   1.406 +	*/
   1.407 +	//##ModelId=3C4C41B200CB
   1.408 +	TBool		iHasBearer;
   1.409 +
   1.410 +	/** The proxy address.
   1.411 +	*/
   1.412 +	//##ModelId=3C4C41B200C1
   1.413 +	TBuf8<KMaxProxyAddrLen>	iProxyAddress;
   1.414 +
   1.415 +	/** The port number. 
   1.416 +	*/
   1.417 +	//##ModelId=3C4C41B200B5
   1.418 +	TUint16		iPort;
   1.419 +
   1.420 +	/** The bearer type.
   1.421 +	*/
   1.422 +	//##ModelId=3C4C41B200A3
   1.423 +	Wap::TWspBearer	iBearer;
   1.424 +	};
   1.425 +
   1.426 +/**
   1.427 +Maximum length of a key ID for WTLS
   1.428 +@publishedAll
   1.429 +@released
   1.430 +*/
   1.431 +const TInt KWtlsMaxKeyIdLength = 512;
   1.432 +
   1.433 +class TWtlsKeyExchangeSuite
   1.434 +/**
   1.435 +The class TWtlsKeyExchangeSuite contain the definitions of WTLS
   1.436 +Key Exchange Suites as defined in the WAP WTLS Specification, July 2001
   1.437 +@publishedAll
   1.438 +@released 
   1.439 +*/
   1.440 +	{
   1.441 +public:
   1.442 +	enum TKeyExchangeSuite
   1.443 +		{
   1.444 +		ENULL					=0,
   1.445 +		ESHARED_SECRET			=1,
   1.446 +		EDH_anon				=2,
   1.447 +		EDH_anon_512			=3,
   1.448 +		EDH_anon_768			=4,
   1.449 +		ERSA_anon				=5,
   1.450 +		ERSA_anon_512			=6,
   1.451 +		ERSA_anon_768			=7,
   1.452 +		ERSA					=8,
   1.453 +		ERSA_512				=9,
   1.454 +		ERSA_768				=10,
   1.455 +		EECDH_anon				=11,
   1.456 +		EECDH_anon_113			=12,
   1.457 +		EECDH_anon_131			=13,
   1.458 +		EECDH_ECDSA				=14,
   1.459 +		EECDH_anon_uncomp		=15,
   1.460 +		EECDH_anon_uncomp_113	=16,
   1.461 +		EECDH_anon_uncomp_131	=17,
   1.462 +		EECDH_ECDSA_uncomp		=18
   1.463 +		};
   1.464 +	enum TKeyIdType 
   1.465 +		{
   1.466 +		EIdNull			= 0,
   1.467 +		EText			= 1, 
   1.468 +		EBinary			= 2, 
   1.469 +		EKeyHashSha		= 254, 
   1.470 +		EX509Name		= 255
   1.471 +		};
   1.472 +
   1.473 +public:
   1.474 +	TWtlsKeyExchangeSuite(TKeyExchangeSuite aKeyExchangeSuite, TKeyIdType aKeyIdType, const TBuf8<KWtlsMaxKeyIdLength>& aKeyId);
   1.475 +
   1.476 +public:
   1.477 +	TKeyExchangeSuite iKeyExchangeSuite;
   1.478 +	TKeyIdType iKeyIdType;
   1.479 +	TBuf8<KWtlsMaxKeyIdLength> iKeyId;
   1.480 +	};
   1.481 +
   1.482 +class TWtlsCipherSuite
   1.483 +/**
   1.484 +The class TWtlsCipherSuite encapsulates a WTLS cipher suite as defined in
   1.485 +the WAP WTLS Specification, July 2001
   1.486 +This is a pair made up of a Bulk Encryption Algorithm and a Mac Algorithm
   1.487 +@publishedAll
   1.488 +@released
   1.489 +*/
   1.490 +	{
   1.491 +public:
   1.492 +			
   1.493 +	enum TBulkEncryptionAlgorithm
   1.494 +		{
   1.495 +		ENULL			=0,
   1.496 +		ERC5_CBC_40		=1,
   1.497 +		ERC5_CBC_56		=2,
   1.498 +		ERC5_CBC		=3,
   1.499 +		EDES_CBC_40		=4,
   1.500 +		EDES_CBC		=5,
   1.501 +		E3DES_CBC_EDE	=6,
   1.502 +		EIDEA_CBC_40	=7,
   1.503 +		EIDEA_CBC_56	=8,
   1.504 +		EIDEA_CBC		=9,
   1.505 +		ERC5_CBC_64		=10,
   1.506 +		EIDEA_CBC_64	=11
   1.507 +		};
   1.508 +
   1.509 +	enum TMacAlgorithm
   1.510 +		{
   1.511 +		ESHA_0			=0,
   1.512 +		ESHA_40			=1,
   1.513 +		ESHA_80			=2,
   1.514 +		ESHA			=3,
   1.515 +//		N/A (removed)	=4,
   1.516 +		EMD5_40			=5,
   1.517 +		EMD5_80			=6,
   1.518 +		EMD5			=7,
   1.519 +		};
   1.520 +
   1.521 +	TWtlsCipherSuite(TBulkEncryptionAlgorithm aBulkEncryptionAlgorithm, TMacAlgorithm aMacAlgorithm);
   1.522 +
   1.523 +public:
   1.524 +	TBulkEncryptionAlgorithm iBulkEncryptionAlgorithm;
   1.525 +	TMacAlgorithm iMacAlgorithm;
   1.526 +	};
   1.527 +
   1.528 +inline TWtlsCipherSuite::TWtlsCipherSuite(TBulkEncryptionAlgorithm aBulkEncryptionAlgorithm, TMacAlgorithm aMacAlgorithm)
   1.529 +	: iBulkEncryptionAlgorithm(aBulkEncryptionAlgorithm), iMacAlgorithm(aMacAlgorithm)
   1.530 +	{
   1.531 +	}
   1.532 +
   1.533 +inline TWtlsKeyExchangeSuite::TWtlsKeyExchangeSuite(TKeyExchangeSuite aKeyExchangeSuite, TKeyIdType aKeyIdType, const TBuf8<KWtlsMaxKeyIdLength>& aKeyId)
   1.534 +	: iKeyExchangeSuite(aKeyExchangeSuite), iKeyIdType(aKeyIdType), iKeyId(aKeyId)
   1.535 +	{
   1.536 +	}
   1.537 +
   1.538 +
   1.539 +#endif	// __WSPTYPES_H__