s3-torture/nbio.c: Fix cli_errstr() usage (part of bug #7864)
[ira/wip.git] / source3 / torture / wbc_async.h
1 /*
2    Unix SMB/CIFS implementation.
3    Headers for the async winbind client library
4    Copyright (C) Volker Lendecke 2008
5
6      ** NOTE! The following LGPL license applies to the wbclient
7      ** library. This does NOT imply that all of Samba is released
8      ** under the LGPL
9
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Lesser General Public
12    License as published by the Free Software Foundation; either
13    version 3 of the License, or (at your option) any later version.
14
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Library General Public License for more details.
19
20    You should have received a copy of the GNU Lesser General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #ifndef _WBC_ASYNC_H_
25 #define _WBC_ASYNC_H_
26
27 #include <talloc.h>
28 #include <tevent.h>
29 #include "nsswitch/libwbclient/wbclient.h"
30 #include "nsswitch/wb_reqtrans.h"
31
32 struct wb_context;
33 struct winbindd_request;
34 struct winbindd_response;
35
36 enum wbcDebugLevel {
37         WBC_DEBUG_FATAL,
38         WBC_DEBUG_ERROR,
39         WBC_DEBUG_WARNING,
40         WBC_DEBUG_TRACE
41 };
42
43 struct tevent_req *wb_trans_send(TALLOC_CTX *mem_ctx,
44                                  struct tevent_context *ev,
45                                  struct wb_context *wb_ctx, bool need_priv,
46                                  struct winbindd_request *wb_req);
47 wbcErr wb_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
48                      struct winbindd_response **presponse);
49 struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx, const char* dir);
50 int wbcSetDebug(struct wb_context *wb_ctx,
51                 void (*debug)(void *context,
52                               enum wbcDebugLevel level,
53                               const char *fmt,
54                               va_list ap) PRINTF_ATTRIBUTE(3,0),
55                 void *context);
56 int wbcSetDebugStderr(struct wb_context *wb_ctx);
57 void wbcDebug(struct wb_context *wb_ctx, enum wbcDebugLevel level,
58               const char *fmt, ...) PRINTF_ATTRIBUTE(3,0);
59
60 /* Definitions from wb_reqtrans.c */
61 wbcErr map_wbc_err_from_errno(int error);
62
63 bool tevent_req_is_wbcerr(struct tevent_req *req, wbcErr *pwbc_err);
64 wbcErr tevent_req_simple_recv_wbcerr(struct tevent_req *req);
65
66 /* Async functions from wbc_idmap.c */
67
68 struct tevent_req *wbcSidToUid_send(TALLOC_CTX *mem_ctx,
69                                     struct tevent_context *ev,
70                                     struct wb_context *wb_ctx,
71                                     const struct wbcDomainSid *sid);
72 wbcErr wbcSidToUid_recv(struct tevent_req *req, uid_t *puid);
73
74 struct tevent_req *wbcUidToSid_send(TALLOC_CTX *mem_ctx,
75                                     struct tevent_context *ev,
76                                     struct wb_context *wb_ctx,
77                                     uid_t uid);
78 wbcErr wbcUidToSid_recv(struct tevent_req *req, struct wbcDomainSid *psid);
79
80 struct tevent_req *wbcSidToGid_send(TALLOC_CTX *mem_ctx,
81                                     struct tevent_context *ev,
82                                     struct wb_context *wb_ctx,
83                                     const struct wbcDomainSid *sid);
84 wbcErr wbcSidToGid_recv(struct tevent_req *req, gid_t *pgid);
85
86 struct tevent_req *wbcGidToSid_send(TALLOC_CTX *mem_ctx,
87                                     struct tevent_context *ev,
88                                     struct wb_context *wb_ctx,
89                                     gid_t gid);
90 wbcErr wbcGidToSid_recv(struct tevent_req *req, struct wbcDomainSid *psid);
91
92 /* Async functions from wbc_pam.c */
93 struct tevent_req *wbcAuthenticateUserEx_send(TALLOC_CTX *mem_ctx,
94                                         struct tevent_context *ev,
95                                         struct wb_context *wb_ctx,
96                                         const struct wbcAuthUserParams *params);
97 wbcErr wbcAuthenticateUserEx_recv(struct tevent_req *req,
98                                   TALLOC_CTX *mem_ctx,
99                                   struct wbcAuthUserInfo **info,
100                                   struct wbcAuthErrorInfo **error);
101
102 /* Async functions from wbc_sid.c */
103 struct tevent_req *wbcLookupName_send(TALLOC_CTX *mem_ctx,
104                                       struct tevent_context *ev,
105                                       struct wb_context *wb_ctx,
106                                       const char *domain,
107                                       const char *name);
108 wbcErr wbcLookupName_recv(struct tevent_req *req,
109                           struct wbcDomainSid *sid,
110                           enum wbcSidType *name_type);
111 struct tevent_req *wbcLookupSid_send(TALLOC_CTX *mem_ctx,
112                                      struct tevent_context *ev,
113                                      struct wb_context *wb_ctx,
114                                      const struct wbcDomainSid *sid);
115 wbcErr wbcLookupSid_recv(struct tevent_req *req,
116                          TALLOC_CTX *mem_ctx,
117                          char **pdomain,
118                          char **pname,
119                          enum wbcSidType *pname_type);
120
121 /* Async functions from wbc_util.c */
122
123 struct tevent_req *wbcPing_send(TALLOC_CTX *mem_ctx,
124                                struct tevent_context *ev,
125                                struct wb_context *wb_ctx);
126 wbcErr wbcPing_recv(struct tevent_req *req);
127
128 struct tevent_req *wbcInterfaceVersion_send(TALLOC_CTX *mem_ctx,
129                                             struct tevent_context *ev,
130                                             struct wb_context *wb_ctx);
131 wbcErr wbcInterfaceVersion_recv(struct tevent_req *req,
132                                 uint32_t *interface_version);
133
134 struct tevent_req *wbcInfo_send(TALLOC_CTX *mem_ctx,
135                                 struct tevent_context *ev,
136                                 struct wb_context *wb_ctx);
137 wbcErr wbcInfo_recv(struct tevent_req *req,
138                     TALLOC_CTX *mem_ctx,
139                     char *winbind_separator,
140                     char **version_string);
141
142 struct tevent_req *wbcNetbiosName_send(TALLOC_CTX *mem_ctx,
143                                        struct tevent_context *ev,
144                                        struct wb_context *wb_ctx);
145 wbcErr wbcNetbiosName_recv(struct tevent_req *req,
146                            TALLOC_CTX *mem_ctx,
147                            char **netbios_name);
148
149 struct tevent_req *wbcDomainName_send(TALLOC_CTX *mem_ctx,
150                                       struct tevent_context *ev,
151                                       struct wb_context *wb_ctx);
152 wbcErr wbcDomainName_recv(struct tevent_req *req,
153                           TALLOC_CTX *mem_ctx,
154                           char **netbios_name);
155
156 struct tevent_req *wbcInterfaceDetails_send(TALLOC_CTX *mem_ctx,
157                                             struct tevent_context *ev,
158                                             struct wb_context *wb_ctx);
159 wbcErr wbcInterfaceDetails_recv(struct tevent_req *req,
160                                 TALLOC_CTX *mem_ctx,
161                                 struct wbcInterfaceDetails **details);
162
163 struct tevent_req *wbcDomainInfo_send(TALLOC_CTX *mem_ctx,
164                                       struct tevent_context *ev,
165                                       struct wb_context *wb_ctx,
166                                       const char *domain);
167 wbcErr wbcDomainInfo_recv(struct tevent_req *req,
168                           TALLOC_CTX *mem_ctx,
169                           struct wbcDomainInfo **dinfo);
170
171 #endif /*_WBC_ASYNC_H_*/