CObex Class Reference

#include <mw/obexbase.h>

Link against: obex.lib

class CObex : public CBase

Inherits from

  • CObex

    Nested Classes and Structures

    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
    Public Member Enumerations
    enumTConnectState { EConnIdle, EConnTransport, EConnObex, ESimpleConnRequest, ..., EDropLink }
    enumTObexSuppressedAuthElements { EObexNoSuppressedAuthElements, EObexSuppressChallengeOptionsAuthElement, EObexSuppressRealmAuthElement, EObexSuppressAllAuthElements }
    enumTOperation { EOpConnect, EOpDisconnect, EOpPut, EOpGet, ..., EOpIdle }
    Public Member Functions
    virtual ~CObex()
    virtual voidError(TInt)
    TConnectState GetConnectState()
    IMPORT_C TBoolIsAuthenticating()
    IMPORT_C TBoolIsConnected()
    IMPORT_C TBoolIsStrictPeer()
    IMPORT_C const TObexConnectInfo &LocalInfo()
    voidNotifyError(TInt)
    voidNotifyProcess(CObexPacket &)
    voidNotifyTransportDown(TBool)
    voidNotifyTransportUp()
    virtual voidProcess(CObexPacket &)
    IMPORT_C voidRemoteAddr(TSockAddr &)
    IMPORT_C const TObexConnectInfo &RemoteInfo()
    IMPORT_C voidSetCallBack(MObexAuthChallengeHandler &)
    IMPORT_C TIntSetLocalWho(const TDesC8 &)
    IMPORT_C voidSuppressAuthenticationHeaderElements(TObexSuppressedAuthElements)
    virtual voidTransportDown(TBool)
    virtual voidTransportUp()
    pure virtual voidUserPasswordL(const TDesC &)
    Protected Member Functions
    CObex()
    voidCancelObexConnection()
    IMPORT_C TConnectStateConnectState()
    virtual voidConstructL(TObexTransportInfo &)
    voidControlledTransportDown()
    voidForcedTransportDown()
    TInt GenerateChallenge(CObexPacket &)
    pure virtual voidOnError(TInt)
    pure virtual voidOnPacketReceive(CObexPacket &)
    pure virtual voidOnTransportDown()
    pure virtual voidOnTransportUp()
    pure virtual TInt ParseConnectPacket(CObexPacket &)
    voidPrepareChallResponseL(const TDesC &)
    voidProcessChallResponseL(const TObexInternalHeader &)
    voidProcessChallengeL(const TObexInternalHeader &)
    voidRemoteInfoCleanup()
    voidSetConnectState(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()

    Detailed Description

    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

    Member Attribute Documentation

    iAuthEngine

    CObexAuthenticator *iAuthEngine[protected]

    iCallBack

    MObexAuthChallengeHandler *iCallBack[protected]

    iChallPassword

    HBufC8 *iChallPassword[protected]

    iChallenge

    TBool iChallenge[protected]

    iConnectState

    TConnectState iConnectState[protected]

    iCurrentOperation

    TOperation iCurrentOperation[protected]

    iIncomingChallResp

    TBuf8< KChallResponseSize >iIncomingChallResp[protected]

    iIncomingNonce

    TNonce iIncomingNonce[protected]

    iIncomingRequestDigest

    TBuf8< KObexRespSize >iIncomingRequestDigest[protected]

    iLocalInfo

    TObexConnectInfo iLocalInfo[protected]

    iNotifyHandler

    CObexNotifyHandlerBase *iNotifyHandler[protected]

    iOutgoingChallResp

    TBuf8< KChallResponseSize >iOutgoingChallResp[protected]

    iOutgoingNonce

    TNonce iOutgoingNonce[protected]

    iRemoteInfo

    TObexConnectInfo iRemoteInfo[protected]

    iRemoteRealm

    HBufC *iRemoteRealm[protected]

    iRemoteUID

    HBufC *iRemoteUID[protected]

    iReserved

    TBool iReserved[protected]

    iRespPassword

    HBufC8 *iRespPassword[protected]

    iRxChallenge

    HBufC8 *iRxChallenge[protected]

    iSuppressedObexAuthElements

    TUint iSuppressedObexAuthElements[protected]

    iTransportController

    CObexTransportControllerBase *iTransportController[protected]

    iUserIDRequested

    TBool iUserIDRequested[protected]

    Member Enumeration 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.

    EnumeratorValueDescription
    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.

    EnumeratorValueDescription
    EObexNoSuppressedAuthElements0x00
    EObexSuppressChallengeOptionsAuthElement0x01
    EObexSuppressRealmAuthElement0x02
    EObexSuppressAllAuthElementsEObexSuppressChallengeOptionsAuthElement | EObexSuppressRealmAuthElement

    Enum TOperation

    The Obex operation currently being performed.

    EnumeratorValueDescription
    EOpConnect0x00
    EOpDisconnect0x01

    Connect

    EOpPut0x02

    Disconnect

    EOpGet0x03

    Put

    EOpSetPath0x05

    Get

    EOpAbort0xFF

    SetPath

    EOpAbortNoFBit0x7F

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

    EOpGetResponse0xFD

    Abort (internal, never transmitted)

    EOpIdle0xFE

    Internal - not actually an obex operation.

    Constructor & Destructor Documentation

    CObex ( )

    CObex()[protected]

    Constructor - set initial values and copy in protocol policy information

    ~CObex ( )

    ~CObex()[virtual]

    Destructor.

    Member Function Documentation

    CancelObexConnection ( )

    voidCancelObexConnection()[protected]

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

    ConnectState ( )

    IMPORT_C TConnectStateConnectState()const [protected]

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

    ConstructL ( TObexTransportInfo & )

    voidConstructL(TObexTransportInfo &aObexTransportInfo)[protected, virtual]

    ControlledTransportDown ( )

    voidControlledTransportDown()[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

    See also: ForcedTransportDown()

    Error ( TInt )

    voidError(TIntaError)[virtual]

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

    Calling this function has undefined behaviour.

    ForcedTransportDown ( )

    voidForcedTransportDown()[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

    See also: ControlledTransportDown()

    GenerateChallenge ( CObexPacket & )

    TInt GenerateChallenge(CObexPacket &aPacket)[protected]

    GetConnectState ( )

    TConnectState GetConnectState()const

    Get the current state of the authentication state machine

    IsAuthenticating ( )

    IMPORT_C TBoolIsAuthenticating()const

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

    Returns: ETrue if the Server / Client is currently authenticating the OBEX connection otherwise EFalse.

    IsConnected ( )

    IMPORT_C TBoolIsConnected()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).

    Returns: ETrue if this CObex is connected at an OBEX level. EFalse otherwise.

    IsStrictPeer ( )

    IMPORT_C TBoolIsStrictPeer()const

    Returns: ETrue if the "who" header specified in the server s connect response matched that of the client s connect request, and both had a length greater than 0 (i.e. both specified a "who" field). Undefined if IsConnected() == EFalse.

    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.

    Returns: The connect info which will be sent to the OBEX peer.

    NotifyError ( TInt )

    voidNotifyError(TIntaError)

    NotifyProcess ( CObexPacket & )

    voidNotifyProcess(CObexPacket &aPacket)

    NotifyTransportDown ( TBool )

    voidNotifyTransportDown(TBool)

    NotifyTransportUp ( )

    voidNotifyTransportUp()

    OnError ( TInt )

    voidOnError(TIntaError)[protected, pure virtual]

    OnPacketReceive ( CObexPacket & )

    voidOnPacketReceive(CObexPacket &aPacket)[protected, pure virtual]

    OnTransportDown ( )

    voidOnTransportDown()[protected, pure virtual]

    OnTransportUp ( )

    voidOnTransportUp()[protected, pure virtual]

    ParseConnectPacket ( CObexPacket & )

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

    PrepareChallResponseL ( const TDesC & )

    voidPrepareChallResponseL(const TDesC &aPassword)[protected]

    ParameterDescription
    aPasswordPassword to use in challenge response

    Process ( CObexPacket & )

    voidProcess(CObexPacket &aPacket)[virtual]

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

    Calling this function has undefined behaviour.

    ProcessChallResponseL ( const TObexInternalHeader & )

    voidProcessChallResponseL(const TObexInternalHeader &hdr)[protected]

    ProcessChallengeL ( const TObexInternalHeader & )

    voidProcessChallengeL(const TObexInternalHeader &hdr)[protected]

    RemoteAddr ( TSockAddr & )

    IMPORT_C voidRemoteAddr(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.

    ParameterDescription
    anAddrSocket 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

    See also: IsConnected () == EFalse.

    Returns: The connect info from the remote machine.

    RemoteInfoCleanup ( )

    voidRemoteInfoCleanup()[protected]

    General cleanup of iRemoteInfo

    SetCallBack ( MObexAuthChallengeHandler & )

    IMPORT_C voidSetCallBack(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.

    ParameterDescription
    aCallBackAuthentication challenge handler

    SetConnectState ( TConnectState )

    voidSetConnectState(TConnectStateaNewState)[protected]

    Change the state of the authentication state machine

    ParameterDescription
    aNewStateNew state

    SetLocalWho ( const TDesC8 & )

    IMPORT_C TIntSetLocalWho(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.

    ParameterDescription
    aInfoWho field

    Returns: KErrNone or KErrArgument if aInfo is empty

    SuppressAuthenticationHeaderElements ( TObexSuppressedAuthElements )

    IMPORT_C voidSuppressAuthenticationHeaderElements(TObexSuppressedAuthElementsaSuppressedObexAuthElements)
    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
    ParameterDescription
    aSuppressedObexAuthElementsenum TObexSuppressedAuthElements to indicate which header elements to surpress (if any)

    TransportDown ( TBool )

    voidTransportDown(TBoolaForceTransportDeletion)[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

    See also: ControlledTransportDown() ForcedTransportDown()

    TransportUp ( )

    voidTransportUp()[virtual]

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

    Calling this function has undefined behaviour.

    UserPasswordL ( const TDesC & )

    voidUserPasswordL(const TDesC &aPassword)[pure virtual]