s4/drs_util: Move DRSUAPI connection data into separate object
[Samba/nascimento.git] / source4 / utils / net / drs / net_drs.h
blobdc5bb8c9d012732f076b960ebe92b1a3b5f17e85
1 /*
2 Unix SMB/CIFS implementation.
4 Implements functions offered by repadmin.exe tool under Windows
6 Copyright (C) Kamen Mazdrashki <kamen.mazdrashki@postpath.com> 2010
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef NET_DRS_H_
23 #define NET_DRS_H_
25 #include "librpc/gen_ndr/ndr_drsuapi_c.h"
28 /**
29 * Check for critical error
31 #define NET_DRS_CHECK_GOTO(_condition,_label,_msg) \
32 do { \
33 if (!(_condition)) { \
34 d_printf(__location__": "#_condition" - %s\n", _msg); \
35 goto _label; \
36 } \
37 } while (0)
39 /**
40 * check allocated memory macro
42 #define NET_DRS_NOMEM_GOTO(_ptr,_label) \
43 NET_DRS_CHECK_GOTO(_ptr, _label, "Not enough memory!")
46 /**
47 * DRSUAPI binding context
49 struct net_drs_connection {
50 /* DRSUAPI connection context */
51 struct dcerpc_binding *binding;
52 struct dcerpc_pipe *drs_pipe;
53 struct policy_handle bind_handle;
55 /* length of bind info structure returned by remote DC
56 * 'net drs bind' command make use of this value */
57 uint32_t bind_info_len;
59 /* remote DC DRSUAPI capabilities */
60 struct drsuapi_DsBindInfo48 info48;
64 /**
65 * net drs commands context
67 struct net_drs_context {
68 struct net_context *net_ctx;
70 /* remote DC name supplied from command line */
71 const char *dc_name;
73 /* DRSUAPI connection to target DC */
74 struct net_drs_connection *drs_conn;
76 /* LDAP connection to DC */
77 struct net_drs_ldap {
78 struct ldb_context *ldb;
79 const struct ldb_message *rootdse;
80 } ldap;
84 #include "utils/net/drs/net_drs_proto.h"
86 #endif /* NET_DRS_H_ */