CObexServer Class Reference
class CObexServer : public CObex
|
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.
Constructor & Destructor Documentation
CObexServer()
CObexServer
|
(
|
)
|
[private]
|
Constructor - set initial values
Member Functions Documentation
AcceptConnection()
TInt
|
AcceptConnection
|
(
|
)
|
[private]
|
AddConnectionIDHeader(CObexPacket &)
CheckObjectForConnectionId(CObexBaseObject &)
Check, if required, the object connection ID.
CheckPacketForConnectionId(CObexPacket &)
Check, if required, that the packet connection ID matches that of the Server's current connection
CheckServerAppResponseCode(TObexOpcode, TObexResponse)
void
|
CheckServerAppResponseCode
|
(
|
TObexOpcode
|
aOpcode,
|
|
TObexResponse
|
aResponse
|
|
)
|
[private]
|
This function is to ensure that a response a server application provides the Obex Server to respond to the Obex Client with when it has overriden the default handling of a request packet does not represent a success.
The rationale for this is to attempt to keep the Obex peers synchronised. As the packet has been dropped, the client should not be lead to believe it has been received successfully.
Therefore, this function asserts that the application does not send a success response for the request packet received.
CheckTarget(TConnectState &, TInt &)
ConstructL(TObexTransportInfo &)
CurrentOperation()
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.
DoPacketHeaders(CObexHeaderSet *&, MObexHeaderCheck *)
Contains the functionality for the PacketHeader interface functions in a refactored way.
Parameters
CObexHeaderSet
*& aHeaderSet
|
A 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.
|
MObexHeaderCheck
* aHeaderCheck
|
A pointer 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"). If the pointer is NULL then that is taken to mean that all headers should be added to the aHeaderSet.
|
ExtensionInterfaceL(TUid)
IMPORT_C
TAny
*
|
ExtensionInterfaceL
|
(
|
TUid
|
aUid
|
)
|
|
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.
Parameters
TUid
aUid
|
The UID of the interface that is required.
|
IsStarted()
IMPORT_C
TBool
|
IsStarted
|
(
|
)
|
|
Tests if the server is started, and is available to accept connections.
NewL(TObexProtocolInfo &)
Parameters
TObexProtocolInfo
& aObexProtocolInfoPtr
|
Protocol information object describing the transport to use
|
NewL(TObexProtocolInfo &, TObexProtocolPolicy &)
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
|
NewL(TObexTransportInfo &)
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.
Parameters
TObexTransportInfo
& aObexTransportInfo
|
Transport information object describing the transport and packet sizes to use
|
OnError(TInt)
void
|
OnError
|
(
|
TInt
|
aError
|
)
|
[private, virtual]
|
OnPacketReceive(CObexPacket &)
void
|
OnPacketReceive
|
(
|
CObexPacket
&
|
aPacket
|
)
|
[private, virtual]
|
OnTransportDown()
void
|
OnTransportDown
|
(
|
)
|
[private, virtual]
|
OnTransportUp()
void
|
OnTransportUp
|
(
|
)
|
[private, virtual]
|
PacketHeaders(CObexHeaderSet *&)
Provides the pre-parsed contents of the most recently received request packet.
Parameters
CObexHeaderSet
*& aHeaderSet
|
A 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.
|
PacketHeaders(CObexHeaderSet *&, MObexHeaderCheck &)
Provides the selectively pre-parsed contents of the most recently received request packet.
Parameters
CObexHeaderSet
*& aHeaderSet
|
A 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.
|
MObexHeaderCheck
& aHeaderCheck
|
A 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").
|
ParseConnectPacket(CObexPacket &)
PrepareConnectPacket(CObexPacket &)
Prepare next packet for the connection attempt ConnectionID and Who headers are Mandatory if the Target header was used in the connection from
PrepareErroredConnectPacket(CObexPacket &)
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.
PrepareFinalChallResponse(CObexPacket &, TConnectState &)
RequestCompleteIndicationCallback(TObexResponse)
IMPORT_C
TInt
|
RequestCompleteIndicationCallback
|
(
|
TObexResponse
|
aResponseCode
|
)
|
|
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)
Parameters
TObexResponse
aResponseCode
|
|
RequestCompleteIndicationCallback(TInt)
IMPORT_C
TInt
|
RequestCompleteIndicationCallback
|
(
|
TInt
|
aErrorCode
|
)
|
|
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
RequestIndicationCallback(CObexBaseObject *)
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.
RequestIndicationCallbackWithError(TObexResponse)
IMPORT_C
TInt
|
RequestIndicationCallbackWithError
|
(
|
TObexResponse
|
aResponseCode
|
)
|
|
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)
Parameters
TObexResponse
aResponseCode
|
|
RequestIndicationCallbackWithError(TInt)
IMPORT_C
TInt
|
RequestIndicationCallbackWithError
|
(
|
TInt
|
aErrorCode
|
)
|
|
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.
Parameters
TInt
aErrorCode
|
Application's response to the indication as an Obex response Code.
|
ResetChallenge()
IMPORT_C void
|
ResetChallenge
|
(
|
)
|
|
Resets the password.
After this call, a client does not need to provide a password to access the server.
ResetConnectionID()
void
|
ResetConnectionID
|
(
|
)
|
[private]
|
SetChallengeL(const TDesC &)
IMPORT_C void
|
SetChallengeL
|
(
|
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.
Parameters
const
TDesC
& aPassword
|
Password
|
SetConnectionID(TUint32)
void
|
SetConnectionID
|
(
|
TUint32
|
aConnectionID
|
)
|
[private]
|
SetCurrentOperation(const TOperation)
void
|
SetCurrentOperation
|
(
|
const
TOperation
|
aOperation
|
)
|
|
Setter function to allow other classes in the DLL to set the Server's current operation. Used by the Server state machine.
CObexServerStateMachine
Parameters
const
TOperation
aOperation
|
The operation currently being performed by the remote client
|
SetPutFinalResponseHeaders(CObexHeaderSet *)
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.
|
SetReadActivityObserver(MObexReadActivityObserver *)
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.
SetTargetChecking(TTargetChecking)
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.
SignalPacketProcessEvent(TInt)
void
|
SignalPacketProcessEvent
|
(
|
TInt
|
aEvent
|
)
|
|
Signals an event has ocurred.
Parameters
TInt
aEvent
|
The event that has occurred. (TObexPacketProcessEvent)
|
SignalReadActivity()
void
|
SignalReadActivity
|
(
|
)
|
|
Start(MObexServerNotify *)
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.
Start(MObexServerNotifyAsync *)
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.
Stop()
Disconnects any transfer in progress and disables further connections.
TransportInfo()
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.
UserPasswordL(const TDesC &)
IMPORT_C void
|
UserPasswordL
|
(
|
const
TDesC
&
|
aPassword
|
)
|
[virtual]
|
A call back from the the service with the password required for use with generating the challenge response.
Parameters
const
TDesC
& aPassword
|
Password
|
Member Enumerations Documentation
Enum TTargetChecking
Enumerators
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.
|
Member Data Documentation
TBool
iConnectionIdSet
TBool
|
iConnectionIdSet
|
[private]
|
MObexServerNotifyAsync * iOwner
CObexPacketSignaller * iPacketProcessSignaller
CObexPacketSignaller *
|
iPacketProcessSignaller
|
[private]
|
CObexServerRequestPacketEngine * iServerRequestPacketEngine
CObexServerRequestPacketEngine *
|
iServerRequestPacketEngine
|
[private]
|
TBool
iSpecDone
TBool
|
iSpecDone
|
[private]
|
CObexServerStateMachine * iStateMachine
CObexServerStateMachine *
|
iStateMachine
|
[private]
|
CObexServerNotifySyncWrapper * iSyncWrapper
CObexServerNotifySyncWrapper *
|
iSyncWrapper
|
[private]
|
TTargetChecking
iTargetChecking
TBool
iTargetReceived
TBool
|
iTargetReceived
|
[private]
|
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.