Use SERVER_INFO_1005 in libnetapi.
[Samba/gebeck_regimport.git] / source3 / lib / netapi / netapi.h
bloba9b50c4e89da9e23a36f23f5ad14a5270dc0d735
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);
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 /****************************************************************
111 NetApiBufferFree
112 ****************************************************************/
114 NET_API_STATUS NetApiBufferFree(void *buffer);
116 /****************************************************************
117 NetJoinDomain
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 /****************************************************************
128 NetUnjoinDomain
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 /****************************************************************
145 NetGetJoinableOUs
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 /****************************************************************
156 NetServerGetInfo
157 ****************************************************************/
159 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
160 uint32_t level /* [in] */,
161 uint8_t **buffer /* [out] [ref] */);
163 /****************************************************************
164 NetServerSetInfo
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 /****************************************************************
173 NetGetDCName
174 ****************************************************************/
176 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
177 const char * domain_name /* [in] */,
178 uint8_t **buffer /* [out] [ref] */);
180 /****************************************************************
181 NetGetAnyDCName
182 ****************************************************************/
184 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
185 const char * domain_name /* [in] */,
186 uint8_t **buffer /* [out] [ref] */);
189 /****************************************************************
190 DsGetDcName
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 /****************************************************************
201 NetUserAdd
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 /****************************************************************
210 NetUserDel
211 ****************************************************************/
213 NET_API_STATUS NetUserDel(const char * server_name /* [in] */,
214 const char * user_name /* [in] */);
216 /****************************************************************
217 NetUserEnum
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] */);
229 #endif