aboutsummaryrefslogtreecommitdiff
path: root/src/lib/net/buffers_net.h
blob: a45c23a2735f3b90fd3915db138e717efc64c60e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Copyright (c) 2001 Matej Pfajfar.
 * Copyright (c) 2001-2004, Roger Dingledine.
 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 * Copyright (c) 2007-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file buffers_net.h
 *
 * \brief Header file for buffers_net.c.
 **/

#ifndef TOR_BUFFERS_NET_H
#define TOR_BUFFERS_NET_H

#include <stddef.h>
#include "lib/net/socket.h"

struct buf_t;
int buf_read_from_socket(struct buf_t *buf, tor_socket_t s, size_t at_most,
                         int *reached_eof,
                         int *socket_error);

int buf_flush_to_socket(struct buf_t *buf, tor_socket_t s, size_t sz,
                        size_t *buf_flushlen);

int buf_read_from_pipe(struct buf_t *buf, int fd, size_t at_most,
                       int *reached_eof,
                       int *socket_error);

int buf_flush_to_pipe(struct buf_t *buf, int fd, size_t sz,
                      size_t *buf_flushlen);

#endif /* !defined(TOR_BUFFERS_NET_H) */