4a40b32fc95d4239cbc4200d54db21f4321bea58
[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 #define NET_API_STATUS uint32_t
24 #define NET_API_STATUS_SUCCESS 0
25
26 /****************************************************************
27 ****************************************************************/
28
29 struct libnetapi_ctx {
30         char *debuglevel;
31         char *error_string;
32         char *username;
33         char *workgroup;
34         char *password;
35         char *krb5_cc_env;
36 };
37
38 /****************************************************************
39 ****************************************************************/
40
41 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
42 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
43 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
44 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
45 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
46 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
47 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
48 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
49 const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status);
50 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string);
51 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx);
52
53 /****************************************************************
54 ****************************************************************/
55
56 NET_API_STATUS NetApiBufferFree(void *buffer);
57
58 /****************************************************************
59 ****************************************************************/
60
61 /* wkssvc */
62 NET_API_STATUS NetJoinDomain(const char *server,
63                              const char *domain,
64                              const char *account_ou,
65                              const char *account,
66                              const char *password,
67                              uint32_t join_options);
68 NET_API_STATUS NetUnjoinDomain(const char *server_name,
69                                const char *account,
70                                const char *password,
71                                uint32_t unjoin_flags);
72 NET_API_STATUS NetGetJoinInformation(const char *server_name,
73                                      const char **name_buffer,
74                                      uint16_t *name_type);
75
76 /* srvsvc */
77 NET_API_STATUS NetServerGetInfo(const char *server_name,
78                                 uint32_t level,
79                                 uint8_t **buffer);
80 NET_API_STATUS NetServerSetInfo(const char *server_name,
81                                 uint32_t level,
82                                 uint8_t *buffer,
83                                 uint32_t *parm_error);
84
85 /* netlogon */
86 NET_API_STATUS NetGetDCName(const char *server_name,
87                             const char *domain_name,
88                             uint8_t **buffer);
89 NET_API_STATUS NetGetAnyDCName(const char *server_name,
90                                const char *domain_name,
91                                uint8_t **buffer);
92
93 #endif