CObexServer Class Reference

#include <mw/obexserver.h>

Link against: obex.lib

class CObexServer : public CObex

Inherits from

Public Member Enumerations
enumTTargetChecking { ENoChecking, EIfPresent, EAlways }
Public Member Functions
~CObexServer()
TBool CheckObjectForConnectionId(CObexBaseObject &)
TBool CheckPacketForConnectionId(CObexPacket &)
IMPORT_C TOperationCurrentOperation()
IMPORT_C TAny *ExtensionInterfaceL(TUid)
IMPORT_C TBoolIsStarted()
IMPORT_C CObexServer *NewL(TObexProtocolInfo &)
IMPORT_C CObexServer *NewL(TObexProtocolInfo &, TObexProtocolPolicy &)
IMPORT_C CObexServer *NewL(TObexTransportInfo &)
IMPORT_C TIntPacketHeaders(CObexHeaderSet *&)
IMPORT_C TIntPacketHeaders(CObexHeaderSet *&, MObexHeaderCheck &)
virtual TInt ParseConnectPacket(CObexPacket &)
TInt PrepareConnectPacket(CObexPacket &)
TInt PrepareErroredConnectPacket(CObexPacket &)
IMPORT_C TIntRequestCompleteIndicationCallback(TObexResponse)
IMPORT_C TIntRequestCompleteIndicationCallback(TInt)
IMPORT_C TIntRequestIndicationCallback(CObexBaseObject *)
IMPORT_C TIntRequestIndicationCallbackWithError(TObexResponse)
IMPORT_C TIntRequestIndicationCallbackWithError(TInt)
IMPORT_C voidResetChallenge()
IMPORT_C voidSetChallengeL(const TDesC &)
voidSetCurrentOperation(const TOperation)
IMPORT_C TIntSetPutFinalResponseHeaders(CObexHeaderSet *)
IMPORT_C voidSetReadActivityObserver(MObexReadActivityObserver *)
IMPORT_C voidSetTargetChecking(TTargetChecking)
voidSignalPacketProcessEvent(TInt)
voidSignalReadActivity()
IMPORT_C TIntStart(MObexServerNotify *)
IMPORT_C TIntStart(MObexServerNotifyAsync *)
IMPORT_C voidStop()
IMPORT_C const TObexTransportInfo *TransportInfo()
virtual IMPORT_C voidUserPasswordL(const TDesC &)
Inherited Attributes
CObex::iAuthEngine
CObex::iCallBack
CObex::iChallPassword
CObex::iChallenge
CObex::iConnectState
CObex::iCurrentOperation
CObex::iIncomingChallResp
CObex::iIncomingNonce
CObex::iIncomingRequestDigest
CObex::iLocalInfo
CObex::iNotifyHandler
CObex::iOutgoingChallResp
CObex::iOutgoingNonce
CObex::iRemoteInfo
CObex::iRemoteRealm
CObex::iRemoteUID
CObex::iReserved
CObex::iRespPassword
CObex::iRxChallenge
CObex::iSuppressedObexAuthElements
CObex::iTransportController
CObex::iUserIDRequested
Inherited Enumerations
CObex:TConnectState
CObex:TObexSuppressedAuthElements
CObex:TOperation
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()
CObex::CObex()
CObex::CancelObexConnection()
CObex::ConnectState()const
CObex::ControlledTransportDown()
CObex::Error(TInt)
CObex::ForcedTransportDown()
CObex::GenerateChallenge(CObexPacket &)
CObex::GetConnectState()const
CObex::IsAuthenticating()const
CObex::IsConnected()const
CObex::IsStrictPeer()const
CObex::LocalInfo()const
CObex::NotifyError(TInt)
CObex::NotifyProcess(CObexPacket &)
CObex::NotifyTransportDown(TBool)
CObex::NotifyTransportUp()
CObex::PrepareChallResponseL(const TDesC &)
CObex::Process(CObexPacket &)
CObex::ProcessChallResponseL(const TObexInternalHeader &)
CObex::ProcessChallengeL(const TObexInternalHeader &)
CObex::RemoteAddr(TSockAddr &)
CObex::RemoteInfo()const
CObex::RemoteInfoCleanup()
CObex::SetCallBack(MObexAuthChallengeHandler &)
CObex::SetConnectState(TConnectState)
CObex::SetLocalWho(const TDesC8 &)
CObex::SuppressAuthenticationHeaderElements(TObexSuppressedAuthElements)
CObex::TransportDown(TBool)
CObex::TransportUp()
CObex::~CObex()

Detailed Description

OBEX server.

CObexServer provides a framework for servicing OBEX requests from remote clients. It is designed to be able to act as either a "default" application (in IrDA terms, registering on the IrDA:OBEX IAS class), or as a application specific server (registering itself on a private IAS class).

You implement service-specific behaviour by providing a MObexServerNotify interface implementation to the server object. The server calls the interface's functions to provide notification of server events, which specific implementations can process (or ignore) as appropriate.

This class is not designed for user derivation.

Member Enumeration Documentation

Enum TTargetChecking

The target header checking to apply to incoming connection requests. Defaults to EIfPresent.

See also: CObexServer::SetTargetChecking

EnumeratorValueDescription
ENoChecking
EIfPresent

Allow all target headers to connect.

EAlways

Only check target header in response to receiving one. Allows all clients specifying an Inbox service to connect.

Constructor & Destructor Documentation

~CObexServer ( )

~CObexServer()

Destructor.

Member Function Documentation

CheckObjectForConnectionId ( CObexBaseObject & )

TBool CheckObjectForConnectionId(CObexBaseObject &aObject)

Check, if required, the object connection ID.

Returns: ETrue if it was not necessary to receive the ConnectionID or if it was necessary and was correctly received. Otherwise EFalse.

CheckPacketForConnectionId ( CObexPacket & )

TBool CheckPacketForConnectionId(CObexPacket &aObject)

Check, if required, that the packet connection ID matches that of the Server's current connection

Returns: ETrue if the connection ID matches or if Target was not used in the original connection EFalse if Target was not used in the original connection and the connection ID was not found

CurrentOperation ( )

IMPORT_C TOperationCurrentOperation()const

Returns the operation currently being performed by the remote client, or EOpIdle if between operations. Note that there is no implication of whether the server is currently connected; EOpIdle will be returned regardless of connection state, if no operation is currently being performed. Use CObex::IsConnected () to find connection staus.

Returns: Operation currently being performed by the remote client

ExtensionInterfaceL ( TUid )

IMPORT_C TAny *ExtensionInterfaceL(TUidaUid)

Provides additional interfaces for CObexServer.

leave
KErrNotSupported if the given UID does not represent an interface CObexServer can provide.
leave
KErrInUse if an instance of MObexServerRequestPacketNotifyRegister has already been provided by an earlier call to ExtensionInterfaceL, and it has not been released.
ParameterDescription
aUidThe UID of the interface that is required.

Returns: A pointer to an instance implementing the interface represented by aUid.

IsStarted ( )

IMPORT_C TBoolIsStarted()

Tests if the server is started, and is available to accept connections.

Returns: ETrue if the server is started, EFalse otherwise

NewL ( TObexProtocolInfo & )

IMPORT_C CObexServer *NewL(TObexProtocolInfo &aObexProtocolInfoPtr)[static]

Allocates and constructs a new OBEX server object.

The received protocol information object, aObexProtocolInfoPtr, specifies the transport protocol to use: For the standard transports the following are used, TObexIrProtocolInfo for IrDA, TObexBluetoothProtocolInfo for Bluetooth, TObexUsbProtocolInfo for USB.

ParameterDescription
aObexProtocolInfoPtrProtocol information object describing the transport to use

Returns: New OBEX server object

NewL ( TObexProtocolInfo &, TObexProtocolPolicy & )

IMPORT_C CObexServer *NewL(TObexProtocolInfo &aObexProtocolInfoPtr,
TObexProtocolPolicy &aObexProtocolPolicy
)[static]

Allocates and constructs a new OBEX server object with packet sizing information.

The received protocol information object, aObexProtocolInfoPtr, specifies the transport protocol to use: For the standard transports the following are used, TObexIrProtocolInfo for IrDA, TObexBluetoothProtocolInfo for Bluetooth, TObexUsbProtocolInfo for USB.

The aObexProtocolPolicy parameter specifies the packet sizing policy for this OBEX object.

ParameterDescription
aObexProtocolInfoPtrProtocol information object describing the transport to use
aObexProtocolPolicyProtocol policy object specifying the packet sizes to use

Returns: New OBEX server object

NewL ( TObexTransportInfo & )

IMPORT_C CObexServer *NewL(TObexTransportInfo &aObexTransportInfo)[static]

Allocates and constructs a new OBEX server object with packet sizing information.

The received transport information object, aObexTransportInfo, specifies the transport protocol and packet sizes to use: For the standard transports the following are used, TObexIrProtocolInfo for IrDA, TObexBluetoothProtocolInfo for Bluetooth, TObexUsbProtocolInfo for USB.

capability
WriteDeviceData If the TObexIrV3TransportInfo is passed as the argument and the associated name is valid.
ParameterDescription
aObexTransportInfoTransport information object describing the transport and packet sizes to use

Returns: New OBEX server object

PacketHeaders ( CObexHeaderSet *& )

IMPORT_C TIntPacketHeaders(CObexHeaderSet *&aHeaderSet)

Provides the pre-parsed contents of the most recently received request packet.

ParameterDescription
aHeaderSetA reference to a pointer that will be modified to NULL if no headers are contained in the request packet, or to point to a new headerset containing representations of the headers within the packet. Ownership of the headerset (when aHeaderSet is not NULL) is passed to the caller.

Returns: KErrNone if successful, otherwise a system wide error code.

PacketHeaders ( CObexHeaderSet *&, MObexHeaderCheck & )

IMPORT_C TIntPacketHeaders(CObexHeaderSet *&aHeaderSet,
MObexHeaderCheck &aHeaderCheck
)

Provides the selectively pre-parsed contents of the most recently received request packet.

ParameterDescription
aHeaderSetA reference to a pointer that will be modified to NULL if no interesting header are contained in the request packet, or to point to a new headerset containing representations of the headers within the packet that are of interest. Ownership of the headerset (when aHeaderSet is not NULL) is passed to the caller.
aHeaderCheckA reference to an MObexHeaderCheck derived class that encapsulates whether or not a particular header or headers should be included in the returned header set (i.e. whether the headers are "interesting").

Returns: KErrNone if successful, otherwise a system wide error code.

ParseConnectPacket ( CObexPacket & )

TInt ParseConnectPacket(CObexPacket &aPacket)[virtual]

PrepareConnectPacket ( CObexPacket & )

TInt PrepareConnectPacket(CObexPacket &aPacket)

Prepare next packet for the connection attempt ConnectionID and Who headers are Mandatory if the Target header was used in the connection from

ParameterDescription
aPacketPacket to fill

PrepareErroredConnectPacket ( CObexPacket & )

TInt PrepareErroredConnectPacket(CObexPacket &aPacket)

Prepare next packet for an invalid connection attempt (i.e. the ParseConnectPacket failed). A fail response (to a connect request) includes the version, flags, and packet size information.

ParameterDescription
aPacketPacket to fill

RequestCompleteIndicationCallback ( TObexResponse )

IMPORT_C TIntRequestCompleteIndicationCallback(TObexResponseaResponseCode)

Complete an asynchronous callback, supplying a obex response code. This function is used for asychronously handling PutComplete, GetComplete and SetPath Indication.

panic
Obex ENoNotificationToComplete Raised if the server does not have a request outstanding.
panic
Obex EInvalidResponseCodeFromServerApp raised if TObexResponse aResponseCode is outside range [1,255] or it is ERespContinue (which would confuse the client)

Returns: result of state changes

RequestCompleteIndicationCallback ( TInt )

IMPORT_C TIntRequestCompleteIndicationCallback(TIntaErrorCode)

Complete an asynchronous callback, supplying a obex response code. This function is used for asychronously handling PutComplete, GetComplete and SetPath Indication.

panic
Obex ENoNotificationToComplete Raised if the server does not have a request outstanding.
panic
Obex EInvalidResponseCodeFromServerApp raised if aErrorCode is positive, i.e. invalid Symbian error code

Returns: result of state changes

RequestIndicationCallback ( CObexBaseObject * )

IMPORT_C TIntRequestIndicationCallback(CObexBaseObject *aObject)

Complete an asynchronous callback, supplying a CObexBaseObject derived object. Passing in NULL results in an Obex level error being sent to the client -- the semantics are that either a PUT request has been rejected or a GET request has not found a suitable object to return.

panic
Obex ENoNotificationToComplete Raised if the server does not have a request outstanding.
ParameterDescription
aObjectThe object passed back from application

Returns: result of state changes

RequestIndicationCallbackWithError ( TObexResponse )

IMPORT_C TIntRequestIndicationCallbackWithError(TObexResponseaResponseCode)

Complete an asynchronous callback, supplying a obex response code. Applications should use this function when rejecting Get/Put RequestIndication in order to specify the response code.

panic
Obex ENoNotificationToComplete Raised if the server does not have a request outstanding.
panic
Obex EInvalidResponseCodeFromServerApp raised if TObexResponse aResponseCode is outside range [1,255] or it is one of the successful response (e.g. ERespSuccess, ERespContinue)

Returns: result of state changes

RequestIndicationCallbackWithError ( TInt )

IMPORT_C TIntRequestIndicationCallbackWithError(TIntaErrorCode)

Complete an asynchronous callback, supplying a obex response code. Applications should use this function when rejecting Get/Put RequestIndication in order to specify the error code.

panic
Obex ENoNotificationToComplete Raised if the server does not have a request outstanding.
panic
Obex EInvalidResponseCodeFromServerApp raised if TObexResponse aResponseCode non-negtive. Note: KErrNone is not acceptable because this function is only used when there is an error.
ParameterDescription
aErrorCodeApplication's response to the indication as an Obex response Code.

Returns: result of state changes

ResetChallenge ( )

IMPORT_C voidResetChallenge()

Resets the password.

After this call, a client does not need to provide a password to access the server.

SetChallengeL ( const TDesC & )

IMPORT_C voidSetChallengeL(const TDesC &aPassword)

Sets a password required to access the server.

When a password is set, a client must specify it to access the server.

ParameterDescription
aPasswordPassword

SetCurrentOperation ( const TOperation )

voidSetCurrentOperation(const TOperationaOperation)

Setter function to allow other classes in the DLL to set the Server's current operation. Used by the Server state machine.

See also: CObexServerStateMachine

ParameterDescription
aOperationThe operation currently being performed by the remote client

SetPutFinalResponseHeaders ( CObexHeaderSet * )

IMPORT_C TIntSetPutFinalResponseHeaders(CObexHeaderSet *aHeaderSet)

Specify the set of headers to return to remote Obex client in final Put response packet. The total length of the headers when encoded should not exceed the maximum Obex packet payload size.

This function may be called at any point during a Put operation. Repeated calls to this replace rather than add to the header set for inclusion in the final Put response packet.

It may be called with a NULL pointer, which means that no headers will be sent with the Put Final Response.

Even if this function returns with an error (even KErrNotReady) a best-effort attempt will be made to send as many headers as will fit in the final Put response packet.

ParameterDescription
aHeaderSetA set of headers to be encoded in the final Put response packet. Ownership of the header set always passes to CObexServer.

Returns: KErrNone if the operation completes successfully. KErrNotReady if the current operation is not a Put. KErrArgument if the length of the headers when encoded exceeds the maximum Obex packet payload size.

SetReadActivityObserver ( MObexReadActivityObserver * )

IMPORT_C voidSetReadActivityObserver(MObexReadActivityObserver *aObserver)

Sets a read activity observer.

This replaces any previous observer. The observer will receive a callback when the first read arrives for a put or get request.

This does not transfer ownership.

ParameterDescription
aObserverThe observer to receive packet process events. This may be NULL.

SetTargetChecking ( TTargetChecking )

IMPORT_C voidSetTargetChecking(TTargetCheckingaChecking)

Specifies target header checking behaviour.

Supports three behaviours---never check, always check, and check only if a target header has been sent. The default behaviour is to only check when a target header has been sent.

No checking allows a form of multiplexing to be used, where one server object may respond to multiple target headers. The behaviour desired by the client can be determined by examining the target header specified in the Connect.

ParameterDescription
aCheckingThe desired level of target header checking.

SignalPacketProcessEvent ( TInt )

voidSignalPacketProcessEvent(TIntaEvent)

Signals an event has ocurred.

ParameterDescription
aEventThe event that has occurred. (TObexPacketProcessEvent)

SignalReadActivity ( )

voidSignalReadActivity()

Start ( MObexServerNotify * )

IMPORT_C TIntStart(MObexServerNotify *aOwner)

Starts the server, specifying a synchronous notification interface.

If the server is already started, no state changes occur (i.e. any connections/operations in progress are not interrupted), but the notifications will be sent to aOwner. This allows "child" servers to take over ownership of existing connections.

Details of this function behaviour depend on the transport specified when constructed: in general a listener socket is created, its port number registered as appropriate, and an accept queued.

panic
OBEX EChangeInterfaceDuringWait when attempting to change the interface at an inappropriate time.
ParameterDescription
aOwnerServer notification interface

Returns: KErrArgument if parameter is NULL, KErrAlreadyExists if server has already been started (but notification object will still be updated), otherwise a system wide error code

Start ( MObexServerNotifyAsync * )

IMPORT_C TIntStart(MObexServerNotifyAsync *aOwner)

Starts the server, specifying an asynchronous notification interface.

If the server is already started, no state changes occur (i.e. any connections/operations in progress are not interrupted), but the notifications will be sent to aOwner. This allows "child" servers to take over ownership of existing connections.

Details of this function behaviour depend on the transport specified when constructed: in general a listener socket is created, its port number registered as appropriate, and an accept queued.

panic
OBEX EChangeInterfaceDuringWait when attempting to change the interface at an inappropriate time.
ParameterDescription
aOwnerServer notification interface

Returns: KErrArgument if parameter is NULL, KErrAlreadyExists if server has already been started (but notification object will still be updated), otherwise a system wide error code

Stop ( )

IMPORT_C voidStop()

Disconnects any transfer in progress and disables further connections.

TransportInfo ( )

IMPORT_C const TObexTransportInfo *TransportInfo()const

Returns a pointer to the TObexTransportInfo being used by the OBEX transport layer. THE USER MUST NOT MODIFY THE OBJECT POINTED TO. This is useful primarily when using OBEX over RFCOMM and the user has specified 'KRfcommPassiveAutoBind' as the port. KRfcommPassiveAutoBind makes RFCOMM itself find a free port. The user needs to know which port is really being used by RFCOMM in order to correctly populate the SDP record. May be called meaningfully after CObexServer::Start has returned KErrNone.

Returns: Pointer to the transport layer's transport info.

UserPasswordL ( const TDesC & )

IMPORT_C voidUserPasswordL(const TDesC &aPassword)[virtual]

A call back from the the service with the password required for use with generating the challenge response.

leave
KErrNotReady if this function is not called from a MObexAuthChallengeHandler::GetUserPasswordL callback.
ParameterDescription
aPasswordPassword