# xxxProcessCommand

Called when a command is addressed to a service.

#### Prototype

DWORD xxxProcessCommand (CTAHD ctahd, void *mgrcontext, DISP_COMMAND *ctacmd)

Argument | Description
ctahd | Context handle.
mgrcontext | Pointer to data structure returned by xxxOpenServiceManager.
ctacmd | Pointer to a command structure to process. The DISP_COMMAND structure contains the following fields: typedef struct { DWORD id; /* Command ID (and dest. service ID) */ CTAHD ctahd; /* Natural Accesso context handle */ DWORD size1; /* If dataptr1 !=NULL => size1 is buffer */ /* size - else message specific data */ void *dataptr1; /* Data pointer */ DWORD size2; /* If dataptr2 !=NULL => size2 is buffer */ /* size - else message specific data */ void *dataptr2; /* Data pointer */ DWORD size3; /* If dataptr3 !=NULL => size3 is buffer */ /* size - else message specific data */ void *dataptr3; /* Data pointer */ DWORD reserved; /* Must be zero (0). */ MESSAGE_ADDR addr; /* Source/Destination service ID */ } DISP_COMMAND; typedef struct { WORD source /* source service ID */ WORD destination /* destination service ID */ } MESSAGE_ADDR;

#### Return values

Return value | Description
SUCCESS | There are no out or inout parameters being returned.
SUCCESS_RESPONSE | There are out or inout parameters containing data to be returned to the caller.
Any Natural Access or service-specific error code. |

#### Details

xxxProcessCommand is invoked when a command is sent to a service managed by this service manager. The mgrcontext allocated when the service manager was opened (with xxxOpenServiceManager) and a pointer to the command to process are passed in as arguments.

This function:

- Allocates a table of function pointers to API implementation functions

- Performs a lookup based on an incoming command code within the DISP_COMMAND message buffer

- Performs an upcall to the appropriate function

Commands must not block in xxxProcessCommand. They must return SUCCESS, SUCCESS_RESPONSE, or an error code to the dispatcher.

The dispatcher returns either SUCCESS or an error code to the calling SPI function that called dispSendCommand.

If xxxProcessCommand returns SUCCESS, either the function completed successfully without return information or an asynchronous function was started successfully.

If xxxProcessCommand returns SUCCESS_RESPONSE, either the function completed successfully with return information or an asynchronous function started successfully.

For more information about this function, refer to Runtime binding functions.