Kea 2.5.8
fd.h
Go to the documentation of this file.
1// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef UTIL_IO_FD_H
8#define UTIL_IO_FD_H 1
9
10#include <unistd.h>
11
17namespace isc {
18namespace util {
19namespace io {
20
21/*
22 * \short write() that writes everything.
23 * Wrapper around write(). The difference is, it never writes less data
24 * and looks successful (eg. it blocks until all data are written).
25 * Retries on signals.
26 *
27 * \return True if successful, false otherwise. The errno variable is left
28 * intact.
29 * \param fd Where to write.
30 * \param data The buffer to write.
31 * \param length How much data is there to write.
32 */
33bool
34write_data(const int fd, const void *data, const size_t length);
35
36/*
37 * \short read() that reads everything.
38 * Wrapper around read(). It does not do short reads, if it returns less,
39 * it means there was EOF. It retries on signals.
40 *
41 * \return Number of bytes read or -1 on error.
42 * \param fd Where to read data from.
43 * \param data Where to put the data.
44 * \param length How many of them.
45 */
46ssize_t
47read_data(const int fd, void *buffer, const size_t length);
48
49}
50}
51}
52
53#endif // UTIL_IO_FD_H
ssize_t read_data(const int fd, void *buffer_v, const size_t length)
Definition: fd.cc:50
bool write_data(const int fd, const void *buffer_v, const size_t length)
Definition: fd.cc:19
Defines the logger used by the top-level component of kea-lfc.