The following table describes which flag needs to be set in the size field in the DISP_EVENT structure based upon the buffer owner, how the buffer is being used, and how the buffer is being allocated:
|
Buffer owner |
Used as asynchronous... |
Method of allocation |
Flag set in size field |
|---|---|---|---|
|
Client-side |
Input |
Static or dynamic |
CTA_EVT_ASYNC_BUF_IN |
|
Client-side |
Output |
Static or dynamic |
None (default) |
|
Server-side |
Input |
Static |
CTA_INTERNAL_BUFFER_STATIC |
|
Server-side |
Input |
Dynamic |
CTA_INTERNAL_BUFFER |
To allocate and free buffers, you can use two Natural Access dispatcher functions: dispAllocBuffer and dispFreeBuffer. It is strongly recommended that the service implementation use dispAllocBuffer to allocate non-static buffers for delivery in event messages. Use of this function relieves the service implementation from having to free the buffer (Natural Access or the application performs the necessary dispFreeBuffer invocation). This method avoids complications since there is no way for the service implementation to determine when the dispatcher has completed delivery of an event.