williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file WspTypes.h williamr@2: @warning : This file contains Rose Model ID comments - please do not delete williamr@2: */ williamr@2: williamr@2: #ifndef __WSPTYPES_H__ williamr@2: #define __WSPTYPES_H__ williamr@2: williamr@2: // System includes williamr@2: #include williamr@2: #include williamr@2: williamr@2: //TODO - These will move to a common WAPMSG/WSPTransport file at a later stage, williamr@2: //in the wap-stack subsystem, to be shared with the WAP Messaging API. williamr@2: williamr@2: namespace Wap williamr@2: /** williamr@2: All type definitions and enumerations used in WSP are in placed in a wider WAP williamr@2: namespace, to avoid name conflicts with other components. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: williamr@2: /** The TWspPrimitive type represents the WSP primitives defined in the WSP williamr@2: Specification, July 2001. williamr@2: */ williamr@2: enum TWspPrimitive williamr@2: { williamr@2: /** williamr@2: */ williamr@2: ESConnect = 0, williamr@2: /** williamr@2: */ williamr@2: ESDisconnect, williamr@2: /** williamr@2: */ williamr@2: ESSuspend, williamr@2: /** williamr@2: */ williamr@2: ESResume, williamr@2: /** williamr@2: */ williamr@2: ESException, williamr@2: /** williamr@2: */ williamr@2: ESMethodInvoke, williamr@2: /** williamr@2: */ williamr@2: ESMethodInvokeData, williamr@2: /** williamr@2: */ williamr@2: ESMethodResult, williamr@2: /** williamr@2: */ williamr@2: ESMethodResultData, williamr@2: /** williamr@2: */ williamr@2: ESMethodAbort, williamr@2: /** williamr@2: */ williamr@2: ESPush, williamr@2: /** williamr@2: */ williamr@2: ESConfirmedPush, williamr@2: /** williamr@2: */ williamr@2: ESPushAbort williamr@2: }; williamr@2: williamr@2: /** The TWspProtocolOptions type represents the optional protocol functions williamr@2: defined in the WSP Specification, July 2001. When the client sends the williamr@2: Protocol Capability to the server, it indicates which functions it will williamr@2: accept from the server. The server returns from the set of functions sent williamr@2: by the client those that it will perform. williamr@2: */ williamr@2: enum TWspProtocolOptions williamr@2: { williamr@2: /** The Large Data Transfer feature includes support for multiple SDU's and williamr@2: support for the Data Fragment PDU. Setting this falg indicates support williamr@2: for sending and receiving large data. If a client only wishes to receive williamr@2: large data, then it should set the Client and Server Message size fields williamr@2: appropriately. williamr@2: */ williamr@2: ELargeDataTransfer = 0x08, williamr@2: /** The acknowledgement headers flag specifies that the client wishes to send williamr@2: acknowledgement headers. If the server cannot process them (indicated by williamr@2: negotiating down the flag) the client should not send the headers as they williamr@2: will be ignored. williamr@2: */ williamr@2: EAcknowledgementHeaders = 0x10, williamr@2: /** The client enables the Suspend Resume facility when it wishes to suspend williamr@2: and resume the session. If the server does not support suspend and resume williamr@2: then this flag must be cleared in the negotiated capabilities. williamr@2: */ williamr@2: ESessionResumeFacility = 0x20, williamr@2: /** The client uses this flag to indicate that it is able and willing to williamr@2: receive push information. If the server cannot send pushes then this flag williamr@2: must be cleared in the negotiated capabilities. williamr@2: */ williamr@2: EPushFacility = 0x40, williamr@2: /** The client uses this flag to indicate that it is able and willing to williamr@2: receive confirmed push information. If the server cannot send pushes williamr@2: then this flag must be cleared in the negotiated capabilities. williamr@2: */ williamr@2: EConfirmedPushFacility = 0x80 williamr@2: }; williamr@2: williamr@2: /** The TWspSessionState type represents the states of a WSP session, as defined williamr@2: by the WSP Specification, July 2001. williamr@2: */ williamr@2: enum TWspSessionState williamr@2: { williamr@2: /** williamr@2: */ williamr@2: ENull = 0, williamr@2: /** williamr@2: */ williamr@2: EConnecting, williamr@2: /** williamr@2: */ williamr@2: EConnected, williamr@2: /** williamr@2: */ williamr@2: ESuspending, williamr@2: /** williamr@2: */ williamr@2: ESuspended, williamr@2: /** williamr@2: */ williamr@2: EClosing, williamr@2: /** williamr@2: */ williamr@2: EResuming williamr@2: }; williamr@2: williamr@2: /** The TWspMethodState type represents the states of a WSP method transaction, williamr@2: as defined by the WSP Specification, July 2001. williamr@2: */ williamr@2: enum TWspMethodState williamr@2: { williamr@2: /** williamr@2: */ williamr@2: ENullMethod =0, williamr@2: /** williamr@2: */ williamr@2: ERequesting, williamr@2: /** williamr@2: */ williamr@2: EWaiting, williamr@2: /** williamr@2: */ williamr@2: EWaiting2, williamr@2: /** williamr@2: */ williamr@2: ECompleting, williamr@2: /** williamr@2: */ williamr@2: EAborting williamr@2: }; williamr@2: williamr@2: /** The TWspBearer type defines the set of supported bearers. williamr@2: */ williamr@2: enum TWspBearer williamr@2: { williamr@2: /** Specifier for any bearer. williamr@2: */ williamr@2: EAny = 0, williamr@2: /** IP bearer. williamr@2: */ williamr@2: EIP, williamr@2: /** A 7-bit SMS bearer. williamr@2: */ williamr@2: ESMS7, williamr@2: /** An 8-bit SMS bearer. williamr@2: */ williamr@2: ESMS, williamr@2: /** A 7-bit WAP SMS bearer. williamr@2: */ williamr@2: EWAPSMS7, williamr@2: /** An 8-bit WAP SMS bearer. williamr@2: */ williamr@2: EWAPSMS williamr@2: }; williamr@2: williamr@2: /** The TWspSession type defines the 2 types of WSP Session Service; Connection williamr@2: Oriented and Connectionless. williamr@2: */ williamr@2: enum TWspSession williamr@2: { williamr@2: /** Specifier for Connection Oriented Session Service. williamr@2: */ williamr@2: EWspConnectionOriented = 0, williamr@2: /** Specifier for Connectionless Session Service. williamr@2: */ williamr@2: EWspConnectionLess williamr@2: }; williamr@2: williamr@2: /** The TWspReason type is used by to report the cause of a particular indication williamr@2: primitive. The WSP Specification, July 2001, specifies a given set that MUST williamr@2: be recognised (6.2.5). Further values may be added. williamr@2: */ williamr@2: enum TWspReason williamr@2: { williamr@2: /** The rules of the protocol were broken and in its current state, the peer williamr@2: could not perform the specified operation. E.g. the PDU was not allowed. williamr@2: */ williamr@2: EProtoErr = 0xE0, williamr@2: /** The session was disconnected while the operation was still in progress. williamr@2: */ williamr@2: EDisconnect = 0xE1, williamr@2: /** The session was suspended while the operation was still in progress. williamr@2: */ williamr@2: ESuspend = 0xE2, williamr@2: /** The session was resumed while the operation was still in progress. williamr@2: */ williamr@2: EResume = 0xE3, williamr@2: /** The request could not be processed due to a lack of resources. williamr@2: */ williamr@2: ECongestion = 0xE4, williamr@2: /** The connection was prevented due to an error. williamr@2: */ williamr@2: EConnectErr = 0xE5, williamr@2: /** The SDU size in a request exceeded the maximum negotiated SDU size. williamr@2: */ williamr@2: EMRUExceeded = 0xE6, williamr@2: /** The negotiated value of the maximum outstanding transactions (either for williamr@2: push or method transactions) has been exceeded. williamr@2: */ williamr@2: EMORExceeded = 0xE7, williamr@2: /** The operation was aborted by the Provider. williamr@2: */ williamr@2: EPeerReq = 0xE8, williamr@2: /** An underlying network error prevented the completion of a request. williamr@2: */ williamr@2: ENetErr = 0xE9, williamr@2: /** The cause of the indication was an action by the Client. williamr@2: */ williamr@2: EUserReq = 0xEA, williamr@2: /** The client has refesed the Push message, no specific reason, no retries. williamr@2: */ williamr@2: EUserRfs = 0xEB, williamr@2: /** The Push message cannot be delivered to the intended destination. williamr@2: */ williamr@2: EUserPnd = 0xEC, williamr@2: /** The Push message was discarded due to resource shortage. williamr@2: */ williamr@2: EUserDcr = 0xED, williamr@2: /** The content-type of the Push message cannot be processed. williamr@2: */ williamr@2: EUserDcu = 0xEE, williamr@2: /** The session connect request has been redirected to a new proxy. This is williamr@2: a temporary redirection and the original proxy should be used in the williamr@2: future when trying to access this service. This is not defined by the williamr@2: WSP Specification. williamr@2: */ williamr@2: ETemporaryRedirectedProxy =0, williamr@2: /** The session connect request has been redirected to a new proxy. This is williamr@2: a permanent redirection and the new proxy should be used in the future williamr@2: when trying to access this service. The client will be notified of this williamr@2: event and the HTTP session property EWspProxyAddressnew will contain the williamr@2: new proxy's address. The client should update its access point database. williamr@2: This is not defined by the WSP Specification. williamr@2: */ williamr@2: EPermanentRedirectedProxy, williamr@2: /** The client had disconnected the session, but as Suspend Resume facility williamr@2: was being used, the session was suspended. The client then changed the williamr@2: proxy and did a connect. The suspended session cannot be resumed, so the williamr@2: the current session must be disconnected (with this reason) and a williamr@2: session connect initiated with the new proxy. This is not defined by the williamr@2: WSP Specification. williamr@2: */ williamr@2: EChangedProxyInSuspendedSession, williamr@2: /** The client's WSP session was disconnected in the Connecting state because williamr@2: configuration of the underlying WTLS layer failed prior to the phase 1 williamr@2: WTLS handshake. williamr@2: */ williamr@2: EWtlsConfigurationFailed, williamr@2: /** The client's WSP session was disconnected in the Connecting state because williamr@2: phase 1 of the WTLS handshake failed. williamr@2: */ williamr@2: EWtlsPhase1HandshakeFailed, williamr@2: /** The client's WSP session was disconnected in the Connecting state because williamr@2: phase 2 of the WTLS handshake failed. williamr@2: */ williamr@2: EWtlsPhase2HandshakeFailed, williamr@2: /** The client's WSP session was disconnected in the Connecting state because williamr@2: the proxy's WTLS certificate was invalid - e.g. badly formed, or out of date. williamr@2: */ williamr@2: EWtlsInvalidServerCert, williamr@2: /** The client's WSP session was disconnected in the Connecting state because williamr@2: the proxy's WTLS certificate could not be trusted. This means it was not signed williamr@2: by any root certificate on the device, and the security policy criteria could not williamr@2: determine further whether it could be trusted or not. williamr@2: */ williamr@2: EWtlsUntrustedServerCert, williamr@2: /** The client's WSP session was disconnected in the Connecting state because williamr@2: the negotiated WTLS configuration at completion of the secure handshake was williamr@2: rejected by criteria in the security policy. williamr@2: */ williamr@2: EWtlsNegotiatedConfigRejected, williamr@2: /** The client's transaction or session has failed due to an out-of-memory situation. williamr@2: */ williamr@2: EOutOfMemory, williamr@2: /** The client's session has entered an inconsistent state, probably due to a failure caused williamr@2: by an out-of-memory situation. williamr@2: */ williamr@2: ESessionStateFailure williamr@2: }; williamr@2: williamr@2: /** The enum TWspCapabilty is used to select a capability to reset (if required) williamr@2: before setting the value of the capability. williamr@2: */ williamr@2: enum TWspCapability williamr@2: { williamr@2: /** Specifies the Alias Addresses capability. williamr@2: */ williamr@2: EAliasAddresses = 0, williamr@2: /** Specifies the Extended Methods capability. williamr@2: */ williamr@2: EExtendedMethods, williamr@2: /** Specifies the Header Code Pages capability. williamr@2: */ williamr@2: EHeaderCodePages, williamr@2: /** Specifies the Method Maximum Outstanding Requests capability. Default value is 1. williamr@2: */ williamr@2: EMethodMOR, williamr@2: /** Specifies the Push Maximum Outstanding Requests capability. Default value is 1. williamr@2: */ williamr@2: EPushMOR, williamr@2: /** Specifies the Protocol Options capability. Default value is 0x00. williamr@2: */ williamr@2: EProtocolOptions, williamr@2: /** Specifies the Client SDU size capability. Default value is 1400 octets. williamr@2: */ williamr@2: EClientSDUSize, williamr@2: /** Specifies the Server SDU size capability. Default value is 1400 octets. williamr@2: */ williamr@2: EServerSDUSize, williamr@2: /** Specifies the Client Message size capability. Default value is 1400 octets. williamr@2: */ williamr@2: EClientMessageSize, williamr@2: /** Specifies the Server Message size capability. Default value is 1400 octets. williamr@2: */ williamr@2: EServerMessageSize, williamr@2: /** Specifies the Unknown capabilities. williamr@2: */ williamr@2: EUnknownCapabilities, williamr@2: /** Specifies all the capabilities. williamr@2: */ williamr@2: EAllCapabilities williamr@2: }; williamr@2: williamr@2: } // end of namespace Wap williamr@2: williamr@2: williamr@2: /** williamr@2: Maximum Proxy address length, this is large enough for a full IPv6 address. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KMaxProxyAddrLen = 40; williamr@2: williamr@2: //##ModelId=3C4C41B20079 williamr@2: class TWspRedirectedAddress williamr@2: /** williamr@2: The TWspRedirectedAddress type represents an alternate address to which williamr@2: Clients must use to establish a session with the same service that was williamr@2: initially contacted. If the bearer or port fields have been excluded, then williamr@2: the orginal bearer and port should be used to contact the new server. The williamr@2: WSP Specification, July 2001, defines an Address Type (8.2.2.3) upon which williamr@2: this class is based. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: // Attributes williamr@2: williamr@2: /** A flag to indicate that the port field is set. williamr@2: */ williamr@2: //##ModelId=3C4C41B200DD williamr@2: TBool iHasPort; williamr@2: williamr@2: /** A flag to indicate that the bearer field is set. williamr@2: */ williamr@2: //##ModelId=3C4C41B200CB williamr@2: TBool iHasBearer; williamr@2: williamr@2: /** The proxy address. williamr@2: */ williamr@2: //##ModelId=3C4C41B200C1 williamr@2: TBuf8 iProxyAddress; williamr@2: williamr@2: /** The port number. williamr@2: */ williamr@2: //##ModelId=3C4C41B200B5 williamr@2: TUint16 iPort; williamr@2: williamr@2: /** The bearer type. williamr@2: */ williamr@2: //##ModelId=3C4C41B200A3 williamr@2: Wap::TWspBearer iBearer; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Maximum length of a key ID for WTLS williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KWtlsMaxKeyIdLength = 512; williamr@2: williamr@2: class TWtlsKeyExchangeSuite williamr@2: /** williamr@2: The class TWtlsKeyExchangeSuite contain the definitions of WTLS williamr@2: Key Exchange Suites as defined in the WAP WTLS Specification, July 2001 williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: enum TKeyExchangeSuite williamr@2: { williamr@2: ENULL =0, williamr@2: ESHARED_SECRET =1, williamr@2: EDH_anon =2, williamr@2: EDH_anon_512 =3, williamr@2: EDH_anon_768 =4, williamr@2: ERSA_anon =5, williamr@2: ERSA_anon_512 =6, williamr@2: ERSA_anon_768 =7, williamr@2: ERSA =8, williamr@2: ERSA_512 =9, williamr@2: ERSA_768 =10, williamr@2: EECDH_anon =11, williamr@2: EECDH_anon_113 =12, williamr@2: EECDH_anon_131 =13, williamr@2: EECDH_ECDSA =14, williamr@2: EECDH_anon_uncomp =15, williamr@2: EECDH_anon_uncomp_113 =16, williamr@2: EECDH_anon_uncomp_131 =17, williamr@2: EECDH_ECDSA_uncomp =18 williamr@2: }; williamr@2: enum TKeyIdType williamr@2: { williamr@2: EIdNull = 0, williamr@2: EText = 1, williamr@2: EBinary = 2, williamr@2: EKeyHashSha = 254, williamr@2: EX509Name = 255 williamr@2: }; williamr@2: williamr@2: public: williamr@2: TWtlsKeyExchangeSuite(TKeyExchangeSuite aKeyExchangeSuite, TKeyIdType aKeyIdType, const TBuf8& aKeyId); williamr@2: williamr@2: public: williamr@2: TKeyExchangeSuite iKeyExchangeSuite; williamr@2: TKeyIdType iKeyIdType; williamr@2: TBuf8 iKeyId; williamr@2: }; williamr@2: williamr@2: class TWtlsCipherSuite williamr@2: /** williamr@2: The class TWtlsCipherSuite encapsulates a WTLS cipher suite as defined in williamr@2: the WAP WTLS Specification, July 2001 williamr@2: This is a pair made up of a Bulk Encryption Algorithm and a Mac Algorithm williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: williamr@2: enum TBulkEncryptionAlgorithm williamr@2: { williamr@2: ENULL =0, williamr@2: ERC5_CBC_40 =1, williamr@2: ERC5_CBC_56 =2, williamr@2: ERC5_CBC =3, williamr@2: EDES_CBC_40 =4, williamr@2: EDES_CBC =5, williamr@2: E3DES_CBC_EDE =6, williamr@2: EIDEA_CBC_40 =7, williamr@2: EIDEA_CBC_56 =8, williamr@2: EIDEA_CBC =9, williamr@2: ERC5_CBC_64 =10, williamr@2: EIDEA_CBC_64 =11 williamr@2: }; williamr@2: williamr@2: enum TMacAlgorithm williamr@2: { williamr@2: ESHA_0 =0, williamr@2: ESHA_40 =1, williamr@2: ESHA_80 =2, williamr@2: ESHA =3, williamr@2: // N/A (removed) =4, williamr@2: EMD5_40 =5, williamr@2: EMD5_80 =6, williamr@2: EMD5 =7, williamr@2: }; williamr@2: williamr@2: TWtlsCipherSuite(TBulkEncryptionAlgorithm aBulkEncryptionAlgorithm, TMacAlgorithm aMacAlgorithm); williamr@2: williamr@2: public: williamr@2: TBulkEncryptionAlgorithm iBulkEncryptionAlgorithm; williamr@2: TMacAlgorithm iMacAlgorithm; williamr@2: }; williamr@2: williamr@2: inline TWtlsCipherSuite::TWtlsCipherSuite(TBulkEncryptionAlgorithm aBulkEncryptionAlgorithm, TMacAlgorithm aMacAlgorithm) williamr@2: : iBulkEncryptionAlgorithm(aBulkEncryptionAlgorithm), iMacAlgorithm(aMacAlgorithm) williamr@2: { williamr@2: } williamr@2: williamr@2: inline TWtlsKeyExchangeSuite::TWtlsKeyExchangeSuite(TKeyExchangeSuite aKeyExchangeSuite, TKeyIdType aKeyIdType, const TBuf8& aKeyId) williamr@2: : iKeyExchangeSuite(aKeyExchangeSuite), iKeyIdType(aKeyIdType), iKeyId(aKeyId) williamr@2: { williamr@2: } williamr@2: williamr@2: williamr@2: #endif // __WSPTYPES_H__