ServerCallback

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function provides the necessary callback to the server from the specified server extension.

Syntax

typedef int (*ServerCallback)(
  unsigned int uiOp,
  unsigned int uiId,
  struct _obex_command * pCommand 
);

Parameters

  • uiOp
    The operation selector (the response that the server extension sends to the service extension). The following response values do not require the server extension to generate a command; all of these values would cause the OBEX server to format and send the given response back to the client.

    Value Description

    OBEX_RESP_ABORT

    The extension process was aborted.

    OBEX_RESP_ACCEPT

    The extension process was accepted.

    OBEX_RESP_CONTINUE

    The extension process can continue.

    OBEX_RESP_DENY

    The extension process was denied.

    OBEX_RESP_OK

    The extension process was successfully complete.

    OBEX_RESP_REJECT

    The extension process was rejected.

    The following response values require the server extension to generate a command to be sent to the service extension.

    Value Description

    OBEX_RESP_DISCONNECT

    Closes the current connection.

    When the service extension receives a disconnection request, the server extension must return this value.

    OBEX_RESP_HANGUP

    Closes the current connection and the physical connection to the client.

    This value should only be used if client authentication fails or if the service extension detects a security attack. Closing the physical connection affects all logical connections on the same physical connection.

    OBEX_RESP_RESPOND

    Generates a custom response; usually used when data is sent.

    This value requires an explicit command to be present in the function call parameters.

  • uiId
    The transaction ID to which the OBEX server is responding.
  • pCommand
    If uiOp is set to OBEX_RESP_ABORT, OBEX_RESP_ACCEPT, OBEX_RESP_CONTINUE, OBEX_RESP_DENY, OBEX_RESP_OK, or OBEX_RESP_REJECT, the value of pCommand is set to NULL.

    If uiOp is set to OBEX_RESP_DISCONNECT, OBEX_RESP_HANGUP, or OBEX_RESP_RESPOND, pCommand will contain an OBEXCOMMAND structure with the following specific values (all other values are the same as in a standard OBEXCOMMAND structure).

    Member Description

    uiOp

    The value of this member must match the value of the original command.

    sPktData

    The value of this member depends on the semantics of the command.

    fFinal

    The value of this member must be TRUE.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    The method completed successfully.

Remarks

After the server extension executes a command, the extension must indicate the result of that command to the OBEX server. Otherwise, the OBEX server will be unable to respond to the client command. Because the OBEX protocol is based on the client-server model, the OBEX server must respond to every client command; the server can only send data in response to a client command.

When the physical connection to a device closes, the server extension notifies the service extension by sending an OBEX_REQ_CLOSE transaction with an empty (NULL) OBEX command body.

Requirements

Header obexserver.h
Library Developer Implemented
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also

Reference

OBEX Functions