»
Symbian OS v9.3 »
Symbian OS reference »
C++ component reference »
OBEX OBEX »
CObexServer
Location:
obexserver.h
Link against: obex.lib
class CObexServer : public CObex;
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.
Derivation
MObexNotify
- No description.
CBase
- Base class for all classes to be instantiated on the heap
CObex
- This class is the common base class for
CObexClient and
CObexServer
CObexServer
- OBEX server
Members
Defined in CObexServer
:
ConstructL()
, CurrentOperation()
, EAlways
, EIfPresent
, ENoChecking
, IsStarted()
, NewL()
, NewL()
, NewL()
, OnError()
, OnPacketReceive()
, OnTransportDown()
, OnTransportUp()
, ParseConnectPacket()
, RequestCompleteIndicationCallback()
, RequestCompleteIndicationCallback()
, RequestIndicationCallback()
, RequestIndicationCallbackWithError()
, RequestIndicationCallbackWithError()
, ResetChallenge()
, SetChallengeL()
, SetPutFinalResponseHeaders()
, SetTargetChecking()
, Start()
, Start()
, Stop()
, TTargetChecking
, TransportInfo()
, UserPasswordL()
, ~CObexServer()
Inherited from CBase
:
Delete()
,
Extension_()
,
operator new()
Inherited from CObex
:
ConnectState()
,
EChallConnChallIssued
,
EChallConnRequested
,
EConnChallRxed
,
EConnIdle
,
EConnObex
,
EConnTransport
,
EDropLink
,
EFinalChallRxed
,
EFinalResponseReceived
,
EObexNoSuppressedAuthElements
,
EObexSuppressAllAuthElements
,
EObexSuppressChallengeOptionsAuthElement
,
EObexSuppressRealmAuthElement
,
EOpAbort
,
EOpAbortNoFBit
,
EOpConnect
,
EOpDisconnect
,
EOpGet
,
EOpGetResponse
,
EOpIdle
,
EOpPut
,
EOpSetPath
,
ESimpleConnChallIssued
,
ESimpleConnRequest
,
EWaitForFinalResponse
,
EWaitForUserInput
,
IsAuthenticating()
,
IsConnected()
,
IsStrictPeer()
,
LocalInfo()
,
RemoteAddr()
,
RemoteInfo()
,
SetCallBack()
,
SetLocalWho()
,
SuppressAuthenticationHeaderElements()
,
TConnectState
,
TObexSuppressedAuthElements
,
TOperation
,
TSetPathInfo
,
iAuthEngine
,
iCallBack
,
iChallPassword
,
iChallenge
,
iConnectState
,
iCurrentOperation
,
iIncomingChallResp
,
iIncomingNonce
,
iIncomingRequestDigest
,
iLocalInfo
,
iNotifyHandler
,
iOutgoingChallResp
,
iOutgoingNonce
,
iRemoteInfo
,
iRemoteRealm
,
iRemoteUID
,
iReserved
,
iRespPassword
,
iRxChallenge
,
iSuppressedObexAuthElements
,
iTransportController
,
iUserIDRequested
Construction and destruction
static IMPORT_C CObexServer *NewL(TObexProtocolInfo &aObexProtocolInfoPtr);
Description
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.
Parameters
TObexProtocolInfo &aObexProtocolInfoPtr |
Protocol information object describing the transport to use
|
|
Return value
static IMPORT_C CObexServer *NewL(TObexProtocolInfo &aObexProtocolInfoPtr, TObexProtocolPolicy &aObexProtocolPolicy);
Description
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.
Parameters
TObexProtocolInfo &aObexProtocolInfoPtr |
Protocol information object describing the transport to use
|
TObexProtocolPolicy &aObexProtocolPolicy |
Protocol policy object specifying the packet sizes to use
|
|
Return value
Capability: |
WriteDeviceData |
If the |
static IMPORT_C CObexServer *NewL(TObexTransportInfo &aObexTransportInfo);
Description
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.
Parameters
TObexTransportInfo &aObexTransportInfo |
Transport information object describing the transport and packet sizes to use
|
|
Return value
IMPORT_C ~CObexServer();
Description
Destructor.
private: virtual void ConstructL(TObexTransportInfo &aObexTransportInfo);
Description
Parameters
IMPORT_C TInt Start(MObexServerNotify *aOwner);
Description
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.
Parameters
Return value
TInt
|
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
|
|
Panic codes
OBEX |
EChangeInterfaceDuringWait when attempting to change the interface at an inappropriate time.
|
|
IMPORT_C TInt Start(MObexServerNotifyAsync *aOwner);
Description
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.
Parameters
Return value
TInt
|
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
|
|
Panic codes
OBEX |
EChangeInterfaceDuringWait when attempting to change the interface at an inappropriate time.
|
|
IMPORT_C void Stop();
Description
Disconnects any transfer in progress and disables further connections.
IMPORT_C TBool IsStarted();
Description
Tests if the server is started, and is available to accept connections.
Return value
TBool
|
ETrue if the server is started, EFalse otherwise
|
|
IMPORT_C TOperation CurrentOperation() const;
Description
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.
Return value
TOperation
|
Operation currently being performed by the remote client
|
|
IMPORT_C void SetChallengeL(const TDesC &aPassword);
Description
Sets a password required to access the server.
When a password is set, a client must specify it to access the server.
Parameters
const TDesC &aPassword |
Password
|
|
IMPORT_C void ResetChallenge();
Description
Resets the password.
After this call, a client does not need to provide a password to access the server.
virtual IMPORT_C void UserPasswordL(const TDesC &aPassword);
Description
A call back from the the service with the password required for use with generating the challenge response.
Parameters
const TDesC &aPassword |
Password
|
|
Leave codes
KErrNotReady |
if this function is not called from a MObexAuthChallengeHandler::GetUserPasswordL callback.
|
|
IMPORT_C void SetTargetChecking(TTargetChecking aChecking);
Description
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.
Parameters
SetPutFinalResponseHeaders()
IMPORT_C TInt SetPutFinalResponseHeaders(CObexHeaderSet *aHeaderSet);
Description
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.
Parameters
CObexHeaderSet *aHeaderSet |
A set of headers to be encoded in the final Put response packet. Ownership of the header set always passes to CObexServer.
|
|
Return value
TInt
|
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.
|
|
RequestIndicationCallback()
IMPORT_C TInt RequestIndicationCallback(CObexBaseObject *aObject);
Description
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.
Parameters
Return value
TInt
|
result of state changes
|
|
Panic codes
Obex |
ENoNotificationToComplete Raised if the server does not have a request outstanding.
|
|
RequestIndicationCallbackWithError()
IMPORT_C TInt RequestIndicationCallbackWithError(TObexResponse aResponseCode);
Description
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.
Parameters
Return value
TInt
|
result of state changes
|
|
Panic codes
Obex |
ENoNotificationToComplete Raised if the server does not have a request outstanding.
|
Obex |
EInvalidResponseCodeFromServerApp raised if TObexResponse aResponseCode is outside range [1,255] or it is one of the successful
response (e.g. ERespSuccess, ERespContinue)
|
|
RequestIndicationCallbackWithError()
IMPORT_C TInt RequestIndicationCallbackWithError(TInt aErrorCode);
Description
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.
Parameters
TInt aErrorCode |
Application's response to the indication as an Obex response Code.
|
|
Return value
TInt
|
result of state changes
|
|
Panic codes
Obex |
ENoNotificationToComplete Raised if the server does not have a request outstanding.
|
Obex |
EInvalidResponseCodeFromServerApp raised if TObexResponse aResponseCode non-negtive. Note: KErrNone is not acceptable because
this function is only used when there is an error.
|
|
RequestCompleteIndicationCallback()
IMPORT_C TInt RequestCompleteIndicationCallback(TObexResponse aResponseCode);
Description
Complete an asynchronous callback, supplying a obex response code. This function is used for asychronously handling PutComplete,
GetComplete and SetPath Indication.
Parameters
Return value
TInt
|
result of state changes
|
|
Panic codes
Obex |
ENoNotificationToComplete Raised if the server does not have a request outstanding.
|
Obex |
EInvalidResponseCodeFromServerApp raised if TObexResponse aResponseCode is outside range [1,255] or it is ERespContinue (which
would confuse the client)
|
|
RequestCompleteIndicationCallback()
IMPORT_C TInt RequestCompleteIndicationCallback(TInt aErrorCode);
Description
Complete an asynchronous callback, supplying a obex response code. This function is used for asychronously handling PutComplete,
GetComplete and SetPath Indication.
Parameters
Return value
TInt
|
result of state changes
|
|
Panic codes
Obex |
ENoNotificationToComplete Raised if the server does not have a request outstanding.
|
Obex |
EInvalidResponseCodeFromServerApp raised if aErrorCode is positive, i.e. invalid Symbian error code
|
|
IMPORT_C const TObexTransportInfo *TransportInfo() const;
Description
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.
Return value
private: virtual void OnPacketReceive(CObexPacket &aPacket);
Description
Parameters
private: virtual void OnError(TInt aError);
Description
Parameters
private: virtual void OnTransportUp();
Description
private: virtual void OnTransportDown();
Description
Tell the MObexServerNotifyAsync
observer the transport is down and listen for another connection.
virtual TInt ParseConnectPacket(CObexPacket &aPacket);
Description
Parameters
Return value
TTargetChecking
Description
The target header checking to apply to incoming connection requests. Defaults to EIfPresent.
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.
|
|