Split out private headers in libnetapi.
[Samba.git] / source / lib / netapi / netapi.h
blob7b03e41c1956101d6bfa0a06e5f0b50f303dee87
1 /*
2 * Unix SMB/CIFS implementation.
3 * NetApi Support
4 * Copyright (C) Guenther Deschner 2007-2008
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.
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.
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/>.
20 #ifndef __LIB_NETAPI_H__
21 #define __LIB_NETAPI_H__
23 /****************************************************************
24 NET_API_STATUS
25 ****************************************************************/
26 typedef enum {
27 NET_API_STATUS_SUCCESS = 0
28 } NET_API_STATUS;
30 #define ERROR_MORE_DATA ( 234L )
32 /****************************************************************
33 ****************************************************************/
35 #ifndef _HEADER_misc
37 struct GUID {
38 uint32_t time_low;
39 uint16_t time_mid;
40 uint16_t time_hi_and_version;
41 uint8_t clock_seq[2];
42 uint8_t node[6];
45 #endif /* _HEADER_misc */
47 #ifndef _HEADER_libnetapi
49 struct DOMAIN_CONTROLLER_INFO {
50 const char * domain_controller_name;
51 const char * domain_controller_address;
52 uint32_t domain_controller_address_type;
53 struct GUID domain_guid;
54 const char * domain_name;
55 const char * dns_forest_name;
56 uint32_t flags;
57 const char * dc_site_name;
58 const char * client_site_name;
61 struct SERVER_INFO_1005 {
62 const char * sv1005_comment;
65 struct USER_INFO_0 {
66 const char * usri0_name;
69 struct USER_INFO_1 {
70 const char * usri1_name;
71 const char * usri1_password;
72 uint32_t usri1_password_age;
73 uint32_t usri1_priv;
74 const char * usri1_home_dir;
75 const char * usri1_comment;
76 uint32_t usri1_flags;
77 const char * usri1_script_path;
80 #endif /* _HEADER_libnetapi */
82 /****************************************************************
83 ****************************************************************/
85 struct libnetapi_ctx {
86 char *debuglevel;
87 char *error_string;
88 char *username;
89 char *workgroup;
90 char *password;
91 char *krb5_cc_env;
94 /****************************************************************
95 ****************************************************************/
97 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
99 /****************************************************************
100 ****************************************************************/
102 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
104 /****************************************************************
105 ****************************************************************/
107 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
109 /****************************************************************
110 ****************************************************************/
112 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
113 const char *debuglevel);
115 /****************************************************************
116 ****************************************************************/
118 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
119 const char *username);
121 /****************************************************************
122 ****************************************************************/
124 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx,
125 const char *password);
127 /****************************************************************
128 ****************************************************************/
130 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
131 const char *workgroup);
133 /****************************************************************
134 ****************************************************************/
136 const char *libnetapi_errstr(NET_API_STATUS status);
138 /****************************************************************
139 ****************************************************************/
141 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
142 NET_API_STATUS status);
145 /****************************************************************
146 NetApiBufferFree
147 ****************************************************************/
149 NET_API_STATUS NetApiBufferFree(void *buffer);
151 /****************************************************************
152 NetJoinDomain
153 ****************************************************************/
155 NET_API_STATUS NetJoinDomain(const char * server /* [in] */,
156 const char * domain /* [in] [ref] */,
157 const char * account_ou /* [in] */,
158 const char * account /* [in] */,
159 const char * password /* [in] */,
160 uint32_t join_flags /* [in] */);
162 /****************************************************************
163 NetUnjoinDomain
164 ****************************************************************/
166 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] */,
167 const char * account /* [in] */,
168 const char * password /* [in] */,
169 uint32_t unjoin_flags /* [in] */);
171 /****************************************************************
172 NetGetJoinInformation
173 ****************************************************************/
175 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] */,
176 const char * *name_buffer /* [out] [ref] */,
177 uint16_t *name_type /* [out] [ref] */);
179 /****************************************************************
180 NetGetJoinableOUs
181 ****************************************************************/
183 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] */,
184 const char * domain /* [in] [ref] */,
185 const char * account /* [in] */,
186 const char * password /* [in] */,
187 uint32_t *ou_count /* [out] [ref] */,
188 const char * **ous /* [out] [ref] */);
190 /****************************************************************
191 NetServerGetInfo
192 ****************************************************************/
194 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
195 uint32_t level /* [in] */,
196 uint8_t **buffer /* [out] [ref] */);
198 /****************************************************************
199 NetServerSetInfo
200 ****************************************************************/
202 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] */,
203 uint32_t level /* [in] */,
204 uint8_t *buffer /* [in] [ref] */,
205 uint32_t *parm_error /* [out] [ref] */);
207 /****************************************************************
208 NetGetDCName
209 ****************************************************************/
211 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
212 const char * domain_name /* [in] */,
213 uint8_t **buffer /* [out] [ref] */);
215 /****************************************************************
216 NetGetAnyDCName
217 ****************************************************************/
219 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
220 const char * domain_name /* [in] */,
221 uint8_t **buffer /* [out] [ref] */);
224 /****************************************************************
225 DsGetDcName
226 ****************************************************************/
228 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
229 const char * domain_name /* [in] [ref] */,
230 struct GUID *domain_guid /* [in] [unique] */,
231 const char * site_name /* [in] [unique] */,
232 uint32_t flags /* [in] */,
233 struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */);
235 /****************************************************************
236 NetUserAdd
237 ****************************************************************/
239 NET_API_STATUS NetUserAdd(const char * server_name /* [in] */,
240 uint32_t level /* [in] */,
241 uint8_t *buffer /* [in] [ref] */,
242 uint32_t *parm_error /* [out] [ref] */);
244 /****************************************************************
245 NetUserDel
246 ****************************************************************/
248 NET_API_STATUS NetUserDel(const char * server_name /* [in] */,
249 const char * user_name /* [in] */);
251 /****************************************************************
252 NetUserEnum
253 ****************************************************************/
255 NET_API_STATUS NetUserEnum(const char * server_name /* [in] */,
256 uint32_t level /* [in] */,
257 uint32_t filter /* [in] */,
258 uint8_t **buffer /* [out] [ref] */,
259 uint32_t prefmaxlen /* [in] */,
260 uint32_t *entries_read /* [out] [ref] */,
261 uint32_t *total_entries /* [out] [ref] */,
262 uint32_t *resume_handle /* [in,out] [ref] */);
264 #endif