1 /*
2  *  Unix SMB/CIFS implementation.
3  *
4  *  RPC Pipe client routines
5  *
6  *  Copyright (c) 2005      Jeremy Allison
7  *  Copyright (c) 2010      Simo Sorce
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 3 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef _CLI_PIPE_H
24 #define _CLI_PIPE_H
25 
26 #include "rpc_client/rpc_client.h"
27 #include "auth/credentials/credentials.h"
28 
29 /* The following definitions come from rpc_client/cli_pipe.c  */
30 
31 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
32 				      struct tevent_context *ev,
33 				      struct rpc_pipe_client *cli,
34 				      struct pipe_auth_data *auth);
35 
36 NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
37 
38 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
39 		       struct pipe_auth_data *auth);
40 
41 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
42 				unsigned int timeout);
43 
44 bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
45 
46 NTSTATUS rpccli_ncalrpc_bind_data(TALLOC_CTX *mem_ctx,
47 				  struct pipe_auth_data **presult);
48 
49 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
50 			       struct pipe_auth_data **presult);
51 
52 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx,
53 			   const char *host,
54 			   const struct sockaddr_storage *ss_addr,
55 			   const struct ndr_interface_table *table,
56 			   struct rpc_pipe_client **presult);
57 
58 NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
59 			       const struct ndr_interface_table *table,
60 			       struct rpc_pipe_client **presult);
61 
62 struct dcerpc_binding_handle *rpccli_bh_create(struct rpc_pipe_client *c,
63 					const struct GUID *object,
64 					const struct ndr_interface_table *table);
65 
66 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
67 				  const struct ndr_interface_table *table,
68 				  struct rpc_pipe_client **presult);
69 
70 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
71 					    enum dcerpc_transport_t transport,
72 					    const struct ndr_interface_table *table,
73 					    struct rpc_pipe_client **presult);
74 
75 /****************************************************************************
76  Open a named pipe to an SMB server and bind using the mech specified
77 
78  This routine steals the creds pointer that is passed in
79  ****************************************************************************/
80 
81 NTSTATUS cli_rpc_pipe_open_with_creds(struct cli_state *cli,
82 				      const struct ndr_interface_table *table,
83 				      enum dcerpc_transport_t transport,
84 				      enum dcerpc_AuthType auth_type,
85 				      enum dcerpc_AuthLevel auth_level,
86 				      const char *server,
87 				      struct cli_credentials *creds,
88 				      struct rpc_pipe_client **presult);
89 
90 NTSTATUS cli_rpc_pipe_open_generic_auth(struct cli_state *cli,
91 					const struct ndr_interface_table *table,
92 					enum dcerpc_transport_t transport,
93 					enum credentials_use_kerberos use_kerberos,
94 					enum dcerpc_AuthType auth_type,
95 					enum dcerpc_AuthLevel auth_level,
96 					const char *server,
97 					const char *domain,
98 					const char *username,
99 					const char *password,
100 					struct rpc_pipe_client **presult);
101 
102 NTSTATUS cli_rpc_pipe_open_bind_schannel(
103 	struct cli_state *cli,
104 	const struct ndr_interface_table *table,
105 	enum dcerpc_transport_t transport,
106 	struct netlogon_creds_cli_context *netlogon_creds,
107 	struct rpc_pipe_client **_rpccli);
108 NTSTATUS cli_rpc_pipe_open_schannel_with_creds(struct cli_state *cli,
109 					       const struct ndr_interface_table *table,
110 					       enum dcerpc_transport_t transport,
111 					       struct netlogon_creds_cli_context *netlogon_creds,
112 					       struct rpc_pipe_client **_rpccli);
113 
114 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
115 				    struct messaging_context *msg_ctx,
116 				    const struct ndr_interface_table *table,
117 				    enum dcerpc_transport_t transport,
118 				    const char *domain,
119 				    struct rpc_pipe_client **presult,
120 				    TALLOC_CTX *mem_ctx,
121 				    struct netlogon_creds_cli_context **pcreds);
122 
123 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
124 			     struct rpc_pipe_client *cli,
125 			     DATA_BLOB *session_key);
126 
127 #endif /* _CLI_PIPE_H */
128 
129 /* vim: set ts=8 sw=8 noet cindent ft=c.doxygen: */
130