Add more conventional async_recv
[Samba.git] / lib / async_req / async_sock.h
blobbfc4346d39a03b52753efdcb52429c167da596eb
1 /*
2 Unix SMB/CIFS implementation.
3 async socket operations
4 Copyright (C) Volker Lendecke 2008
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.
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.
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/>.
20 #ifndef __ASYNC_SOCK_H__
21 #define __ASYNC_SOCK_H__
23 #include "includes.h"
25 bool async_req_is_errno(struct async_req *req, int *err);
26 int async_req_simple_recv_errno(struct async_req *req);
28 ssize_t async_syscall_result_ssize_t(struct async_req *req, int *perrno);
29 size_t async_syscall_result_size_t(struct async_req *req, int *perrno);
30 int async_syscall_result_int(struct async_req *req, int *perrno);
32 struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
33 int fd, const void *buffer, size_t length,
34 int flags);
35 struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
36 int fd, void *buffer, size_t length,
37 int flags);
39 struct tevent_req *async_send_send(TALLOC_CTX *mem_ctx,
40 struct tevent_context *ev,
41 int fd, const void *buf, size_t len,
42 int flags);
43 ssize_t async_send_recv(struct tevent_req *req, int *perrno);
45 struct tevent_req *async_recv_send(TALLOC_CTX *mem_ctx,
46 struct tevent_context *ev,
47 int fd, void *buf, size_t len, int flags);
48 ssize_t async_recv_recv(struct tevent_req *req, int *perrno);
50 struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx,
51 struct tevent_context *ev,
52 int fd, const struct sockaddr *address,
53 socklen_t address_len);
54 int async_connect_recv(struct tevent_req *req, int *perrno);
56 struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
57 int fd, struct iovec *iov, int count);
58 ssize_t writev_recv(struct tevent_req *req, int *perrno);
60 struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
61 struct tevent_context *ev,
62 int fd, size_t initial,
63 ssize_t (*more)(uint8_t *buf,
64 size_t buflen,
65 void *private_data),
66 void *private_data);
67 ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
68 uint8_t **pbuf, int *perrno);
70 #endif