Kea: fd.h Source File

| Kea 3.0.2-git

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
16
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
34 write_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
47 read_data(const int fd, void *buffer, const size_t length);
48
49}
50}
51}
52
53#endif // UTIL_IO_FD_H
isc::util::io
Definition fd.cc:16
isc::util::io::read_data
ssize_t read_data(const int fd, void *buffer_v, const size_t length)
Definition fd.cc:50
isc::util::io::write_data
bool write_data(const int fd, const void *buffer_v, const size_t length)
Definition fd.cc:19
isc::util
Definition time_utils.cc:43
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148