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 ****************************************************************/
28 NET_API_STATUS_SUCCESS
= 0
31 /****************************************************************
32 ****************************************************************/
39 uint16_t time_hi_and_version
;
44 #endif /* _HEADER_misc */
46 #ifndef _HEADER_libnetapi
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
;
56 const char * dc_site_name
;
57 const char * client_site_name
;
61 const char * usri0_name
;
65 const char * usri1_name
;
66 const char * usri1_password
;
67 uint32_t usri1_password_age
;
69 const char * usri1_home_dir
;
70 const char * usri1_comment
;
72 const char * usri1_script_path
;
75 #endif /* _HEADER_libnetapi */
77 /****************************************************************
78 ****************************************************************/
80 struct libnetapi_ctx
{
89 /****************************************************************
90 ****************************************************************/
92 NET_API_STATUS
libnetapi_init(struct libnetapi_ctx
**ctx
);
93 NET_API_STATUS
libnetapi_getctx(struct libnetapi_ctx
**ctx
);
94 NET_API_STATUS
libnetapi_free(struct libnetapi_ctx
*ctx
);
95 NET_API_STATUS
libnetapi_set_debuglevel(struct libnetapi_ctx
*ctx
, const char *debuglevel
);
96 NET_API_STATUS
libnetapi_get_debuglevel(struct libnetapi_ctx
*ctx
, char **debuglevel
);
97 NET_API_STATUS
libnetapi_set_username(struct libnetapi_ctx
*ctx
, const char *username
);
98 NET_API_STATUS
libnetapi_set_password(struct libnetapi_ctx
*ctx
, const char *password
);
99 NET_API_STATUS
libnetapi_set_workgroup(struct libnetapi_ctx
*ctx
, const char *workgroup
);
100 const char *libnetapi_errstr(NET_API_STATUS status
);
101 NET_API_STATUS
libnetapi_set_error_string(struct libnetapi_ctx
*ctx
, const char *format
, ...);
102 const char *libnetapi_get_error_string(struct libnetapi_ctx
*ctx
, NET_API_STATUS status
);
105 /****************************************************************
107 ****************************************************************/
109 NET_API_STATUS
NetApiBufferFree(void *buffer
);
111 /****************************************************************
113 ****************************************************************/
115 NET_API_STATUS
NetJoinDomain(const char * server
/* [in] */,
116 const char * domain
/* [in] [ref] */,
117 const char * account_ou
/* [in] */,
118 const char * account
/* [in] */,
119 const char * password
/* [in] */,
120 uint32_t join_flags
/* [in] */);
122 /****************************************************************
124 ****************************************************************/
126 NET_API_STATUS
NetUnjoinDomain(const char * server_name
/* [in] */,
127 const char * account
/* [in] */,
128 const char * password
/* [in] */,
129 uint32_t unjoin_flags
/* [in] */);
131 /****************************************************************
132 NetGetJoinInformation
133 ****************************************************************/
135 NET_API_STATUS
NetGetJoinInformation(const char * server_name
/* [in] */,
136 const char * *name_buffer
/* [out] [ref] */,
137 uint16_t *name_type
/* [out] [ref] */);
139 /****************************************************************
141 ****************************************************************/
143 NET_API_STATUS
NetGetJoinableOUs(const char * server_name
/* [in] */,
144 const char * domain
/* [in] [ref] */,
145 const char * account
/* [in] */,
146 const char * password
/* [in] */,
147 uint32_t *ou_count
/* [out] [ref] */,
148 const char * **ous
/* [out] [ref] */);
150 /****************************************************************
152 ****************************************************************/
154 NET_API_STATUS
NetServerGetInfo(const char * server_name
/* [in] */,
155 uint32_t level
/* [in] */,
156 uint8_t **buffer
/* [out] [ref] */);
158 /****************************************************************
160 ****************************************************************/
162 NET_API_STATUS
NetServerSetInfo(const char * server_name
/* [in] */,
163 uint32_t level
/* [in] */,
164 uint8_t *buffer
/* [in] [ref] */,
165 uint32_t *parm_error
/* [out] [ref] */);
167 /****************************************************************
169 ****************************************************************/
171 NET_API_STATUS
NetGetDCName(const char * server_name
/* [in] */,
172 const char * domain_name
/* [in] */,
173 uint8_t **buffer
/* [out] [ref] */);
175 /****************************************************************
177 ****************************************************************/
179 NET_API_STATUS
NetGetAnyDCName(const char * server_name
/* [in] */,
180 const char * domain_name
/* [in] */,
181 uint8_t **buffer
/* [out] [ref] */);
184 /****************************************************************
186 ****************************************************************/
188 NET_API_STATUS
DsGetDcName(const char * server_name
/* [in] [unique] */,
189 const char * domain_name
/* [in] [ref] */,
190 struct GUID
*domain_guid
/* [in] [unique] */,
191 const char * site_name
/* [in] [unique] */,
192 uint32_t flags
/* [in] */,
193 struct DOMAIN_CONTROLLER_INFO
**dc_info
/* [out] [ref] */);
195 /****************************************************************
197 ****************************************************************/
199 NET_API_STATUS
NetUserAdd(const char * server_name
/* [in] */,
200 uint32_t level
/* [in] */,
201 uint8_t *buffer
/* [in] [ref] */,
202 uint32_t *parm_error
/* [out] [ref] */);
204 /****************************************************************
206 ****************************************************************/
208 NET_API_STATUS
NetUserDel(const char * server_name
/* [in] */,
209 const char * user_name
/* [in] */);