lib:talloc. Fix memory leak when destructors reparent children.
[Samba.git] / lib / async_req / async_sock.h
blobabbf822228db3163845e052b49853ddc29c090bd
1 /*
2 Unix SMB/CIFS implementation.
3 async socket operations
4 Copyright (C) Volker Lendecke 2008
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
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.
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.
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/>.
24 #ifndef __ASYNC_SOCK_H__
25 #define __ASYNC_SOCK_H__
27 #include <talloc.h>
28 #include <tevent.h>
29 #include "system/network.h"
31 struct tevent_req *async_connect_send(
32 TALLOC_CTX *mem_ctx, struct tevent_context *ev, int fd,
33 const struct sockaddr *address, socklen_t address_len,
34 void (*before_connect)(void *private_data),
35 void (*after_connect)(void *private_data),
36 void *private_data);
37 int async_connect_recv(struct tevent_req *req, int *perrno);
39 struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
40 struct tevent_queue *queue, int fd,
41 bool err_on_readability,
42 struct iovec *iov, int count);
43 ssize_t writev_recv(struct tevent_req *req, int *perrno);
45 struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
46 struct tevent_context *ev,
47 int fd, size_t initial,
48 ssize_t (*more)(uint8_t *buf,
49 size_t buflen,
50 void *private_data),
51 void *private_data);
52 ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
53 uint8_t **pbuf, int *perrno);
55 struct tevent_req *wait_for_read_send(TALLOC_CTX *mem_ctx,
56 struct tevent_context *ev, int fd,
57 bool check_errors);
58 bool wait_for_read_recv(struct tevent_req *req, int *perr);
60 #endif