Merge branch 'sharedm4' of /home/jelmer/samba4
[ira/wip.git] / source3 / include / wbc_async.h
1 /*
2    Unix SMB/CIFS implementation.
3    Headers for the async winbind client library
4    Copyright (C) Kai Blin 2009
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 _WBC_ASYNC_H_
21 #define _WBC_ASYNC_H_
22
23 #include "nsswitch/libwbclient/wbclient.h"
24
25 struct wb_context {
26         struct async_req_queue *queue;
27         int fd;
28         bool is_priv;
29 };
30
31 struct async_req *wb_trans_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
32                                 struct wb_context *wb_ctx, bool need_priv,
33                                 struct winbindd_request *wb_req);
34 wbcErr wb_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
35                      struct winbindd_response **presponse);
36 struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx);
37
38 /* Definitions from wb_reqtrans.c */
39 bool async_req_is_wbcerr(struct async_req *req, wbcErr *pwbc_err);
40 wbcErr map_wbc_err_from_errno(int error);
41 wbcErr async_req_simple_recv_wbcerr(struct async_req *req);
42
43 bool tevent_req_is_wbcerr(struct tevent_req *req, wbcErr *pwbc_err);
44 wbcErr tevent_req_simple_recv_wbcerr(struct tevent_req *req);
45
46 struct tevent_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
47                                     struct tevent_context *ev,
48                                     int fd, size_t max_extra_data);
49 wbcErr wb_req_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
50                         struct winbindd_request **preq);
51
52 struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
53                                      struct tevent_context *ev,
54                                      struct tevent_queue *queue, int fd,
55                                      struct winbindd_request *wb_req);
56 wbcErr wb_req_write_recv(struct tevent_req *req);
57
58 struct tevent_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
59                                      struct tevent_context *ev, int fd);
60 wbcErr wb_resp_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
61                          struct winbindd_response **presp);
62
63 struct tevent_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
64                                       struct tevent_context *ev,
65                                       struct tevent_queue *queue, int fd,
66                                       struct winbindd_response *wb_resp);
67 wbcErr wb_resp_write_recv(struct tevent_req *req);
68
69 #endif /*_WBC_ASYNC_H_*/