96c5f8c3486964413f131dfb3727453938a14572
[samba.git] / source3 / include / 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 "nsswitch/libwbclient/wbclient.h"
28
29 struct wb_context;
30
31 struct tevent_req *wb_trans_send(TALLOC_CTX *mem_ctx,
32                                  struct tevent_context *ev,
33                                  struct wb_context *wb_ctx, bool need_priv,
34                                  struct winbindd_request *wb_req);
35 wbcErr wb_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
36                      struct winbindd_response **presponse);
37 struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx);
38
39 /* Definitions from wb_reqtrans.c */
40 wbcErr map_wbc_err_from_errno(int error);
41
42 bool tevent_req_is_wbcerr(struct tevent_req *req, wbcErr *pwbc_err);
43 wbcErr tevent_req_simple_recv_wbcerr(struct tevent_req *req);
44
45 struct tevent_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
46                                     struct tevent_context *ev,
47                                     int fd, size_t max_extra_data);
48 ssize_t wb_req_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
49                          struct winbindd_request **preq, int *err);
50
51 struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
52                                      struct tevent_context *ev,
53                                      struct tevent_queue *queue, int fd,
54                                      struct winbindd_request *wb_req);
55 ssize_t wb_req_write_recv(struct tevent_req *req, int *err);
56
57 struct tevent_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
58                                      struct tevent_context *ev, int fd);
59 ssize_t wb_resp_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
60                           struct winbindd_response **presp, int *err);
61
62 struct tevent_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
63                                       struct tevent_context *ev,
64                                       struct tevent_queue *queue, int fd,
65                                       struct winbindd_response *wb_resp);
66 ssize_t wb_resp_write_recv(struct tevent_req *req, int *err);
67
68 struct tevent_req *wb_simple_trans_send(TALLOC_CTX *mem_ctx,
69                                         struct tevent_context *ev,
70                                         struct tevent_queue *queue, int fd,
71                                         struct winbindd_request *wb_req);
72 int wb_simple_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
73                          struct winbindd_response **presponse, int *err);
74
75 #endif /*_WBC_ASYNC_H_*/