#include <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. It is an ab...
CObexServer
- OBEX server.
Members
Defined in CObexServer
:
ConstructL(TObexTransportInfo &)
CurrentOperation()const
Returns the operation currently being performed by the remote client, or EOpIdle...
EAlways
Only check target header in response to receiving one. Allows all clients specif...
EIfPresent
Allow all target headers to connect.
ENoChecking
IsStarted()
Tests if the server is started, and is available to accept connections.
NewL(TObexProtocolInfo &)
Allocates and constructs a new OBEX server object.
NewL(TObexProtocolInfo &,TObexProtocolPolicy &)
Allocates and constructs a new OBEX server object with packet sizing information...
NewL(TObexTransportInfo &)
Allocates and constructs a new OBEX server object with packet sizing information...
OnError(TInt)
OnPacketReceive(CObexPacket &)
OnTransportDown()
Tell the MObexServerNotifyAsync observer the transport is down and listen for an...
OnTransportUp()
ParseConnectPacket(CObexPacket &)
RequestCompleteIndicationCallback(TInt)
Complete an asynchronous callback, supplying a obex response code. This function...
RequestCompleteIndicationCallback(TObexResponse)
Complete an asynchronous callback, supplying a obex response code. This function...
RequestIndicationCallback(CObexBaseObject *)
Complete an asynchronous callback, supplying a CObexBaseObject derived object. P...
RequestIndicationCallbackWithError(TInt)
Complete an asynchronous callback, supplying a obex response code. Applications ...
RequestIndicationCallbackWithError(TObexResponse)
Complete an asynchronous callback, supplying a obex response code. Applications ...
ResetChallenge()
Resets the password.
SetChallengeL(const TDesC &)
Sets a password required to access the server.
SetPutFinalResponseHeaders(CObexHeaderSet *)
Specify the set of headers to return to remote Obex client in final Put response...
SetTargetChecking(TTargetChecking)
Specifies target header checking behaviour.
Start(MObexServerNotify *)
Starts the server, specifying a synchronous notification interface.
Start(MObexServerNotifyAsync *)
Starts the server, specifying an asynchronous notification interface.
Stop()
Disconnects any transfer in progress and disables further connections.
TTargetChecking
...
TransportInfo()const
Returns a pointer to the TObexTransportInfo being used by the OBEX transport lay...
UserPasswordL(const TDesC &)
A call back from the the service with the password required for use with generat...
~CObexServer()
Destructor.
Inherited from CBase
:
Inherited from CObex
:
ConnectState()const
This function is in the protected scope of CObex and so is not externally usable...
EChallConnChallIssued
Connect with Auth has been sent by Client/Received by Server
EChallConnRequested
Server, received Simple Connect but Server Challenge issued
EConnChallRxed
Connect without Auth has been sent by ClientReceived by Server
EConnIdle
EConnObex
Transport Link connected not yet established true Link
EConnTransport
Nothing is happening
EDropLink
drop the link
EFinalChallRxed
Server, the final response has been received
EFinalResponseReceived
Client, waiting for final success/fail not chall-response expected Server, Waiti...
EObexNoSuppressedAuthElements
EObexSuppressAllAuthElements
EObexSuppressChallengeOptionsAuthElement
EObexSuppressRealmAuthElement
EOpAbort
SetPath
EOpAbortNoFBit
Abort - must fit in one pkt so final bit is always set
EOpConnect
EOpDisconnect
Connect
EOpGet
Put
EOpGetResponse
Abort (internal, never transmitted)
EOpIdle
Internal - not actually an obex operation.
EOpPut
Disconnect
EOpSetPath
Get
ESimpleConnChallIssued
Server has issued a challenge, to a Client cionnect
ESimpleConnRequest
full connection established
EWaitForFinalResponse
Server has sent a Challenge & Resp to a Client EChallConnRequest
EWaitForUserInput
Server, Client connect with challenge, Server responds with challenge, Client re...
IsAuthenticating()const
Indicates if the Server / Client is currently authenticating the OBEX connection...
IsConnected()const
Returns ETrue if this CObex is connected at an OBEX level, merely having a trans...
IsStrictPeer()const
LocalInfo()const
Use this member to gain access to (and alter, if necessary) the CObex::TConnectI...
RemoteAddr(TSockAddr &)
Get the socket address of the remote device.
RemoteInfo()const
Use this member to read the details of the remote machine’s connection informat...
SetCallBack(MObexAuthChallengeHandler &)
Sets the authentication challenge handler.
SetLocalWho(const TDesC8 &)
Sets the local Who field.
SuppressAuthenticationHeaderElements(TObexSuppressedAuthElements)
Must be called by an application that wishes to suppress the authentication or(n...
TConnectState
Current obex connection state In general, the further through the enum the value...
TObexSuppressedAuthElements
Flags to suppress the authentication elements of the authentication challenge he...
TOperation
The Obex operation currently being performed.
TSetPathInfo
Describes the information set or received in a SETPATH command.
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
NewL(TObexProtocolInfo &)
IMPORT_C static 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
NewL(TObexProtocolInfo &,TObexProtocolPolicy &)
IMPORT_C static 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
NewL(TObexTransportInfo &)
Capability: |
WriteDeviceData |
If the |
IMPORT_C static 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.
ConstructL(TObexTransportInfo &)
private: virtual void ConstructL(TObexTransportInfo &aObexTransportInfo);
Description
Parameters
Start(MObexServerNotify *)
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.
|
|
Start(MObexServerNotifyAsync *)
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()const
() to find connection staus.
Return value
SetChallengeL(const TDesC &)
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
IMPORT_C void ResetChallenge();
Description
Resets the password.
After this call, a client does not need to provide a password to access the server.
UserPasswordL(const TDesC &)
IMPORT_C virtual 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
Leave codes
KErrNotReady |
if this function is not called from a MObexAuthChallengeHandler::GetUserPasswordL callback.
|
|
SetTargetChecking(TTargetChecking)
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(CObexHeaderSet *)
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(CObexBaseObject *)
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(TObexResponse)
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(TInt)
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(TObexResponse)
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(TInt)
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(MObexServerNotify *)
has returned KErrNone.
Return value
OnPacketReceive(CObexPacket &)
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.
ParseConnectPacket(CObexPacket &)
virtual TInt ParseConnectPacket(CObexPacket &aPacket);
Description
Parameters
Return value
TTargetChecking
Description
The target header checking to apply to incoming connection requests. Defaults to EIfPresent.
See also:
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.
|
|