CObex Class Reference

class CObex : public CBase

This class is the common base class for CObexClient and CObexServer . It is an abstract class and cannot be instantiated in itself. However, it does contain user functionality common to both client and server connections.

Provides the basic OBEX transport functionality (sending and receiving files) Client and server provide the more specialied APIs for
  • initiation or response to puts & gets

  • (possible) handling of more generalised 'objects' (prob. with data buffered through a file).

This class is not designed for user derivation

Inherits from

Nested Classes and Structures

Public Member Functions
~CObex ()
void Error ( TInt )
TConnectState GetConnectState ()
IMPORT_C TBool IsAuthenticating ()
IMPORT_C TBool IsConnected ()
IMPORT_C TBool IsStrictPeer ()
IMPORT_C const TObexConnectInfo & LocalInfo ()
void NotifyError ( TInt )
void NotifyProcess ( CObexPacket &)
void NotifyTransportDown ( TBool )
void NotifyTransportUp ()
void Process ( CObexPacket &)
IMPORT_C void RemoteAddr ( TSockAddr &)
IMPORT_C const TObexConnectInfo & RemoteInfo ()
IMPORT_C void SetCallBack ( MObexAuthChallengeHandler &)
IMPORT_C TInt SetLocalWho (const TDesC8 &)
IMPORT_C void SuppressAuthenticationHeaderElements ( TObexSuppressedAuthElements )
void TransportDown ( TBool )
void TransportUp ()
void UserPasswordL (const TDesC &)
Protected Member Functions
CObex ()
void CancelObexConnection ()
IMPORT_C TConnectState ConnectState ()
void ConstructL ( TObexTransportInfo &)
void ControlledTransportDown ()
void ForcedTransportDown ()
TInt GenerateChallenge ( CObexPacket &)
void OnError ( TInt )
void OnPacketReceive ( CObexPacket &)
void OnTransportDown ()
void OnTransportUp ()
TInt ParseConnectPacket ( CObexPacket &)
void PrepareChallResponseL (const TDesC &)
void ProcessChallResponseL (const TObexInternalHeader &)
void ProcessChallengeL (const TObexInternalHeader &)
void RemoteInfoCleanup ()
void SetConnectState ( TConnectState )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TConnectState {
EConnIdle , EConnTransport , EConnObex , ESimpleConnRequest , EConnChallRxed , ESimpleConnChallIssued , EChallConnRequested , EChallConnChallIssued , EWaitForFinalResponse , EFinalResponseReceived , EFinalChallRxed , EWaitForUserInput , EDropLink
}
enum TObexSuppressedAuthElements { EObexNoSuppressedAuthElements  = 0x00, EObexSuppressChallengeOptionsAuthElement  = 0x01, EObexSuppressRealmAuthElement  = 0x02, EObexSuppressAllAuthElements  = EObexSuppressChallengeOptionsAuthElement | EObexSuppressRealmAuthElement }
enum TOperation {
EOpConnect  = 0x00, EOpDisconnect  = 0x01, EOpPut  = 0x02, EOpGet  = 0x03, EOpSetPath  = 0x05, EOpAbort  = 0xFF, EOpAbortNoFBit  = 0x7F, EOpGetResponse  = 0xFD, EOpIdle  = 0xFE
}
Protected Attributes
CObexAuthenticator * iAuthEngine
MObexAuthChallengeHandler * iCallBack
HBufC8 * iChallPassword
TBool iChallenge
TConnectState iConnectState
TOperation iCurrentOperation
TBuf8 < KChallResponseSize > iIncomingChallResp
TNonce iIncomingNonce
TBuf8 < KObexRespSize > iIncomingRequestDigest
TObexConnectInfo iLocalInfo
CObexNotifyHandlerBase * iNotifyHandler
TBuf8 < KChallResponseSize > iOutgoingChallResp
TNonce iOutgoingNonce
TObexConnectInfo iRemoteInfo
HBufC * iRemoteRealm
HBufC * iRemoteUID
TBool iReserved
HBufC8 * iRespPassword
HBufC8 * iRxChallenge
TUint iSuppressedObexAuthElements
CObexTransportControllerBase * iTransportController
TBool iUserIDRequested

Constructor & Destructor Documentation

CObex()

CObex ( ) [protected]

Constructor - set initial values and copy in protocol policy information

~CObex()

~CObex ( ) [virtual]

Destructor.

Member Functions Documentation

CancelObexConnection()

void CancelObexConnection ( ) [protected]

Put into transport connected state but cancel any outstanding transfers and operations

ConnectState()

IMPORT_C TConnectState ConnectState ( ) const [protected]

This function is in the protected scope of CObex and so is not externally usable

ConstructL(TObexTransportInfo &)

void ConstructL ( TObexTransportInfo & aObexTransportInfo ) [protected, virtual]

Parameters

TObexTransportInfo & aObexTransportInfo

ControlledTransportDown()

void ControlledTransportDown ( ) [protected]

This function will tear down the transport if the transport layer supports transport reconnection on obex reconnection This is called in conditions other than error conditions

ForcedTransportDown()

Error(TInt)

void Error ( TInt aError ) [virtual]

This function is retained for backwards compatibility and should not be called.

Calling this function has undefined behaviour.

Parameters

TInt aError

ForcedTransportDown()

void ForcedTransportDown ( ) [protected]

This function forces the transport to be taken down regardless of whether or not the underlying transport can recover without restarting obex applications However if the transport controller fails to bring the transport down, then only the obex connection is cancelled. This is called in error conditions

ControlledTransportDown()

GenerateChallenge(CObexPacket &)

TInt GenerateChallenge ( CObexPacket & aPacket ) [protected]

Parameters

CObexPacket & aPacket

GetConnectState()

TConnectState GetConnectState ( ) const

Get the current state of the authentication state machine

IsAuthenticating()

IMPORT_C TBool IsAuthenticating ( ) const

Indicates if the Server / Client is currently authenticating the OBEX connection.

IsConnected()

IMPORT_C TBool IsConnected ( ) const

Returns ETrue if this CObex is connected at an OBEX level, merely having a transport connected does not satisfy this condition. I.e. the two devices must have completed the OBEX connection request/response . All other states return EFalse. This will be unreliable if either the server blindly returns the client s who header (always reporting ETrue), or if neither supply "who" headers (always reporting EFalse).

IsStrictPeer()

IMPORT_C TBool IsStrictPeer ( ) const

LocalInfo()

IMPORT_C const TObexConnectInfo & LocalInfo ( ) const

Use this member to gain access to (and alter, if necessary) the CObex::TConnectInfo structure which will be sent to the OBEX peer as part of the connection process. Only alter the contents of this having read and understood the purpose of the fields, as defined in the OBEX spec. Altering this structure after a connection has been made will have no effect on the current session, but will be used for future connection attempts.

NotifyError(TInt)

void NotifyError ( TInt aError )

Parameters

TInt aError

NotifyProcess(CObexPacket &)

void NotifyProcess ( CObexPacket & aPacket )

Parameters

CObexPacket & aPacket

NotifyTransportDown(TBool)

void NotifyTransportDown ( TBool )

Parameters

TBool

NotifyTransportUp()

void NotifyTransportUp ( )

OnError(TInt)

void OnError ( TInt aError ) [protected, pure virtual]

Parameters

TInt aError

OnPacketReceive(CObexPacket &)

void OnPacketReceive ( CObexPacket & aPacket ) [protected, pure virtual]

Parameters

CObexPacket & aPacket

OnTransportDown()

void OnTransportDown ( ) [protected, pure virtual]

OnTransportUp()

void OnTransportUp ( ) [protected, pure virtual]

ParseConnectPacket(CObexPacket &)

TInt ParseConnectPacket ( CObexPacket & aPacket ) [protected, pure virtual]

Parameters

CObexPacket & aPacket

PrepareChallResponseL(const TDesC &)

void PrepareChallResponseL ( const TDesC & aPassword ) [protected]

Parameters

const TDesC & aPassword Password to use in challenge response

Process(CObexPacket &)

void Process ( CObexPacket & aPacket ) [virtual]

This function is retained for backwards compatibility and should not be called.

Calling this function has undefined behaviour.

Parameters

CObexPacket & aPacket

ProcessChallResponseL(const TObexInternalHeader &)

void ProcessChallResponseL ( const TObexInternalHeader & hdr ) [protected]

Parameters

const TObexInternalHeader & hdr

ProcessChallengeL(const TObexInternalHeader &)

void ProcessChallengeL ( const TObexInternalHeader & hdr ) [protected]

Parameters

const TObexInternalHeader & hdr

RemoteAddr(TSockAddr &)

IMPORT_C void RemoteAddr ( TSockAddr & anAddr )

Get the socket address of the remote device.

This is the address of the device OBEX is connected to over an IrDA or Bluetooth socket.

Parameters

TSockAddr & anAddr Socket address.

RemoteInfo()

IMPORT_C const TObexConnectInfo & RemoteInfo ( ) const

Use this member to read the details of the remote machine s connection information, as specified by it in during OBEX connection. This data can not be altered, as this serves no purpose. The content of this structure is undefined when IsConnected () == EFalse .

RemoteInfoCleanup()

void RemoteInfoCleanup ( ) [protected]

General cleanup of iRemoteInfo

SetCallBack(MObexAuthChallengeHandler &)

IMPORT_C void SetCallBack ( MObexAuthChallengeHandler & aCallBack )

Sets the authentication challenge handler.

The caller must supply a MObexAuthChallengeHandler implementation to handle calls from the Server/Client for a request for a password.

Parameters

MObexAuthChallengeHandler & aCallBack Authentication challenge handler

SetConnectState(TConnectState)

void SetConnectState ( TConnectState aNewState ) [protected]

Change the state of the authentication state machine

Parameters

TConnectState aNewState New state

SetLocalWho(const TDesC8 &)

IMPORT_C TInt SetLocalWho ( const TDesC8 & aInfo )

Sets the local Who field.

This is used to identify the local end of the OBEX session when the OBEX connection is made. If it is required, set it before establishing the connection.

Parameters

const TDesC8 & aInfo Who field

SuppressAuthenticationHeaderElements(TObexSuppressedAuthElements)

IMPORT_C void SuppressAuthenticationHeaderElements ( TObexSuppressedAuthElements aSuppressedObexAuthElements )
Must be called by an application that wishes to suppress the authentication or(not excusive) the realm of the authentication challenge
panic
KErrArgument if invalid value is passed in for enum

Parameters

TObexSuppressedAuthElements aSuppressedObexAuthElements enum TObexSuppressedAuthElements to indicate which header elements to surpress (if any)

TransportDown(TBool)

void TransportDown ( TBool aForceTransportDeletion ) [virtual]

This function is retained for backwards compatibility and should not be called. Use ControlledTransportDown() or ForcedTransportDown() to disconnect the transport layer. Calling this function will result in an ETransportDownCalled panic.

panic
ObexFault ETransportDownCalled
ControlledTransportDown() ForcedTransportDown()

Parameters

TBool aForceTransportDeletion

TransportUp()

void TransportUp ( ) [virtual]

This function is retained for backwards compatibility and should not be called.

Calling this function has undefined behaviour.

UserPasswordL(const TDesC &)

void UserPasswordL ( const TDesC & aPassword ) [pure virtual]

Parameters

const TDesC & aPassword

Member Enumerations Documentation

Enum TConnectState

Current obex connection state In general, the further through the enum the values are, the further through the connection process the state machine will be.

Enumerators

EConnIdle
EConnTransport

Nothing is happening

EConnObex

Transport Link connected not yet established true Link

ESimpleConnRequest

full connection established

EConnChallRxed

Connect without Auth has been sent by ClientReceived by Server

ESimpleConnChallIssued

Server has issued a challenge, to a Client cionnect

EChallConnRequested

Server, received Simple Connect but Server Challenge issued

EChallConnChallIssued

Connect with Auth has been sent by Client/Received by Server

EWaitForFinalResponse

Server has sent a Challenge & Resp to a Client EChallConnRequest

EFinalResponseReceived

Client, waiting for final success/fail not chall-response expected Server, Waiting for final Resp fromm Client to Challenge

EFinalChallRxed

Server, the final response has been received

EWaitForUserInput

Server, Client connect with challenge, Server responds with challenge, Client re-issued original/new challenge

EDropLink

waiting for the user drop the link

Enum TObexSuppressedAuthElements

Flags to suppress the authentication elements of the authentication challenge header.

Enumerators

EObexNoSuppressedAuthElements = 0x00
EObexSuppressChallengeOptionsAuthElement = 0x01
EObexSuppressRealmAuthElement = 0x02
EObexSuppressAllAuthElements = EObexSuppressChallengeOptionsAuthElement | EObexSuppressRealmAuthElement

Enum TOperation

The Obex operation currently being performed.

Enumerators

EOpConnect = 0x00
EOpDisconnect = 0x01

Connect

EOpPut = 0x02

Disconnect

EOpGet = 0x03

Put

EOpSetPath = 0x05

Get

EOpAbort = 0xFF

SetPath

EOpAbortNoFBit = 0x7F

Abort - must fit in one pkt so final bit is always set

EOpGetResponse = 0xFD

Abort (internal, never transmitted)

EOpIdle = 0xFE

Internal - not actually an obex operation.

Member Data Documentation

CObexAuthenticator * iAuthEngine

CObexAuthenticator * iAuthEngine [protected]

MObexAuthChallengeHandler * iCallBack

MObexAuthChallengeHandler * iCallBack [protected]

HBufC8 * iChallPassword

HBufC8 * iChallPassword [protected]

TBool iChallenge

TBool iChallenge [protected]

TConnectState iConnectState

TConnectState iConnectState [protected]

TOperation iCurrentOperation

TOperation iCurrentOperation [protected]

TBuf8< KChallResponseSize > iIncomingChallResp

TBuf8 < KChallResponseSize > iIncomingChallResp [protected]

TNonce iIncomingNonce

TNonce iIncomingNonce [protected]

TBuf8< KObexRespSize > iIncomingRequestDigest

TBuf8 < KObexRespSize > iIncomingRequestDigest [protected]

TObexConnectInfo iLocalInfo

TObexConnectInfo iLocalInfo [protected]

CObexNotifyHandlerBase * iNotifyHandler

CObexNotifyHandlerBase * iNotifyHandler [protected]

TBuf8< KChallResponseSize > iOutgoingChallResp

TBuf8 < KChallResponseSize > iOutgoingChallResp [protected]

TNonce iOutgoingNonce

TNonce iOutgoingNonce [protected]

TObexConnectInfo iRemoteInfo

TObexConnectInfo iRemoteInfo [protected]

HBufC * iRemoteRealm

HBufC * iRemoteRealm [protected]

HBufC * iRemoteUID

HBufC * iRemoteUID [protected]

TBool iReserved

TBool iReserved [protected]

HBufC8 * iRespPassword

HBufC8 * iRespPassword [protected]

HBufC8 * iRxChallenge

HBufC8 * iRxChallenge [protected]

TUint iSuppressedObexAuthElements

TUint iSuppressedObexAuthElements [protected]

CObexTransportControllerBase * iTransportController

CObexTransportControllerBase * iTransportController [protected]

TBool iUserIDRequested

TBool iUserIDRequested [protected]