2 * Unix SMB/CIFS implementation.
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 /****************************************************************
25 ****************************************************************/
27 NET_API_STATUS_SUCCESS
= 0
30 #define ERROR_MORE_DATA ( 234L )
32 /****************************************************************
33 ****************************************************************/
40 uint16_t time_hi_and_version
;
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
;
57 const char * dc_site_name
;
58 const char * client_site_name
;
61 struct SERVER_INFO_1005
{
62 const char * sv1005_comment
;
66 const char * usri0_name
;
70 const char * usri1_name
;
71 const char * usri1_password
;
72 uint32_t usri1_password_age
;
74 const char * usri1_home_dir
;
75 const char * usri1_comment
;
77 const char * usri1_script_path
;
80 #endif /* _HEADER_libnetapi */
82 /****************************************************************
83 ****************************************************************/
85 struct libnetapi_ctx
{
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 /****************************************************************
147 ****************************************************************/
149 NET_API_STATUS
NetApiBufferFree(void *buffer
);
151 /****************************************************************
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 /****************************************************************
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 /****************************************************************
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 /****************************************************************
192 ****************************************************************/
194 NET_API_STATUS
NetServerGetInfo(const char * server_name
/* [in] */,
195 uint32_t level
/* [in] */,
196 uint8_t **buffer
/* [out] [ref] */);
198 /****************************************************************
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 /****************************************************************
209 ****************************************************************/
211 NET_API_STATUS
NetGetDCName(const char * server_name
/* [in] */,
212 const char * domain_name
/* [in] */,
213 uint8_t **buffer
/* [out] [ref] */);
215 /****************************************************************
217 ****************************************************************/
219 NET_API_STATUS
NetGetAnyDCName(const char * server_name
/* [in] */,
220 const char * domain_name
/* [in] */,
221 uint8_t **buffer
/* [out] [ref] */);
224 /****************************************************************
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 /****************************************************************
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 /****************************************************************
246 ****************************************************************/
248 NET_API_STATUS
NetUserDel(const char * server_name
/* [in] */,
249 const char * user_name
/* [in] */);
251 /****************************************************************
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] */);