Restructure inner workings of libnetapi a bit.
[samba.git] / source / 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 struct libnetapi_ctx {
35         char *debuglevel;
36         char *error_string;
37         char *username;
38         char *workgroup;
39         char *password;
40         char *krb5_cc_env;
41 };
42
43 /****************************************************************
44 ****************************************************************/
45
46 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
47 NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
48 NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
49 NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
50 NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
51 NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
52 NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
53 NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
54 const char *libnetapi_errstr(NET_API_STATUS status);
55 NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
56 const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status);
57
58
59 /****************************************************************
60  NetApiBufferFree
61 ****************************************************************/
62
63 NET_API_STATUS NetApiBufferFree(void *buffer);
64
65 /****************************************************************
66  NetJoinDomain
67 ****************************************************************/
68
69 NET_API_STATUS NetJoinDomain(const char * server /* [in] */,
70                              const char * domain /* [in] [ref] */,
71                              const char * account_ou /* [in] */,
72                              const char * account /* [in] */,
73                              const char * password /* [in] */,
74                              uint32_t join_flags /* [in] */);
75
76 /****************************************************************
77  NetUnjoinDomain
78 ****************************************************************/
79
80 NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] */,
81                                const char * account /* [in] */,
82                                const char * password /* [in] */,
83                                uint32_t unjoin_flags /* [in] */);
84
85 /****************************************************************
86  NetGetJoinInformation
87 ****************************************************************/
88
89 NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] */,
90                                      const char * *name_buffer /* [out] [ref] */,
91                                      uint16_t *name_type /* [out] [ref] */);
92
93 /****************************************************************
94  NetGetJoinableOUs
95 ****************************************************************/
96
97 NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] */,
98                                  const char * domain /* [in] [ref] */,
99                                  const char * account /* [in] */,
100                                  const char * password /* [in] */,
101                                  uint32_t *ou_count /* [out] [ref] */,
102                                  const char * **ous /* [out] [ref] */);
103
104 /****************************************************************
105  NetServerGetInfo
106 ****************************************************************/
107
108 NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] */,
109                                 uint32_t level /* [in] */,
110                                 uint8_t **buffer /* [out] [ref] */);
111
112 /****************************************************************
113  NetServerSetInfo
114 ****************************************************************/
115
116 NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] */,
117                                 uint32_t level /* [in] */,
118                                 uint8_t *buffer /* [in] [ref] */,
119                                 uint32_t *parm_error /* [out] [ref] */);
120
121 /****************************************************************
122  NetGetDCName
123 ****************************************************************/
124
125 NET_API_STATUS NetGetDCName(const char * server_name /* [in] */,
126                             const char * domain_name /* [in] */,
127                             uint8_t **buffer /* [out] [ref] */);
128
129 /****************************************************************
130  NetGetAnyDCName
131 ****************************************************************/
132
133 NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] */,
134                                const char * domain_name /* [in] */,
135                                uint8_t **buffer /* [out] [ref] */);
136
137 #endif