summaryrefslogtreecommitdiffstats
path: root/source3/rpc_server/rpc_server.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-09-25 11:34:56 +0200
committerStefan Metzmacher <metze@samba.org>2013-10-29 15:51:47 +0100
commit9e723f9d69bbbaefd9e15399654668693854628b (patch)
treeb57201b267cac4afe00807e48ae7e6fede15db8b /source3/rpc_server/rpc_server.c
parent921ef8f9eb718be7343b5d27b2f6b8341eeca162 (diff)
downloadsamba-9e723f9d69bbbaefd9e15399654668693854628b.tar.gz
samba-9e723f9d69bbbaefd9e15399654668693854628b.tar.xz
samba-9e723f9d69bbbaefd9e15399654668693854628b.zip
s3-rpc_server: Add named_pipe_client_init() function.
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/rpc_server/rpc_server.c')
-rw-r--r--source3/rpc_server/rpc_server.c68
1 files changed, 38 insertions, 30 deletions
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index cecc9881f3..f283559ddd 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -248,36 +248,6 @@ static void named_pipe_listener(struct tevent_context *ev,
* Accepts connections from clients and process requests using the appropriate
* dispatcher table. */
-struct named_pipe_client {
- const char *pipe_name;
-
- struct tevent_context *ev;
- struct messaging_context *msg_ctx;
-
- uint16_t file_type;
- uint16_t device_state;
- uint64_t allocation_size;
-
- struct tstream_context *tstream;
-
- struct tsocket_address *client;
- char *client_name;
- struct tsocket_address *server;
- char *server_name;
-
- struct auth_session_info *session_info;
-
- struct pipes_struct *p;
-
- struct tevent_queue *write_queue;
-
- struct iovec *iov;
- size_t count;
-
- named_pipe_termination_fn *term_fn;
- void *private_data;
-};
-
static int named_pipe_destructor(struct named_pipe_client *npc)
{
if (npc->term_fn) {
@@ -286,6 +256,44 @@ static int named_pipe_destructor(struct named_pipe_client *npc)
return 0;
}
+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;
+}
+
static void named_pipe_accept_done(struct tevent_req *subreq);
void named_pipe_accept_function(struct tevent_context *ev_ctx,