Add NetUserDel to libnetapi.
[mat/samba.git] / source3 / lib / netapi / netapi.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  NetApi Support
4  *  Copyright (C) Guenther Deschner 2007-2008
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 #ifndef __LIB_NETAPI_H__
21 #define __LIB_NETAPI_H__
22
23 /****************************************************************
24  NET_API_STATUS
25 ****************************************************************/
26
27 typedef enum {
28         NET_API_STATUS_SUCCESS = 0
29 } NET_API_STATUS;
30
31 /****************************************************************
32 ****************************************************************/
33
34 #ifndef _HEADER_misc
35
36 struct GUID {
37         uint32_t time_low;
38         uint16_t time_mid;
39         uint16_t time_hi_and_version;
40         uint8_t clock_seq[2];
41         uint8_t node[6];
42 };
43
44 #endif /* _HEADER_misc */
45
46 #ifndef _HEADER_libnetapi
47
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;
55         uint32_t flags;
56         const char * dc_site_name;
57         const char * client_site_name;
58 };
59
60 struct USER_INFO_0 {
61         const char * usri0_name;
62 };
63
64 struct USER_INFO_1 {
65         const char * usri1_name;
66         const char * usri1_password;
67         uint32_t usri1_password_age;
68         uint32_t usri1_priv;
69         const char * usri1_home_dir;
70         const char * usri1_comment;
71         uint32_t usri1_flags;
72         const char * usri1_script_path;
73 };
74
75 #endif /* _HEADER_libnetapi */
76
77 /****************************************************************
78 ****************************************************************/
79
80 struct libnetapi_ctx {
81         char *debuglevel;
82         char *error_string;
83         char *username;
84         char *workgroup;
85         char *password;
86         char *krb5_cc_env;
87 };
88
89 /****************************************************************
90 ****************************************************************/
91
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);
103
104
105 /****************************************************************
106  NetApiBufferFree
107 ****************************************************************/
108
109 NET_API_STATUS NetApiBufferFree(void *buffer);
110
111 /****************************************************************
112  NetJoinDomain
113 ****************************************************************/
114
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] */);
121
122 /****************************************************************
123  NetUnjoinDomain
124 ****************************************************************/
125
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] */);
130
131 /****************************************************************
132  NetGetJoinInformation
133 ****************************************************************/
134
135 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] */,
136                                      const char * *name_buffer /* [out] [ref] */,
137                                      uint16_t *name_type /* [out] [ref] */);
138
139 /****************************************************************
140  NetGetJoinableOUs
141 ****************************************************************/
142
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] */);
149
150 /****************************************************************
151  NetServerGetInfo
152 ****************************************************************/
153
154 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
155                                 uint32_t level /* [in] */,
156                                 uint8_t **buffer /* [out] [ref] */);
157
158 /****************************************************************
159  NetServerSetInfo
160 ****************************************************************/
161
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] */);
166
167 /****************************************************************
168  NetGetDCName
169 ****************************************************************/
170
171 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
172                             const char * domain_name /* [in] */,
173                             uint8_t **buffer /* [out] [ref] */);
174
175 /****************************************************************
176  NetGetAnyDCName
177 ****************************************************************/
178
179 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
180                                const char * domain_name /* [in] */,
181                                uint8_t **buffer /* [out] [ref] */);
182
183
184 /****************************************************************
185  DsGetDcName
186 ****************************************************************/
187
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] */);
194
195 /****************************************************************
196  NetUserAdd
197 ****************************************************************/
198
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] */);
203
204 /****************************************************************
205  NetUserDel
206 ****************************************************************/
207
208 NET_API_STATUS NetUserDel(const char * server_name /* [in] */,
209                           const char * user_name /* [in] */);
210
211 #endif