#include <mw/obexserver.h>
class CObexServer : public CObex |
Public Member Enumerations | |
---|---|
enum | TTargetChecking { ENoChecking, EIfPresent, EAlways } |
Inherited Enumerations | |
---|---|
CObex:TConnectState | |
CObex:TObexSuppressedAuthElements | |
CObex:TOperation |
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.
The target header checking to apply to incoming connection requests. Defaults to EIfPresent.
See also: CObexServer::SetTargetChecking
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.
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
IMPORT_C TOperation | CurrentOperation | ( | ) | 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
Provides additional interfaces for CObexServer.
Parameter | Description |
---|---|
aUid | The UID of the interface that is required. |
Returns: A pointer to an instance implementing the interface represented by aUid.
IMPORT_C TBool | IsStarted | ( | ) |
Tests if the server is started, and is available to accept connections.
Returns: ETrue if the server is started, EFalse otherwise
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.
Parameter | Description |
---|---|
aObexProtocolInfoPtr | Protocol information object describing the transport to use |
Returns: New OBEX server object
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.
Parameter | Description |
---|---|
aObexProtocolInfoPtr | Protocol information object describing the transport to use |
aObexProtocolPolicy | Protocol policy object specifying the packet sizes to use |
Returns: New OBEX server object
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.
Parameter | Description |
---|---|
aObexTransportInfo | Transport information object describing the transport and packet sizes to use |
Returns: New OBEX server object
IMPORT_C TInt | PacketHeaders | ( | CObexHeaderSet *& | aHeaderSet | ) |
Provides the pre-parsed contents of the most recently received request packet.
Parameter | Description |
---|---|
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. |
Returns: KErrNone if successful, otherwise a system wide error code.
IMPORT_C TInt | PacketHeaders | ( | CObexHeaderSet *& | aHeaderSet, |
MObexHeaderCheck & | aHeaderCheck | |||
) |
Provides the selectively pre-parsed contents of the most recently received request packet.
Parameter | Description |
---|---|
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. |
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"). |
Returns: KErrNone if successful, otherwise a system wide error code.
TInt | ParseConnectPacket | ( | CObexPacket & | aPacket | ) | [virtual] |
Reimplemented from CObex::ParseConnectPacket(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
Parameter | Description |
---|---|
aPacket | Packet to fill |
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.
Parameter | Description |
---|---|
aPacket | Packet to fill |
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.
Returns: result of state changes
Complete an asynchronous callback, supplying a obex response code. This function is used for asychronously handling PutComplete, GetComplete and SetPath Indication.
Returns: result of state changes
IMPORT_C TInt | RequestIndicationCallback | ( | 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.
Parameter | Description |
---|---|
aObject | The object passed back from application |
Returns: result of state changes
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.
Returns: result of state changes
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.
Parameter | Description |
---|---|
aErrorCode | Application's response to the indication as an Obex response Code. |
Returns: result of state changes
IMPORT_C void | ResetChallenge | ( | ) |
Resets the password.
After this call, a client does not need to provide a password to access the server.
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.
Parameter | Description |
---|---|
aPassword | Password |
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.
See also: CObexServerStateMachine
Parameter | Description |
---|---|
aOperation | The operation currently being performed by the remote client |
IMPORT_C TInt | SetPutFinalResponseHeaders | ( | 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.
Parameter | Description |
---|---|
aHeaderSet | A 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.
IMPORT_C void | SetReadActivityObserver | ( | 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.
Parameter | Description |
---|---|
aObserver | The observer to receive packet process events. This may be NULL. |
IMPORT_C void | SetTargetChecking | ( | TTargetChecking | aChecking | ) |
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.
Parameter | Description |
---|---|
aChecking | The desired level of target header checking. |
void | SignalPacketProcessEvent | ( | TInt | aEvent | ) |
Signals an event has ocurred.
Parameter | Description |
---|---|
aEvent | The event that has occurred. (TObexPacketProcessEvent) |
IMPORT_C TInt | Start | ( | 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.
Parameter | Description |
---|---|
aOwner | Server 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
IMPORT_C TInt | Start | ( | 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.
Parameter | Description |
---|---|
aOwner | Server 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
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.
IMPORT_C void | UserPasswordL | ( | const TDesC & | aPassword | ) | [virtual] |
Reimplemented from CObex::UserPasswordL(const TDesC &)
A call back from the the service with the password required for use with generating the challenge response.
Parameter | Description |
---|---|
aPassword | Password |