1 /* assuan-io.c - Wraps the read and write functions.
2  * Copyright (C) 2002, 2004, 2006-2009 Free Software Foundation, Inc.
3  *
4  * This file is part of Assuan.
5  *
6  * Assuan is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * Assuan is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
18  * SPDX-License-Identifier: LGPL-2.1+
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 
25 #include <time.h>
26 #ifdef HAVE_SYS_TIME_H
27 # include <sys/time.h>
28 #endif
29 #ifdef HAVE_SYS_TYPES_H
30 # include <sys/types.h>
31 #endif
32 #ifdef HAVE_SYS_SOCKET_H
33 # include <sys/socket.h>
34 #endif
35 #ifdef HAVE_UNISTD_H
36 # include <unistd.h>
37 #endif
38 #include <errno.h>
39 #ifdef HAVE_W32_SYSTEM
40 # ifdef HAVE_WINSOCK2_H
41 #  include <winsock2.h>
42 # endif
43 # include <windows.h>
44 #else
45 # include <sys/wait.h>
46 #endif
47 
48 #include "assuan-defs.h"
49 
50 
51 ssize_t
_assuan_simple_read(assuan_context_t ctx,void * buffer,size_t size)52 _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
53 {
54   return _assuan_read (ctx, ctx->inbound.fd, buffer, size);
55 }
56 
57 
58 ssize_t
_assuan_simple_write(assuan_context_t ctx,const void * buffer,size_t size)59 _assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size)
60 {
61   return _assuan_write (ctx, ctx->outbound.fd, buffer, size);
62 }
63