s3-rpc_client: add and use rpc_client/rpc_client.h.
[samba.git] / source3 / rpc_client / cli_pipe.h
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
28 struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
29                                          struct event_context *ev,
30                                          struct rpc_pipe_client *cli,
31                                          uint8_t op_num,
32                                          DATA_BLOB *req_data);
33
34 NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req,
35                                TALLOC_CTX *mem_ctx,
36                                DATA_BLOB *reply_pdu);
37
38 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
39                                       struct event_context *ev,
40                                       struct rpc_pipe_client *cli,
41                                       struct pipe_auth_data *auth);
42
43 NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
44
45 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
46                        struct pipe_auth_data *auth);
47
48 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
49                                 unsigned int timeout);
50
51 bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
52
53 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
54
55 NTSTATUS rpccli_ncalrpc_bind_data(TALLOC_CTX *mem_ctx,
56                                   struct pipe_auth_data **presult);
57
58 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
59                                struct pipe_auth_data **presult);
60
61 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx,
62                                    const char *domain,
63                                    enum dcerpc_AuthLevel auth_level,
64                                    struct netlogon_creds_CredentialState *creds,
65                                    struct pipe_auth_data **presult);
66
67 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx,
68                            const char *host,
69                            const struct ndr_syntax_id *abstract_syntax,
70                            struct rpc_pipe_client **presult);
71
72 NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
73                                const struct ndr_syntax_id *abstract_syntax,
74                                struct rpc_pipe_client **presult);
75
76 struct dcerpc_binding_handle *rpccli_bh_create(struct rpc_pipe_client *c);
77
78 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
79                                   const struct ndr_syntax_id *interface,
80                                   struct rpc_pipe_client **presult);
81
82 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
83                                             enum dcerpc_transport_t transport,
84                                             const struct ndr_syntax_id *interface,
85                                             struct rpc_pipe_client **presult);
86
87 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
88                                    const struct ndr_syntax_id *interface,
89                                    enum dcerpc_transport_t transport,
90                                    enum dcerpc_AuthLevel auth_level,
91                                    const char *domain,
92                                    const char *username,
93                                    const char *password,
94                                    struct rpc_pipe_client **presult);
95
96 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
97                                           const struct ndr_syntax_id *interface,
98                                           enum dcerpc_transport_t transport,
99                                           enum dcerpc_AuthLevel auth_level,
100                                           const char *domain,
101                                           const char *username,
102                                           const char *password,
103                                           struct rpc_pipe_client **presult);
104
105 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
106                                              const struct ndr_syntax_id *interface,
107                                              enum dcerpc_transport_t transport,
108                                              enum dcerpc_AuthLevel auth_level,
109                                              const char *domain,
110                                              struct netlogon_creds_CredentialState **pdc,
111                                              struct rpc_pipe_client **presult);
112
113 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
114                                                  const struct ndr_syntax_id *interface,
115                                                  enum dcerpc_transport_t transport,
116                                                  enum dcerpc_AuthLevel auth_level,
117                                                  const char *domain,
118                                                  const char *username,
119                                                  const char *password,
120                                                  struct rpc_pipe_client **presult);
121
122 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
123                                     const struct ndr_syntax_id *interface,
124                                     enum dcerpc_transport_t transport,
125                                     enum dcerpc_AuthLevel auth_level,
126                                     const char *domain,
127                                     struct rpc_pipe_client **presult);
128
129 NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
130                                 const struct ndr_syntax_id *interface,
131                                 enum dcerpc_transport_t transport,
132                                 enum dcerpc_AuthLevel auth_level,
133                                 const char *service_princ,
134                                 const char *username,
135                                 const char *password,
136                                 struct rpc_pipe_client **presult);
137
138 NTSTATUS cli_rpc_pipe_open_spnego_krb5(struct cli_state *cli,
139                                         const struct ndr_syntax_id *interface,
140                                         enum dcerpc_transport_t transport,
141                                         enum dcerpc_AuthLevel auth_level,
142                                         const char *server,
143                                         const char *username,
144                                         const char *password,
145                                         struct rpc_pipe_client **presult);
146
147 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
148                              struct rpc_pipe_client *cli,
149                              DATA_BLOB *session_key);
150
151 #endif /* _CLI_PIPE_H */
152
153 /* vim: set ts=8 sw=8 noet cindent ft=c.doxygen: */