ServerCallback (Compact 2013)

3/26/2014

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
    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 Object Exchange (OBEX) Protocol server to format and send the given response back to the client.

    Value

    Description

    OBEX_RESP_ABORT

    Extension process was aborted.

    OBEX_RESP_ACCEPT

    Extension process was accepted.

    OBEX_RESP_CONTINUE

    Extension process can continue.

    OBEX_RESP_DENY

    Extension process was denied.

    OBEX_RESP_OK

    Extension process was successfully completed.

    OBEX_RESP_REJECT

    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

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

    sPktData

    Value of this member depends on the semantics of the command.

    fFinal

    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 is 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

See Also

Reference

OBEX Functions