2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Volker Lendecke 2009
5 * Copyright (C) Simo Sorce 2010
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef _RPC_CLIENT_RPC_TRANSPORT_H_
22 #define _RPC_CLIENT_RPC_TRANSPORT_H_
24 #include "librpc/rpc/dcerpc.h"
27 * rpc_cli_transport defines a transport mechanism to ship rpc requests
28 * asynchronously to a server and receive replies
31 struct rpc_cli_transport
{
33 enum dcerpc_transport_t transport
;
36 * Trigger an async read from the server. May return a short read.
38 struct tevent_req
*(*read_send
)(TALLOC_CTX
*mem_ctx
,
39 struct tevent_context
*ev
,
40 uint8_t *data
, size_t size
,
43 * Get the result from the read_send operation.
45 NTSTATUS (*read_recv
)(struct tevent_req
*req
, ssize_t
*preceived
);
48 * Trigger an async write to the server. May return a short write.
50 struct tevent_req
*(*write_send
)(TALLOC_CTX
*mem_ctx
,
51 struct tevent_context
*ev
,
52 const uint8_t *data
, size_t size
,
55 * Get the result from the read_send operation.
57 NTSTATUS (*write_recv
)(struct tevent_req
*req
, ssize_t
*psent
);
60 * This is an optimization for the SMB transport. It models the
61 * TransactNamedPipe API call: Send and receive data in one round
62 * trip. The transport implementation is free to set this to NULL,
63 * cli_pipe.c will fall back to the explicit write/read routines.
65 struct tevent_req
*(*trans_send
)(TALLOC_CTX
*mem_ctx
,
66 struct tevent_context
*ev
,
67 const uint8_t *data
, size_t data_len
,
68 uint32_t max_rdata_len
,
71 * Get the result from the trans_send operation.
73 NTSTATUS (*trans_recv
)(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
74 uint8_t **prdata
, uint32_t *prdata_len
);
76 bool (*is_connected
)(void *priv
);
77 unsigned int (*set_timeout
)(void *priv
, unsigned int timeout
);
82 /* The following definitions come from rpc_client/rpc_transport_np.c */
84 struct tevent_req
*rpc_transport_np_init_send(TALLOC_CTX
*mem_ctx
,
85 struct tevent_context
*ev
,
86 struct cli_state
*cli
,
87 const struct ndr_interface_table
*table
);
88 NTSTATUS
rpc_transport_np_init_recv(struct tevent_req
*req
,
90 struct rpc_cli_transport
**presult
);
91 NTSTATUS
rpc_transport_np_init(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
92 const struct ndr_interface_table
*table
,
93 struct rpc_cli_transport
**presult
);
95 /* The following definitions come from rpc_client/rpc_transport_sock.c */
97 NTSTATUS
rpc_transport_sock_init(TALLOC_CTX
*mem_ctx
, int fd
,
98 struct rpc_cli_transport
**presult
);
100 /* The following definitions come from rpc_client/rpc_transport_tstream.c */
102 NTSTATUS
rpc_transport_tstream_init(TALLOC_CTX
*mem_ctx
,
103 struct tstream_context
**stream
,
104 struct rpc_cli_transport
**presult
);
106 #endif /* _RPC_CLIENT_RPC_TRANSPORT_H_ */