epoc32/include/obexbase.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/obexbase.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,243 +0,0 @@
     1.4 -// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 -// All rights reserved.
     1.6 -// This component and the accompanying materials are made available
     1.7 -// 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.8 -// which accompanies this distribution, and is available
     1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 -//
    1.11 -// Initial Contributors:
    1.12 -// Nokia Corporation - initial contribution.
    1.13 -//
    1.14 -// Contributors:
    1.15 -//
    1.16 -// Description:
    1.17 -//
    1.18 -
    1.19 -
    1.20 -
    1.21 -/**
    1.22 - @file
    1.23 - @publishedAll
    1.24 - @released
    1.25 -*/
    1.26 -
    1.27 -#ifndef __OBEXBASE_H
    1.28 -#define __OBEXBASE_H
    1.29 -
    1.30 -#include <obextypes.h>
    1.31 -#include <mobexnotify.h>
    1.32 -
    1.33 -class CObexTransportControllerBase;
    1.34 -class TObexTransportInfo;
    1.35 -class CObexPacket;
    1.36 -class CObexNotifyHandlerBase;
    1.37 -
    1.38 -/**
    1.39 -@publishedAll
    1.40 -@released
    1.41 -
    1.42 -This class is the common base class for any object which wishes
    1.43 -to use the Obex Server or Client.
    1.44 -The class which owns a CObexClient or CObexServer must be provide an object
    1.45 -derived from this class to handle the call from the Server/Client for a request
    1.46 -for a Password.
    1.47 -@see CObex::SetCallBack
    1.48 -*/
    1.49 -class MObexAuthChallengeHandler
    1.50 -	{
    1.51 -public:
    1.52 -	/**
    1.53 -	Indicates that the server/client has received an Authentication challenge. The challenge
    1.54 -	can only be responded to once a password has been retrieved by some means and passed
    1.55 -	back to the calling class. The password is passed back via CObex::UserPasswordL
    1.56 -	@param aRealm This will contain the Realm specified by the unit forcing the
    1.57 -	Authentication, if no UserID was supplied then this parameter will be of zero length. 
    1.58 -	*/
    1.59 -	virtual void GetUserPasswordL(const TDesC& aRealm) = 0;
    1.60 -		
    1.61 -	/**
    1.62 - 	Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
    1.63 -	@param aInterface UID of the interface to return
    1.64 -	@param aObject the container for another interface as specified by aInterface
    1.65 -	*/
    1.66 -	IMPORT_C virtual void MOACH_ExtensionInterfaceL(TUid aInterface, void*& aObject);
    1.67 -	};
    1.68 -
    1.69 -/**
    1.70 -This class is the common base class for CObexClient and CObexServer. It is 
    1.71 -an abstract class and cannot be instantiated in itself. However, it does 
    1.72 -contain user functionality common to both client and server connections.
    1.73 -
    1.74 -Provides the basic OBEX transport functionality (sending and receiving 
    1.75 -files)
    1.76 -Client and server provide the more specialied APIs for
    1.77 -- initiation or response to puts & gets
    1.78 -- (possible) handling of more generalised 'objects' (prob. with data buffered through a file).
    1.79 -
    1.80 -This class is not designed for user derivation
    1.81 -
    1.82 -@publishedAll
    1.83 -@released
    1.84 -*/
    1.85 -NONSHARABLE_CLASS(CObex) : public CBase, protected MObexNotify
    1.86 -	{
    1.87 -public:
    1.88 -	/**
    1.89 -	Describes the information set or received in a SETPATH command.
    1.90 -	
    1.91 -	The first bit of iFlags, 0, can be set to indicate to the receiver of SETPATH to backup a level before applying the path name.
    1.92 -	The second bit of iFlags, 1, can be set to indicate to the receiver of SETPATH to NOT create the directory if it doesn't exist.
    1.93 -	The iConstants variable is always set to zero as it is reserved. 
    1.94 -	The iName variable indicates the directory to create or go to, and does not include the root directory of the receiver (i.e. 
    1.95 -	if the directory to be set is C:\notes then iName is set to "notes").
    1.96 -	 If  a name is not set then set CObex::TSetPathInfo::iNamePresent to false. 
    1.97 -	*/
    1.98 -	NONSHARABLE_CLASS(TSetPathInfo)
    1.99 -		{
   1.100 -	public:
   1.101 -		IMPORT_C TSetPathInfo();
   1.102 -		TSetPathInfo(const TObexSetPathData& aData);
   1.103 -		IMPORT_C TBool Parent() const;
   1.104 -		TUint8 iFlags;
   1.105 -		TUint8 iConstants;
   1.106 -		TBuf<KObexObjectDescriptionSize> iName;
   1.107 -		/** Whether iName is present in this SETPATH info */	
   1.108 -		TBool iNamePresent;	
   1.109 -	private:
   1.110 -		// This data padding has been added to help prevent future binary compatibility breaks	
   1.111 -		// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   1.112 -		TUint32     iPadding1; 
   1.113 -		TUint32     iPadding2; 				
   1.114 -		};
   1.115 -		
   1.116 -	/**
   1.117 -	Current obex connection state
   1.118 -	In general, the further through the enum the values are,
   1.119 -	the further through the connection process the state machine
   1.120 -	will be.
   1.121 -	*/
   1.122 -	enum TConnectState 
   1.123 -		{ 
   1.124 -		EConnIdle,					/** Nothing is happening */
   1.125 -		EConnTransport,				/** Transport Link connected not yet established true Link */
   1.126 -		EConnObex,					/** full connection established */
   1.127 -		ESimpleConnRequest,			/** Connect without Auth has been sent by ClientReceived by Server */
   1.128 -		EConnChallRxed,				/**  Server has issued a challenge, to a Client cionnect */
   1.129 -		ESimpleConnChallIssued,		/** Server, received Simple Connect but Server Challenge issued */
   1.130 -		EChallConnRequested,		/** Connect with Auth has been sent by Client/Received by Server */
   1.131 -		EChallConnChallIssued,		/** Server has sent a Challenge & Resp to a Client EChallConnRequest */
   1.132 -		EWaitForFinalResponse,		/** Client, waiting for final success/fail not chall-response expected
   1.133 -									    Server, Waiting for final Resp fromm Client to Challenge */
   1.134 -		EFinalResponseReceived,		/** Server, the final response has been received */
   1.135 -		EFinalChallRxed,			/** Server, Client connect with challenge, Server responds with challenge, Client re-issued original/new challenge */
   1.136 -		EWaitForUserInput,			/** waiting for the user */
   1.137 -		EDropLink					/** drop the link */
   1.138 -		};
   1.139 -
   1.140 -	/**
   1.141 -	The Obex operation currently being performed.
   1.142 -	*/
   1.143 -	enum TOperation 
   1.144 -		{ 
   1.145 -		EOpConnect		= 0x00, /** Connect */
   1.146 -		EOpDisconnect	= 0x01, /** Disconnect */
   1.147 -		EOpPut			= 0x02, /** Put */
   1.148 -		EOpGet			= 0x03, /** Get */
   1.149 -		EOpSetPath		= 0x05, /** SetPath */
   1.150 -		EOpAbort		= 0xFF,	/** Abort - must fit in one pkt so final bit is always set */
   1.151 -		EOpAbortNoFBit	= 0x7F, /** Abort (internal, never transmitted) */
   1.152 -		EOpGetResponse  = 0xFD,	/** Internal - not actually an obex operation. */
   1.153 -		EOpIdle			= 0xFE,	/** Internal - not actually an obex operation. */
   1.154 -		};
   1.155 -		
   1.156 -	/**
   1.157 -	Flags to suppress the authentication elements of the authentication challenge header.
   1.158 -	*/
   1.159 -	enum TObexSuppressedAuthElements
   1.160 -	{
   1.161 -	EObexNoSuppressedAuthElements				= 0x00,
   1.162 -	EObexSuppressChallengeOptionsAuthElement	= 0x01,
   1.163 -	EObexSuppressRealmAuthElement				= 0x02,
   1.164 -	EObexSuppressAllAuthElements				= EObexSuppressChallengeOptionsAuthElement | EObexSuppressRealmAuthElement // Must be last
   1.165 -	};		
   1.166 -		
   1.167 -	virtual ~CObex();
   1.168 -	IMPORT_C void SetCallBack(MObexAuthChallengeHandler& aCallBack);
   1.169 -	IMPORT_C TBool IsConnected() const;
   1.170 -	IMPORT_C TBool IsStrictPeer() const;
   1.171 -	IMPORT_C const TObexConnectInfo& LocalInfo() const;
   1.172 -	IMPORT_C TInt SetLocalWho(const TDesC8& aInfo); 
   1.173 -    IMPORT_C const TObexConnectInfo& RemoteInfo() const;
   1.174 -   	IMPORT_C void SuppressAuthenticationHeaderElements(TObexSuppressedAuthElements aSuppressedObexAuthElements);
   1.175 -	    
   1.176 -	// Implementation of MObexNotify Interface
   1.177 -	/**
   1.178 -	@internalTechnology
   1.179 -	*/
   1.180 -	virtual void Process(CObexPacket& aPacket);
   1.181 -	/**
   1.182 -	@internalTechnology
   1.183 -	*/
   1.184 -	virtual void Error(TInt aError) ;
   1.185 -	/** Call back to start the obex session
   1.186 -	@internalTechnology
   1.187 -	*/
   1.188 -	virtual void TransportUp();
   1.189 -	/**
   1.190 -	@internalTechnology
   1.191 -	*/
   1.192 -	virtual void TransportDown(TBool aForceTransportDeletion);
   1.193 -	
   1.194 -	virtual void UserPasswordL( const TDesC& aPassword) = 0; 
   1.195 -	IMPORT_C void RemoteAddr(TSockAddr& anAddr); 
   1.196 -
   1.197 -	TConnectState GetConnectState() const;
   1.198 -
   1.199 -	IMPORT_C TBool IsAuthenticating() const;
   1.200 -	
   1.201 -protected:
   1.202 -	CObex();
   1.203 -	virtual void ConstructL(TObexTransportInfo& aObexTransportInfo);
   1.204 -	virtual TInt ParseConnectPacket(CObexPacket& aPacket) = 0;	
   1.205 -	void SetConnectState(TConnectState aNewState);
   1.206 -	IMPORT_C TConnectState ConnectState() const;	// same as GetConnectState - has to be maintained here for BC
   1.207 -	virtual void OnPacketReceive(CObexPacket& aPacket) =0;
   1.208 -	virtual void OnError(TInt aError) =0;
   1.209 -	virtual void OnTransportUp() =0;
   1.210 -	virtual void OnTransportDown() =0;
   1.211 -	void ProcessChallengeL(const TObexInternalHeader& hdr);			//process the received challenge
   1.212 -	void ProcessChallResponseL(const TObexInternalHeader& hdr);		//process the response to challenge
   1.213 -	TInt GenerateChallenge(CObexPacket& aPacket);					//generate a challenge 
   1.214 -	void PrepareChallResponseL(const TDesC& aPassword);			//generate a response a respose to challenge
   1.215 -															//after user Password input
   1.216 -	void ForcedTransportDown();
   1.217 -	void ControlledTransportDown();
   1.218 -	void RemoteInfoCleanup();
   1.219 -	void CObex::CancelObexConnection();
   1.220 -protected:
   1.221 -	TConnectState iConnectState;
   1.222 -	CObexTransportControllerBase* iTransportController;
   1.223 -	TObexConnectInfo iLocalInfo;
   1.224 -	TObexConnectInfo iRemoteInfo;
   1.225 -	MObexAuthChallengeHandler* iCallBack;
   1.226 -	TNonce iOutgoingNonce; //nonce used when challenging
   1.227 -	TNonce iIncomingNonce; //nonce used when receiving a challenge
   1.228 -	HBufC8* iChallPassword; //password used when challenging
   1.229 -	HBufC8* iRespPassword; //password used when responding to a challenge
   1.230 -	HBufC8* iRxChallenge;
   1.231 -	TBuf8<KChallResponseSize> iOutgoingChallResp;//response to the previously issued challenge
   1.232 -								//16 nonce, 16 digest resp, 20 UserID, 3*(tag+size)
   1.233 -	TBuf8<KChallResponseSize> iIncomingChallResp;//response received from previous challenge
   1.234 -	TBuf8<KObexRespSize> iIncomingRequestDigest;
   1.235 -	HBufC* iRemoteUID; //UID of remote device
   1.236 -	HBufC* iRemoteRealm;//Realm of remote device
   1.237 -	CObexAuthenticator* iAuthEngine;
   1.238 -	TBool iChallenge; //to challenge or not to challenge?
   1.239 -	TBool iUserIDRequested; //does the challenge insist that a UserID is returned
   1.240 -	TBool iReserved; //released boolean now available for future use
   1.241 -	TOperation iCurrentOperation;
   1.242 -	CObexNotifyHandlerBase* iNotifyHandler;
   1.243 -	TUint iSuppressedObexAuthElements;
   1.244 -	};
   1.245 -
   1.246 -#endif // __OBEXBASE_H