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;
60 #endif /* _HEADER_libnetapi */
62 /****************************************************************
63 ****************************************************************/
65 struct libnetapi_ctx {
74 /****************************************************************
75 ****************************************************************/
77 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
78 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
79 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
80 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
81 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
82 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
83 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
84 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
85 const char *libnetapi_errstr(NET_API_STATUS status);
86 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
87 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status);
90 /****************************************************************
92 ****************************************************************/
94 NET_API_STATUS NetApiBufferFree(void *buffer);
96 /****************************************************************
98 ****************************************************************/
100 NET_API_STATUS NetJoinDomain(const char * server /* [in] */,
101 const char * domain /* [in] [ref] */,
102 const char * account_ou /* [in] */,
103 const char * account /* [in] */,
104 const char * password /* [in] */,
105 uint32_t join_flags /* [in] */);
107 /****************************************************************
109 ****************************************************************/
111 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] */,
112 const char * account /* [in] */,
113 const char * password /* [in] */,
114 uint32_t unjoin_flags /* [in] */);
116 /****************************************************************
117 NetGetJoinInformation
118 ****************************************************************/
120 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] */,
121 const char * *name_buffer /* [out] [ref] */,
122 uint16_t *name_type /* [out] [ref] */);
124 /****************************************************************
126 ****************************************************************/
128 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] */,
129 const char * domain /* [in] [ref] */,
130 const char * account /* [in] */,
131 const char * password /* [in] */,
132 uint32_t *ou_count /* [out] [ref] */,
133 const char * **ous /* [out] [ref] */);
135 /****************************************************************
137 ****************************************************************/
139 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
140 uint32_t level /* [in] */,
141 uint8_t **buffer /* [out] [ref] */);
143 /****************************************************************
145 ****************************************************************/
147 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] */,
148 uint32_t level /* [in] */,
149 uint8_t *buffer /* [in] [ref] */,
150 uint32_t *parm_error /* [out] [ref] */);
152 /****************************************************************
154 ****************************************************************/
156 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
157 const char * domain_name /* [in] */,
158 uint8_t **buffer /* [out] [ref] */);
160 /****************************************************************
162 ****************************************************************/
164 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
165 const char * domain_name /* [in] */,
166 uint8_t **buffer /* [out] [ref] */);
169 /****************************************************************
171 ****************************************************************/
173 NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */,
174 const char * domain_name /* [in] [ref] */,
175 struct GUID *domain_guid /* [in] [unique] */,
176 const char * site_name /* [in] [unique] */,
177 uint32_t flags /* [in] */,
178 struct DOMAIN_CONTROLLER_INFO **dc_info /* [out] [ref] */);