+struct named_pipe_client *named_pipe_client_init(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const char *pipe_name,
+ named_pipe_termination_fn *term_fn,
+ uint16_t file_type,
+ uint16_t device_state,
+ uint64_t allocation_size,
+ void *private_data)
+{
+ struct named_pipe_client *npc;
+
+ npc = talloc_zero(mem_ctx, struct named_pipe_client);
+ if (npc == NULL) {
+ DEBUG(0, ("Out of memory!\n"));
+ return NULL;
+ }
+ talloc_set_destructor(npc, named_pipe_destructor);
+
+ npc->pipe_name = talloc_strdup(npc, pipe_name);
+ if (npc->pipe_name == NULL) {
+ DEBUG(0, ("Out of memory!\n"));
+ talloc_free(npc);
+ return NULL;
+ }
+
+ npc->ev = ev_ctx;
+ npc->msg_ctx = msg_ctx;
+ npc->term_fn = term_fn;
+ npc->private_data = private_data;
+
+ npc->file_type = file_type;
+ npc->device_state = device_state;
+ npc->allocation_size = allocation_size;
+
+ return npc;
+}
+