/* a deferred reply to echodata */ static void deferred_echodata(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *private_data) { struct irpc_message *irpc = talloc_get_type(private_data, struct irpc_message); struct echo_EchoData *r = (struct echo_EchoData *)irpc->data; r->out.out_data = (uint8_t *)talloc_memdup(r, r->in.in_data, r->in.len); if (r->out.out_data == NULL) { irpc_send_reply(irpc, NT_STATUS_NO_MEMORY); } printf("sending deferred reply\n"); irpc_send_reply(irpc, NT_STATUS_OK); }
/** * Callback for dreplsrv_out_operation operation completion. * * We just need to complete a waiting IRPC message here. * In case pull operation has failed, * caller of this callback will dump * failure information. * * NOTE: cb_data is allocated in IRPC msg's context * and will be freed during irpc_send_reply() call. */ static void _drepl_replica_sync_done_cb(struct dreplsrv_service *service, WERROR werr, enum drsuapi_DsExtendedError ext_err, void *cb_data) { struct drepl_replica_sync_cb_data *data = talloc_get_type(cb_data, struct drepl_replica_sync_cb_data); struct irpc_message *msg = data->msg; struct drsuapi_DsReplicaSync *r = data->r; /* store last bad result */ if (!W_ERROR_IS_OK(werr)) { data->werr_last_failure = werr; } /* decrement pending ops count */ data->ops_count--; if (data->ops_count == 0) { /* Return result to client */ r->out.result = data->werr_last_failure; /* complete IRPC message */ irpc_send_reply(msg, NT_STATUS_OK); } }