220.127.116.11 EvtRpcRemoteSubscriptionWaitAsync (Opnum 3)
Pull subscriptions are subscriptions in which the client requests records. The requests can be done by using a polling mechanism. The EvtRpcRemoteSubscriptionWaitAsync (Opnum 3) method can be used to enable the client to only poll when results are likely, and is typically used in conjunction with the EvtRpcRemoteSubscriptionNext (Opnum 2) (section 18.104.22.168) method, which is a blocking call; so this asynchronous method is used to provide a way for the caller to not have to block or continuously poll the server.
error_status_t EvtRpcRemoteSubscriptionWaitAsync( [in, context_handle] PCONTEXT_HANDLE_REMOTE_SUBSCRIPTION handle );
Return Values: The method MUST return ERROR_SUCCESS (0x00000000) on success; otherwise, it MUST return an implementation-specific nonzero value as specified in [MS-ERREF].
In response to this request from the client, the server MUST first validate the handle. For processing rules for handle validation, see the remarks in section 22.214.171.124. The server SHOULD fail the method with the return code ERROR_INVALID_PARAMETER (0x00000057) if it has no state for the handle.<13>
After the server validates the handle, it casts the handle value to the subscription object. The server then MUST check whether the subscription object is a push subscription. Because the subscription object contains the type of subscription, the server checks its type and SHOULD fail the method if it is not a push type subscription with the error ERROR_INVALID_OPERATION(0x000010DD).
If the preceding check is successful, the server MUST determine whether there are any events the client has not received that pass the subscription filters. The subscription object contains the information of the last event since its last delivery to the client. If there is no new event from the last time the server returned events to the client until the current moment, the server does not complete the call and SHOULD return anything to the client. If there are new events coming in, the server applies the subscription filters and if those events pass the filters, the server SHOULD call RpcAyncCompleteCall (see [MSDN-RpcAsyncCompleteCall]) to complete the async call so that the client will receive notification. Then the client will use EvtRpcRemoteSubscriptionNext (as specified in section 126.96.36.199) to get those new events from the server. The subscription filters are the XPath queries that the client specifies in the query parameter in the EvtRpcRegisterRemoteSubscription method (as specified in section 188.8.131.52). For information on how the server applies the filter, see [MSDN-CONSUMEVTS]. If there are no events meeting that criteria, the server MUST NOT complete this operation.
The server SHOULD be notified by the underlying network that the connection is lost from the client if the client abnormally terminates the connection. The server abandons its operation for the client in such a case. The server SHOULD release the subscription object it creates and free all associated resources. The associated resources are described in EvtRpcRegisterRemoteSubscription (Opnum 0) (section 184.108.40.206).
The server MUST return a value indicating success or failure for this operation.