s3:rpc_server: add np_read_in_progress() function
authorStefan Metzmacher <metze@samba.org>
Wed, 28 Apr 2010 13:05:30 +0000 (15:05 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 29 Apr 2010 13:53:14 +0000 (15:53 +0200)
metze

source3/include/proto.h
source3/rpc_server/srv_pipe_hnd.c

index 1eaa008320d2cf991fbbb08d6069dc49253585bf..d0ecce578cc43969148149cc8be79c6f39b49556 100644 (file)
@@ -5871,6 +5871,7 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
                 const char *client_address,
                 struct auth_serversupplied_info *server_info,
                 struct fake_file_handle **phandle);
+bool np_read_in_progress(struct fake_file_handle *handle);
 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
                                 struct fake_file_handle *handle,
                                 const uint8_t *data, size_t len);
index 24cff4fe46742c41ea993d8d888f1592d29ab821..ec60a1bccfaae4669af923d9dc4ef3ef0d6c83ba 100644 (file)
@@ -1180,6 +1180,28 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
        return NT_STATUS_OK;
 }
 
+bool np_read_in_progress(struct fake_file_handle *handle)
+{
+       if (handle->type == FAKE_FILE_TYPE_NAMED_PIPE) {
+               return false;
+       }
+
+       if (handle->type == FAKE_FILE_TYPE_NAMED_PIPE_PROXY) {
+               struct np_proxy_state *p = talloc_get_type_abort(
+                       handle->private_data, struct np_proxy_state);
+               size_t read_count;
+
+               read_count = tevent_queue_length(p->read_queue);
+               if (read_count > 0) {
+                       return true;
+               }
+
+               return false;
+       }
+
+       return false;
+}
+
 struct np_write_state {
        struct event_context *ev;
        struct np_proxy_state *p;