Add DsGetDcName call to libnetapi library.
[mat/samba.git] / source3 / lib / netapi / netapi.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  NetApi Support
4  *  Copyright (C) Guenther Deschner 2007-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_H__
21 #define __LIB_NETAPI_H__
22
23 /****************************************************************
24  NET_API_STATUS
25 ****************************************************************/
26
27 typedef enum {
28         NET_API_STATUS_SUCCESS = 0
29 } NET_API_STATUS;
30
31 /****************************************************************
32 ****************************************************************/
33
34 #ifndef _HEADER_misc
35
36 struct GUID {
37         uint32_t time_low;
38         uint16_t time_mid;
39         uint16_t time_hi_and_version;
40         uint8_t clock_seq[2];
41         uint8_t node[6];
42 };
43
44 #endif /* _HEADER_misc */
45
46 #ifndef _HEADER_libnetapi
47
48 struct DOMAIN_CONTROLLER_INFO {
49         const char * domain_controller_name;
50         const char * domain_controller_address;
51         uint32_t domain_controller_address_type;
52         struct GUID domain_guid;
53         const char * domain_name;
54         const char * dns_foreset_name;
55         uint32_t flags;
56         const char * dc_site_name;
57         const char * client_site_name;
58 };
59
60 #endif /* _HEADER_libnetapi */
61
62 /****************************************************************
63 ****************************************************************/
64
65 struct libnetapi_ctx {
66         char *debuglevel;
67         char *error_string;
68         char *username;
69         char *workgroup;
70         char *password;
71         char *krb5_cc_env;
72 };
73
74 /****************************************************************
75 ****************************************************************/
76
77 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
78 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
79 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
80 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
81 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
82 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
83 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
84 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
85 const char *libnetapi_errstr(NET_API_STATUS status);
86 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
87 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status);
88
89
90 /****************************************************************
91  NetApiBufferFree
92 ****************************************************************/
93
94 NET_API_STATUS NetApiBufferFree(void *buffer);
95
96 /****************************************************************
97  NetJoinDomain
98 ****************************************************************/
99
100 NET_API_STATUS NetJoinDomain(const char * server /* [in] */,
101                              const char * domain /* [in] [ref] */,
102                              const char * account_ou /* [in] */,
103                              const char * account /* [in] */,
104                              const char * password /* [in] */,
105                              uint32_t join_flags /* [in] */);
106
107 /****************************************************************
108  NetUnjoinDomain
109 ****************************************************************/
110
111 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] */,
112                                const char * account /* [in] */,
113                                const char * password /* [in] */,
114                                uint32_t unjoin_flags /* [in] */);
115
116 /****************************************************************
117  NetGetJoinInformation
118 ****************************************************************/
119
120 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] */,
121                                      const char * *name_buffer /* [out] [ref] */,
122                                      uint16_t *name_type /* [out] [ref] */);
123
124 /****************************************************************
125  NetGetJoinableOUs
126 ****************************************************************/
127
128 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] */,
129                                  const char * domain /* [in] [ref] */,
130                                  const char * account /* [in] */,
131                                  const char * password /* [in] */,
132                                  uint32_t *ou_count /* [out] [ref] */,
133                                  const char * **ous /* [out] [ref] */);
134
135 /****************************************************************
136  NetServerGetInfo
137 ****************************************************************/
138
139 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
140                                 uint32_t level /* [in] */,
141                                 uint8_t **buffer /* [out] [ref] */);
142
143 /****************************************************************
144  NetServerSetInfo
145 ****************************************************************/
146
147 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] */,
148                                 uint32_t level /* [in] */,
149                                 uint8_t *buffer /* [in] [ref] */,
150                                 uint32_t *parm_error /* [out] [ref] */);
151
152 /****************************************************************
153  NetGetDCName
154 ****************************************************************/
155
156 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
157                             const char * domain_name /* [in] */,
158                             uint8_t **buffer /* [out] [ref] */);
159
160 /****************************************************************
161  NetGetAnyDCName
162 ****************************************************************/
163
164 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
165                                const char * domain_name /* [in] */,
166                                uint8_t **buffer /* [out] [ref] */);
167
168
169 /****************************************************************
170  DsGetDcName
171 ****************************************************************/
172
173 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
174                            const char * domain_name /* [in] [ref] */,
175                            struct GUID *domain_guid /* [in] [unique] */,
176                            const char * site_name /* [in] [unique] */,
177                            uint32_t flags /* [in] */,
178                            struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */);
179 #endif