s3-libnetapi: pass down ndr_interface_table to libnetapi_get_binding_handle().
[metze/samba/wip.git] / source3 / lib / netapi / netapi_private.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  NetApi Support
4  *  Copyright (C) Guenther Deschner 2008
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef __LIB_NETAPI_PRIVATE_H__
21 #define __LIB_NETAPI_PRIVATE_H__
22
23 #include "lib/netapi/netapi_net.h"
24
25 #define LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, fn) \
26         DEBUG(10,("redirecting call %s to localhost\n", #fn)); \
27         if (!r->in.server_name) { \
28                 r->in.server_name = "localhost"; \
29         } \
30         return fn ## _r(ctx, r);
31
32 struct dcerpc_binding_handle;
33 struct ndr_interface_table;
34
35 struct libnetapi_private_ctx {
36         struct {
37                 const char *domain_name;
38                 struct dom_sid *domain_sid;
39                 struct rpc_pipe_client *cli;
40
41                 uint32_t connect_mask;
42                 struct policy_handle connect_handle;
43
44                 uint32_t domain_mask;
45                 struct policy_handle domain_handle;
46
47                 uint32_t builtin_mask;
48                 struct policy_handle builtin_handle;
49         } samr;
50
51         struct client_ipc_connection *ipc_connections;
52
53         struct messaging_context *msg_ctx;
54 };
55
56 NET_API_STATUS libnetapi_get_password(struct libnetapi_ctx *ctx, char **password);
57 NET_API_STATUS libnetapi_get_username(struct libnetapi_ctx *ctx, char **username);
58 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
59 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
60
61 WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx);
62 WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
63                            const char *server_name,
64                            const struct ndr_syntax_id *interface,
65                            struct rpc_pipe_client **presult);
66 WERROR libnetapi_get_binding_handle(struct libnetapi_ctx *ctx,
67                                     const char *server_name,
68                                     const struct ndr_interface_table *table,
69                                     struct dcerpc_binding_handle **binding_handle);
70 WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
71                                   struct rpc_pipe_client *pipe_cli,
72                                   uint32_t connect_mask,
73                                   uint32_t domain_mask,
74                                   struct policy_handle *connect_handle,
75                                   struct policy_handle *domain_handle,
76                                   struct dom_sid2 **domain_sid);
77 WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx,
78                                           struct rpc_pipe_client *pipe_cli,
79                                           uint32_t connect_mask,
80                                           uint32_t builtin_mask,
81                                           struct policy_handle *connect_handle,
82                                           struct policy_handle *builtin_handle);
83 void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx,
84                                         struct policy_handle *handle);
85 void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx *ctx,
86                                          struct policy_handle *handle);
87 void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx,
88                                          struct policy_handle *handle);
89 void libnetapi_samr_free(struct libnetapi_ctx *ctx);
90
91 NTSTATUS add_GROUP_USERS_INFO_X_buffer(TALLOC_CTX *mem_ctx,
92                                        uint32_t level,
93                                        const char *group_name,
94                                        uint32_t attributes,
95                                        uint8_t **buffer,
96                                        uint32_t *num_entries);
97
98 #endif