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
);
98 NET_API_STATUS
libnetapi_getctx(struct libnetapi_ctx
**ctx
);
99 NET_API_STATUS
libnetapi_free(struct libnetapi_ctx
*ctx
);
100 NET_API_STATUS
libnetapi_set_debuglevel(struct libnetapi_ctx
*ctx
, const char *debuglevel
);
101 NET_API_STATUS
libnetapi_get_debuglevel(struct libnetapi_ctx
*ctx
, char **debuglevel
);
102 NET_API_STATUS
libnetapi_set_username(struct libnetapi_ctx
*ctx
, const char *username
);
103 NET_API_STATUS
libnetapi_set_password(struct libnetapi_ctx
*ctx
, const char *password
);
104 NET_API_STATUS
libnetapi_set_workgroup(struct libnetapi_ctx
*ctx
, const char *workgroup
);
105 const char *libnetapi_errstr(NET_API_STATUS status
);
106 NET_API_STATUS
libnetapi_set_error_string(struct libnetapi_ctx
*ctx
, const char *format
, ...);
107 const char *libnetapi_get_error_string(struct libnetapi_ctx
*ctx
, NET_API_STATUS status
);
110 /****************************************************************
112 ****************************************************************/
114 NET_API_STATUS
NetApiBufferFree(void *buffer
);
116 /****************************************************************
118 ****************************************************************/
120 NET_API_STATUS
NetJoinDomain(const char * server
/* [in] */,
121 const char * domain
/* [in] [ref] */,
122 const char * account_ou
/* [in] */,
123 const char * account
/* [in] */,
124 const char * password
/* [in] */,
125 uint32_t join_flags
/* [in] */);
127 /****************************************************************
129 ****************************************************************/
131 NET_API_STATUS
NetUnjoinDomain(const char * server_name
/* [in] */,
132 const char * account
/* [in] */,
133 const char * password
/* [in] */,
134 uint32_t unjoin_flags
/* [in] */);
136 /****************************************************************
137 NetGetJoinInformation
138 ****************************************************************/
140 NET_API_STATUS
NetGetJoinInformation(const char * server_name
/* [in] */,
141 const char * *name_buffer
/* [out] [ref] */,
142 uint16_t *name_type
/* [out] [ref] */);
144 /****************************************************************
146 ****************************************************************/
148 NET_API_STATUS
NetGetJoinableOUs(const char * server_name
/* [in] */,
149 const char * domain
/* [in] [ref] */,
150 const char * account
/* [in] */,
151 const char * password
/* [in] */,
152 uint32_t *ou_count
/* [out] [ref] */,
153 const char * **ous
/* [out] [ref] */);
155 /****************************************************************
157 ****************************************************************/
159 NET_API_STATUS
NetServerGetInfo(const char * server_name
/* [in] */,
160 uint32_t level
/* [in] */,
161 uint8_t **buffer
/* [out] [ref] */);
163 /****************************************************************
165 ****************************************************************/
167 NET_API_STATUS
NetServerSetInfo(const char * server_name
/* [in] */,
168 uint32_t level
/* [in] */,
169 uint8_t *buffer
/* [in] [ref] */,
170 uint32_t *parm_error
/* [out] [ref] */);
172 /****************************************************************
174 ****************************************************************/
176 NET_API_STATUS
NetGetDCName(const char * server_name
/* [in] */,
177 const char * domain_name
/* [in] */,
178 uint8_t **buffer
/* [out] [ref] */);
180 /****************************************************************
182 ****************************************************************/
184 NET_API_STATUS
NetGetAnyDCName(const char * server_name
/* [in] */,
185 const char * domain_name
/* [in] */,
186 uint8_t **buffer
/* [out] [ref] */);
189 /****************************************************************
191 ****************************************************************/
193 NET_API_STATUS
DsGetDcName(const char * server_name
/* [in] [unique] */,
194 const char * domain_name
/* [in] [ref] */,
195 struct GUID
*domain_guid
/* [in] [unique] */,
196 const char * site_name
/* [in] [unique] */,
197 uint32_t flags
/* [in] */,
198 struct DOMAIN_CONTROLLER_INFO
**dc_info
/* [out] [ref] */);
200 /****************************************************************
202 ****************************************************************/
204 NET_API_STATUS
NetUserAdd(const char * server_name
/* [in] */,
205 uint32_t level
/* [in] */,
206 uint8_t *buffer
/* [in] [ref] */,
207 uint32_t *parm_error
/* [out] [ref] */);
209 /****************************************************************
211 ****************************************************************/
213 NET_API_STATUS
NetUserDel(const char * server_name
/* [in] */,
214 const char * user_name
/* [in] */);
216 /****************************************************************
218 ****************************************************************/
220 NET_API_STATUS
NetUserEnum(const char * server_name
/* [in] */,
221 uint32_t level
/* [in] */,
222 uint32_t filter
/* [in] */,
223 uint8_t **buffer
/* [out] [ref] */,
224 uint32_t prefmaxlen
/* [in] */,
225 uint32_t *entries_read
/* [out] [ref] */,
226 uint32_t *total_entries
/* [out] [ref] */,
227 uint32_t *resume_handle
/* [in,out] [ref] */);