From 66e896186fd485cdf004319ba3ab74bcca87d0f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Thu, 31 Mar 2011 00:34:28 +0200 Subject: [PATCH] s3-rpc_client: move rpc_cli_transport structs and protos to rpc_transport.h Guenther (cherry picked from commit 64b664155b16b0995af7cc87f54c613350127f9e) (cherry picked from commit a35c24c9a47f947abc992c14c809403e6aa5aa07) --- source3/include/client.h | 56 +-------------- source3/include/proto.h | 25 ------- source3/rpc_client/rpc_transport.h | 107 +++++++++++++++++++++++++++++ source3/rpc_client/rpc_transport_np.c | 1 + source3/rpc_client/rpc_transport_sock.c | 1 + source3/rpc_client/rpc_transport_tstream.c | 1 + 6 files changed, 111 insertions(+), 80 deletions(-) create mode 100644 source3/rpc_client/rpc_transport.h diff --git a/source3/include/client.h b/source3/include/client.h index 9f8f46c4ab6..a4c52c3a060 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -48,61 +48,7 @@ struct print_job_info { time_t t; }; -/** - * rpc_cli_transport defines a transport mechanism to ship rpc requests - * asynchronously to a server and receive replies - */ - -struct rpc_cli_transport { - - enum dcerpc_transport_t transport; - - /** - * Trigger an async read from the server. May return a short read. - */ - struct tevent_req *(*read_send)(TALLOC_CTX *mem_ctx, - struct event_context *ev, - uint8_t *data, size_t size, - void *priv); - /** - * Get the result from the read_send operation. - */ - NTSTATUS (*read_recv)(struct tevent_req *req, ssize_t *preceived); - - /** - * Trigger an async write to the server. May return a short write. - */ - struct tevent_req *(*write_send)(TALLOC_CTX *mem_ctx, - struct event_context *ev, - const uint8_t *data, size_t size, - void *priv); - /** - * Get the result from the read_send operation. - */ - NTSTATUS (*write_recv)(struct tevent_req *req, ssize_t *psent); - - /** - * This is an optimization for the SMB transport. It models the - * TransactNamedPipe API call: Send and receive data in one round - * trip. The transport implementation is free to set this to NULL, - * cli_pipe.c will fall back to the explicit write/read routines. - */ - struct tevent_req *(*trans_send)(TALLOC_CTX *mem_ctx, - struct event_context *ev, - uint8_t *data, size_t data_len, - uint32_t max_rdata_len, - void *priv); - /** - * Get the result from the trans_send operation. - */ - NTSTATUS (*trans_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx, - uint8_t **prdata, uint32_t *prdata_len); - - bool (*is_connected)(void *priv); - unsigned int (*set_timeout)(void *priv, unsigned int timeout); - - void *priv; -}; +#include "rpc_client/rpc_transport.h" struct dcerpc_binding_handle; diff --git a/source3/include/proto.h b/source3/include/proto.h index 8d2d95eedda..77ad93d21f5 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2763,31 +2763,6 @@ NTSTATUS get_schannel_session_key(struct cli_state *cli, uint32 *pneg_flags, struct rpc_pipe_client **presult); -/* The following definitions come from rpc_client/rpc_transport_np.c */ - -struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx, - struct event_context *ev, - struct cli_state *cli, - const struct ndr_syntax_id *abstract_syntax); -NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx, - struct rpc_cli_transport **presult); -NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli, - const struct ndr_syntax_id *abstract_syntax, - struct rpc_cli_transport **presult); - -/* The following definitions come from rpc_client/rpc_transport_sock.c */ - -NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd, - struct rpc_cli_transport **presult); - -/* The following definitions come from rpc_client/rpc_transport_tstream.c */ - -NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx, - struct tstream_context **stream, - struct rpc_cli_transport **presult); -struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p); - /* The following definitions come from rpc_server/rpc_handles.c */ size_t num_pipe_handles(struct pipes_struct *p); diff --git a/source3/rpc_client/rpc_transport.h b/source3/rpc_client/rpc_transport.h new file mode 100644 index 00000000000..abab4a0cae9 --- /dev/null +++ b/source3/rpc_client/rpc_transport.h @@ -0,0 +1,107 @@ +/* + * Unix SMB/CIFS implementation. + * RPC client transport + * Copyright (C) Volker Lendecke 2009 + * Copyright (C) Simo Sorce 2010 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _RPC_CLIENT_RPC_TRANSPORT_H_ +#define _RPC_CLIENT_RPC_TRANSPORT_H_ + +#include "librpc/rpc/dcerpc.h" + +/** + * rpc_cli_transport defines a transport mechanism to ship rpc requests + * asynchronously to a server and receive replies + */ + +struct rpc_cli_transport { + + enum dcerpc_transport_t transport; + + /** + * Trigger an async read from the server. May return a short read. + */ + struct tevent_req *(*read_send)(TALLOC_CTX *mem_ctx, + struct event_context *ev, + uint8_t *data, size_t size, + void *priv); + /** + * Get the result from the read_send operation. + */ + NTSTATUS (*read_recv)(struct tevent_req *req, ssize_t *preceived); + + /** + * Trigger an async write to the server. May return a short write. + */ + struct tevent_req *(*write_send)(TALLOC_CTX *mem_ctx, + struct event_context *ev, + const uint8_t *data, size_t size, + void *priv); + /** + * Get the result from the read_send operation. + */ + NTSTATUS (*write_recv)(struct tevent_req *req, ssize_t *psent); + + /** + * This is an optimization for the SMB transport. It models the + * TransactNamedPipe API call: Send and receive data in one round + * trip. The transport implementation is free to set this to NULL, + * cli_pipe.c will fall back to the explicit write/read routines. + */ + struct tevent_req *(*trans_send)(TALLOC_CTX *mem_ctx, + struct event_context *ev, + uint8_t *data, size_t data_len, + uint32_t max_rdata_len, + void *priv); + /** + * Get the result from the trans_send operation. + */ + NTSTATUS (*trans_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx, + uint8_t **prdata, uint32_t *prdata_len); + + bool (*is_connected)(void *priv); + unsigned int (*set_timeout)(void *priv, unsigned int timeout); + + void *priv; +}; + +/* The following definitions come from rpc_client/rpc_transport_np.c */ +struct cli_state; +struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, + const struct ndr_syntax_id *abstract_syntax); +NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + struct rpc_cli_transport **presult); +NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli, + const struct ndr_syntax_id *abstract_syntax, + struct rpc_cli_transport **presult); + +/* The following definitions come from rpc_client/rpc_transport_sock.c */ + +NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd, + struct rpc_cli_transport **presult); + +/* The following definitions come from rpc_client/rpc_transport_tstream.c */ + +NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx, + struct tstream_context **stream, + struct rpc_cli_transport **presult); +struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p); + +#endif /* _RPC_CLIENT_RPC_TRANSPORT_H_ */ diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c index a3f3a1735da..2be01621448 100644 --- a/source3/rpc_client/rpc_transport_np.c +++ b/source3/rpc_client/rpc_transport_np.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "rpc_client/rpc_transport.h" #include "libsmb/cli_np_tstream.h" #undef DBGC_CLASS diff --git a/source3/rpc_client/rpc_transport_sock.c b/source3/rpc_client/rpc_transport_sock.c index 58f194f262f..71f979c2af9 100644 --- a/source3/rpc_client/rpc_transport_sock.c +++ b/source3/rpc_client/rpc_transport_sock.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "rpc_client/rpc_transport.h" #include "../lib/async_req/async_sock.h" #undef DBGC_CLASS diff --git a/source3/rpc_client/rpc_transport_tstream.c b/source3/rpc_client/rpc_transport_tstream.c index ebbdc03685f..248b09f0491 100644 --- a/source3/rpc_client/rpc_transport_tstream.c +++ b/source3/rpc_client/rpc_transport_tstream.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "rpc_client/rpc_transport.h" #include "lib/tsocket/tsocket.h" #include "libsmb/cli_np_tstream.h" #include "cli_pipe.h" -- 2.11.4.GIT