dsdb: use the correct talloc parent in dsdb_repl_merge_working_schema()
[obnox/samba/samba-obnox.git] / lib / async_req / async_sock.h
1 /*
2    Unix SMB/CIFS implementation.
3    async socket operations
4    Copyright (C) Volker Lendecke 2008
5
6      ** NOTE! The following LGPL license applies to the async_sock
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 __ASYNC_SOCK_H__
25 #define __ASYNC_SOCK_H__
26
27 #include <talloc.h>
28 #include <tevent.h>
29 #include "system/network.h"
30
31 struct tevent_req *sendto_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
32                                int fd, const void *buf, size_t len, int flags,
33                                const struct sockaddr_storage *addr);
34 ssize_t sendto_recv(struct tevent_req *req, int *perrno);
35
36 struct tevent_req *recvfrom_send(TALLOC_CTX *mem_ctx,
37                                  struct tevent_context *ev,
38                                  int fd, void *buf, size_t len, int flags,
39                                  struct sockaddr_storage *addr,
40                                  socklen_t *addr_len);
41 ssize_t recvfrom_recv(struct tevent_req *req, int *perrno);
42
43 struct tevent_req *async_connect_send(
44         TALLOC_CTX *mem_ctx, struct tevent_context *ev, int fd,
45         const struct sockaddr *address, socklen_t address_len,
46         void (*before_connect)(void *private_data),
47         void (*after_connect)(void *private_data),
48         void *private_data);
49 int async_connect_recv(struct tevent_req *req, int *perrno);
50
51 struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
52                                struct tevent_queue *queue, int fd,
53                                bool err_on_readability,
54                                struct iovec *iov, int count);
55 ssize_t writev_recv(struct tevent_req *req, int *perrno);
56
57 struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
58                                     struct tevent_context *ev,
59                                     int fd, size_t initial,
60                                     ssize_t (*more)(uint8_t *buf,
61                                                     size_t buflen,
62                                                     void *private_data),
63                                     void *private_data);
64 ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
65                          uint8_t **pbuf, int *perrno);
66
67 struct tevent_req *wait_for_read_send(TALLOC_CTX *mem_ctx,
68                                       struct tevent_context *ev,
69                                       int fd);
70 bool wait_for_read_recv(struct tevent_req *req, int *perr);
71
72 #endif