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