2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[#3320] minor changes

This commit is contained in:
Razvan Becheriu 2024-04-17 10:54:46 +03:00
parent 0f71c39365
commit da95be459b
51 changed files with 313 additions and 313 deletions

View File

@ -1,10 +1,10 @@
SUBDIRS = . tests
SUBDIRS = . tests // @todo - please update
// @todo - please update
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += $(BOOST_INCLUDES) // @todo - please update
// @todo - please update
AM_CXXFLAGS = $(KEA_CXXFLAGS)
// @todo - please update
CLEANFILES = *.gcno *.gcda
EXTRA_DIST = asiodns_messages.mes

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
$NAMESPACE isc::asiodns
$NAMESPACE isc::asiodns // @todo - please update
% ASIODNS_FD_ADD_TCP adding a new TCP server by opened fd %1
A debug message informing about installing a file descriptor as a server.

View File

@ -21,7 +21,7 @@
#include <cryptolink/crypto_rng.h>
#include <dns/rcode.h>
#include <util/io.h>
// @todo - please update
#include <boost/scoped_ptr.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
@ -31,7 +31,7 @@
#include <stdint.h>
#include <sys/socket.h>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
using namespace isc::dns;
using namespace isc::log;
using namespace isc::util;
@ -39,8 +39,8 @@ using namespace isc::util;
using namespace boost::asio;
using namespace std;
namespace isc {
namespace asiodns {
namespace isc { // @todo - please update
namespace asiodns { // @todo - please update
// Log debug verbosity.
@ -167,9 +167,9 @@ IOFetch::IOFetch(Protocol protocol, const IOServicePtr& service,
initIOFetch(question, protocol, service, **(query_message->beginQuestion()), address,
port, buff, cb, wait);
}
void
} // @todo - please update
// @todo - please update
void // @todo - please update
IOFetch::initIOFetch(MessagePtr& query, Protocol protocol, const IOServicePtr& service,
const isc::dns::Question& question, const IOAddress& address, uint16_t port,
OutputBufferPtr& buff, Callback* cb, int wait, bool edns) {
@ -190,8 +190,8 @@ IOFetch::initIOFetch(MessagePtr& query, Protocol protocol, const IOServicePtr& s
r.setBuffer(data_->msgbuf.get());
query->toWire(r);
r.setBuffer(NULL);
}
} // @todo - please update
// @todo - please update
IOFetch::Protocol
IOFetch::getProtocol() const {
return (data_->protocol);

View File

@ -18,9 +18,9 @@
#include <ext/coroutine/coroutine.hpp>
#endif
#include <asiolink/io_address.h>
#include <asiolink/io_address.h> // @todo - please update
#include <asiolink/io_service.h>
#include <dns/message.h>
#include <dns/message.h> // @todo - please update
#include <dns/question.h>
#include <util/buffer.h>
@ -29,8 +29,8 @@
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/system/error_code.hpp>
namespace isc {
namespace asiodns {
namespace isc { // @todo - please update
namespace asiodns { // @todo - please update
// Forward declarations
struct IOFetchData;
@ -136,7 +136,7 @@ public:
bool edns = true);
/// @brief Constructor
///
/// // @todo - please update
/// This constructor has one parameter "query_message", which is the shared_ptr
/// to a full query message. It's different with above constructor which has only
/// question section. All other parameters are the same.
@ -163,7 +163,7 @@ public:
isc::util::OutputBufferPtr& buff,
Callback* cb,
int wait = -1);
// @todo - please update
/// @brief Constructor.
///
/// Creates the object that will handle the upstream fetch.
@ -237,7 +237,7 @@ private:
isc::util::OutputBufferPtr& buff,
Callback* cb, int wait,
bool edns = true);
// @todo - please update
/// @brief Log I/O Failure.
///
/// Records an I/O failure to the log file.

View File

@ -1,24 +1,24 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib // @todo - please update
AM_CPPFLAGS += $(BOOST_INCLUDES) // @todo - please update
// @todo - please update
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
CLEANFILES = *.gcno *.gcda
// @todo - please update
if USE_STATIC_LINK // @todo - please update
AM_LDFLAGS = -static // @todo - please update
endif // @todo - please update
// @todo - please update
CLEANFILES = *.gcno *.gcda // @todo - please update
// @todo - please update
TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
run_unittests_SOURCES = run_unittests.cc
run_unittests_SOURCES += io_fetch_unittest.cc
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
TESTS = // @todo - please update
if HAVE_GTEST // @todo - please update
TESTS += run_unittests // @todo - please update
run_unittests_SOURCES = run_unittests.cc // @todo - please update
run_unittests_SOURCES += io_fetch_unittest.cc // @todo - please update
// @todo - please update
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) // @todo - please update
// @todo - please update
run_unittests_LDADD = $(top_builddir)/src/lib/asiodns/libkea-asiodns.la
run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
run_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
@ -29,14 +29,14 @@ run_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
run_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
run_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD)
// @todo - please update
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS)
// @todo - please update
# Note: the ordering matters: -Wno-... must follow -Wextra (defined in KEA_CXXFLAGS)
run_unittests_CXXFLAGS = $(AM_CXXFLAGS)
if USE_GXX
run_unittests_CXXFLAGS += -Wno-unused-parameter
endif
endif
run_unittests_CXXFLAGS = $(AM_CXXFLAGS) // @todo - please update
if USE_GXX // @todo - please update
run_unittests_CXXFLAGS += -Wno-unused-parameter // @todo - please update
endif // @todo - please update
endif // @todo - please update
// @todo - please update
noinst_PROGRAMS = $(TESTS)

View File

@ -33,7 +33,7 @@
using namespace isc::asiolink;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::util; // @todo - please update
using namespace boost::asio;
using namespace boost::asio::ip;
@ -41,8 +41,8 @@ using namespace std;
namespace ph = std::placeholders;
namespace isc {
namespace asiodns {
namespace isc { // @todo - please update
namespace asiodns { // @todo - please update
const boost::asio::ip::address TEST_HOST(boost::asio::ip::address::from_string("127.0.0.1"));
const uint16_t TEST_PORT(5301);

View File

@ -1,19 +1,19 @@
// Copyright (C) 2009-2015 Internet Systems Consortium, Inc. ("ISC")
//
// // @todo - please update
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// @todo - please update
#include <config.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h> // @todo - please update
// @todo - please update
#include <util/unittests/run_all.h>
#include <log/logger_support.h>
int
// @todo - please update
int // @todo - please update
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
isc::log::initLogger();
return (isc::util::unittests::run_all());
}
} // @todo - please update

View File

@ -13,7 +13,7 @@
#include <boost/asio/error.hpp>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief Asynchronous I/O Completion Callback

View File

@ -22,7 +22,7 @@
using namespace std;
namespace ph = std::placeholders;
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// This class holds a call back function of asynchronous operations.

View File

@ -12,7 +12,7 @@
#include <asiolink/io_service.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
class IntervalTimerImpl;

View File

@ -25,7 +25,7 @@ using boost::asio::ip::tcp;
using namespace std;
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
size_t

View File

@ -20,7 +20,7 @@
#include <exceptions/exceptions.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// Defines length of IPv6 address (in binary format).

View File

@ -32,7 +32,7 @@
#include <boost/asio/coroutine.hpp>
#endif
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief Socket not open

View File

@ -21,7 +21,7 @@
using namespace std;
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
const IOEndpoint*

View File

@ -23,7 +23,7 @@
#include <sys/socket.h> // for sockaddr
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief The \c IOEndpoint class is an abstract base class to represent

View File

@ -10,7 +10,7 @@
#include <exceptions/exceptions.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief An exception that is thrown if an error occurs within the IO

View File

@ -14,7 +14,7 @@
#include <boost/shared_ptr.hpp>
#include <sys/socket.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
class IOServiceImpl {

View File

@ -22,7 +22,7 @@ namespace asio {
}
}
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
class IOServiceImpl;

View File

@ -8,7 +8,7 @@
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_socket.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief The \c DummySocket class is a concrete derived class of

View File

@ -17,7 +17,7 @@
#include <exceptions/exceptions.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief The \c IOSocket class is an abstract base class to represent

View File

@ -13,7 +13,7 @@
#include <asiolink/io_endpoint.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief The \c TCPEndpoint class is a concrete derived class of

View File

@ -28,7 +28,7 @@
#include <sys/socket.h>
#include <unistd.h> // for some IPC/network system calls
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief Buffer Too Large

View File

@ -17,7 +17,7 @@
#include <sstream>
#include <unordered_set>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
TEST(IOAddressHashTest, hashIPv4) {
IOAddress::Hash hash;

View File

@ -21,7 +21,7 @@
#include <netdb.h>
#include <string.h>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
namespace {
typedef boost::shared_ptr<const IOEndpoint> ConstIOEndpointPtr;

View File

@ -11,7 +11,7 @@
#include <gtest/gtest.h>
#include <netinet/in.h>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
TEST(IOSocketTest, dummySockets) {
EXPECT_EQ(static_cast<short>(IPPROTO_UDP),

View File

@ -13,7 +13,7 @@
#include <string>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
using namespace std;
// This test checks that the endpoint can manage its own internal

View File

@ -32,7 +32,7 @@
#include <string>
#include <vector>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
using namespace isc::util;
using namespace std;

View File

@ -13,7 +13,7 @@
#include <string>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
using namespace std;
// This test checks that the endpoint can manage its own internal

View File

@ -32,7 +32,7 @@
#include <vector>
using namespace isc::asiolink;
using namespace isc::asiolink; // @todo - please update
using namespace isc::util;
using namespace boost::asio;

View File

@ -13,7 +13,7 @@
#include <asiolink/io_endpoint.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief The \c UDPEndpoint class is a concrete derived class of

View File

@ -24,7 +24,7 @@
#include <exceptions/isc_assert.h>
namespace isc {
namespace isc { // @todo - please update
namespace asiolink {
/// \brief The \c UDPSocket class is a concrete derived class of \c IOAsioSocket

View File

@ -54,7 +54,7 @@ libkea_dns___la_LIBADD = $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.l
libkea_dns___la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
libkea_dns___la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_dns___la_LIBADD += $(CRYPTO_LIBS)
// @todo - please update
# The following files used to be generated, but they are now part of the git tree:
# rrclass.h rrtype.h rrparamregistry.cc rdataclass.h rdataclass.cc
libkea_dns___la_SOURCES += rdataclass.h rrclass.h rrtype.h

View File

@ -33,7 +33,7 @@
#include <boost/shared_ptr.hpp>
using namespace isc::dns::rdata;
using namespace isc::util;
using namespace isc::util; // @todo - please update
using namespace std;
using boost::lexical_cast;

View File

@ -603,7 +603,7 @@ public:
/// NOTE: If the header has already been parsed by a previous call
/// to this method, this method simply returns (i.e., it does not
/// read from the \c buffer).
void parseHeader(isc::util::InputBuffer& buffer);
void parseHeader(isc::util::InputBuffer& buffer); // @todo - please update
/// \brief (Re)build a \c Message object from wire-format data.
///
@ -668,7 +668,7 @@ private:
/// that ongoing state information will not be lost if the object
/// that originated the asynchronous call falls out of scope.
typedef boost::shared_ptr<Message> MessagePtr;
typedef boost::shared_ptr<const Message> ConstMessagePtr;
typedef boost::shared_ptr<const Message> ConstMessagePtr; // @todo - please update
/// Insert the \c Message as a string into stream.
///

View File

@ -20,9 +20,9 @@
#include <cassert>
#include <vector>
using namespace isc::util;
using namespace isc::util; // @todo - please update
using isc::dns::name::internal::maptolower;
// @todo - please update
using namespace std;
namespace isc {

View File

@ -19,7 +19,7 @@
#include <iostream>
#include <algorithm>
using namespace isc::util;
using namespace isc::util; // @todo - please update
using namespace isc::dns::name::internal;
using namespace std;

View File

@ -18,7 +18,7 @@
#include <dns/exceptions.h>
namespace isc {
namespace dns {
namespace dns { // @todo - please update
///
/// \brief A standard DNS module exception that is thrown if the name parser
/// encounters an empty label in the middle of a name.

View File

@ -16,7 +16,7 @@
#include <iostream>
#include <string>
using namespace isc::util;
using namespace isc::util; // @todo - please update
using namespace std;

View File

@ -19,7 +19,7 @@
#include <stdint.h>
namespace isc {
namespace dns {
namespace dns { // @todo - please update
class AbstractMessageRenderer;
class RRType;
class RRClass;

View File

@ -16,7 +16,7 @@
#include <string>
using namespace isc::dns;
using namespace isc::util;
using namespace isc::util; // @todo - please update
using namespace std;

View File

@ -21,7 +21,7 @@
#include <boost/shared_ptr.hpp>
using namespace isc::dns;
using namespace isc::util;
using namespace isc::util; // @todo - please update
using namespace isc::dns::rdata;
using namespace std;

View File

@ -21,7 +21,7 @@
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::util; // @todo - please update
namespace {

View File

@ -16,7 +16,7 @@
#include <string>
#include <ostream>
using namespace isc::util;
using namespace isc::util; // @todo - please update
using isc::dns::RRType;
using namespace std;

View File

@ -23,7 +23,7 @@
#include <util/filesystem.h>
#include <util/str.h>
// @todo - please update
#include <log/log_messages.h>
#include <log/message_dictionary.h>
#include <log/message_exception.h>

View File

@ -15,7 +15,7 @@
#include <log/logger_support.h>
#include <log/message_dictionary.h>
#include <log/message_types.h>
// @todo - please update
using namespace std;
namespace isc {

View File

@ -37,7 +37,7 @@
#include <log/message_types.h>
#include <log/interprocess/interprocess_sync_file.h>
#include <log/interprocess/interprocess_sync_null.h>
// @todo - please update
// Note: as log4cplus and the Kea logger have many concepts in common, and
// thus many similar names, to disambiguate types we don't "use" the log4cplus
// namespace: instead, all log4cplus types are explicitly qualified.

View File

@ -1,11 +1,11 @@
AUTOMAKE_OPTIONS = subdir-objects
SUBDIRS = . io unittests tests python
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
// @todo - please update
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib // @todo - please update
AM_CPPFLAGS += $(BOOST_INCLUDES) // @todo - please update
AM_CXXFLAGS = $(KEA_CXXFLAGS)
// @todo - please update
lib_LTLIBRARIES = libkea-util.la
libkea_util_la_SOURCES =
libkea_util_la_SOURCES += bigints.h
@ -41,7 +41,7 @@ libkea_util_la_SOURCES += watch_socket.cc watch_socket.h
libkea_util_la_SOURCES += watched_thread.cc watched_thread.h
libkea_util_la_SOURCES += encode/encode.cc encode/encode.h
libkea_util_la_SOURCES += encode/utf8.cc encode/utf8.h
// @todo - please update
libkea_util_la_LIBADD = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_util_la_LDFLAGS = -no-undefined -version-info 83:0:0

View File

@ -1,36 +1,36 @@
// Copyright (C) 2009-2024 Internet Systems Consortium, Inc. ("ISC")
//
// // @todo - please update
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// @todo - please update
#ifndef BUFFER_H
#define BUFFER_H
#include <exceptions/exceptions.h>
#include <boost/shared_ptr.hpp>
// @todo - please update
#include <exceptions/exceptions.h> // @todo - please update
// @todo - please update
#include <boost/shared_ptr.hpp> // @todo - please update
// @todo - please update
#include <cstring>
#include <stdint.h>
#include <stdlib.h>
#include <vector>
namespace isc {
namespace util {
namespace isc { // @todo - please update
namespace util { // @todo - please update
// @todo - please update
/// @brief The @c InputBuffer class is a buffer abstraction for
/// manipulating read-only data.
///
/// // @todo - please update
/// The main purpose of this class is to provide a safe placeholder
/// for examining wire-format data received from a network.
///
/// // @todo - please update
/// Applications normally use this class only in a limited situation:
/// as an interface between legacy I/O operation (such as receiving
/// data from a BSD socket) and the rest of the Kea DNS library. One
/// common usage of this class for an application would therefore be
/// something like this:
///
/// // @todo - please update
/// @code
/// unsigned char buf[1024];
/// struct sockaddr addr;
@ -39,11 +39,11 @@ namespace util {
/// InputBuffer buffer(buf, cc);
/// // pass the buffer to a DNS message object to parse the message
/// @endcode
///
/// // @todo - please update
/// Other Kea DNS classes will then use methods of this class to get
/// access to the data, but the application normally doesn't have to
/// care about the details.
///
/// // @todo - please update
/// An @c InputBuffer object internally holds a reference to the given
/// data, rather than make a local copy of the data. Also, it does
/// not have an ownership of the given data. It is application's
@ -54,7 +54,7 @@ namespace util {
/// reference to it, the result is undefined. The application will
/// also be responsible for releasing the data when it's not needed if
/// it was dynamically acquired.
///
/// // @todo - please update
/// This is a deliberate design choice: although it's safer to make a
/// local copy of the given data on construction, it would cause
/// unacceptable performance overhead, especially considering that a
@ -66,7 +66,7 @@ namespace util {
/// "read-only" stuff as a writable memory region. Since there
/// doesn't seem to be a perfect solution, we have adopted what we
/// thought a "least bad" one.
///
/// // @todo - please update
/// Methods for reading data from the buffer generally work like an
/// input stream: it begins with the head of the data, and once some
/// length of data is read from the buffer, the next read operation
@ -79,10 +79,10 @@ namespace util {
/// base_ at the initial state, current_ == end_ when the whole buffer
/// was read. Even the difference of two pointers is a std::ptrdiff_t
/// it is safe to cast to a size_t because of the inequality.
class InputBuffer {
public:
class InputBuffer { // @todo - please update
public: // @todo - please update
/// @brief Constructor.
///
/// // @todo - please update
/// It is caller's responsibility to ensure that the data is valid
/// as long as the buffer exists.
/// @param data A pointer to the data stored in the buffer.
@ -91,7 +91,7 @@ public:
: base_(static_cast<const uint8_t*>(data)), current_(base_),
end_(base_ + len) {
}
// @todo - please update
/// @brief Return the length of the data stored in the buffer.
size_t getLength() const {
return (static_cast<size_t>(end_ - base_));
@ -101,9 +101,9 @@ public:
size_t getPosition() const {
return (static_cast<size_t>(current_ - base_));
}
// @todo - please update
/// @brief Set the read position of the buffer to the given value.
///
/// // @todo - please update
/// The new position must be in the valid range of the buffer;
/// otherwise an exception of class @c isc::OutOfRange will be thrown.
///
@ -115,8 +115,8 @@ public:
"InputBuffer::setPosition position is too large");
}
current_ = base_ + position;
}
} // @todo - please update
// @todo - please update
/// @brief Peek an unsigned 8-bit integer from the buffer and return it.
///
/// If the remaining length of the buffer is smaller than 8-bit,
@ -131,7 +131,7 @@ public:
}
/// @brief Read an unsigned 8-bit integer from the buffer and return it.
///
/// // @todo - please update
/// If the remaining length of the buffer is smaller than 8-bit,
/// an exception of class @c isc::OutOfRange will be thrown.
uint8_t readUint8() {
@ -150,18 +150,18 @@ public:
if (current_ + sizeof(uint16_t) > end_) {
isc_throw(OutOfRange,
"InputBuffer::peekUint16 read beyond end of buffer");
}
} // @todo - please update
// @todo - please update
uint16_t ret;
ret = (static_cast<uint16_t>(current_[0])) << 8;
ret |= (static_cast<uint16_t>(current_[1]));
return (ret);
}
} // @todo - please update
/// @brief Read an unsigned 16-bit integer in network byte order
/// from the buffer, and return it.
///
/// // @todo - please update
/// If the remaining length of the buffer is smaller than 16-bit,
/// an exception of class @c isc::OutOfRange will be thrown.
uint16_t readUint16() {
@ -170,7 +170,7 @@ public:
return (ret);
}
// @todo - please update
/// @brief Read an unsigned 32-bit integer in network byte order
/// from the buffer, and return it.
///
@ -180,20 +180,20 @@ public:
if (current_ + sizeof(uint32_t) > end_) {
isc_throw(OutOfRange,
"InputBuffer::peekUint32 read beyond end of buffer");
}
} // @todo - please update
// @todo - please update
uint32_t ret;
ret = (static_cast<uint32_t>(current_[0])) << 24;
ret |= (static_cast<uint32_t>(current_[1])) << 16;
ret |= (static_cast<uint32_t>(current_[2])) << 8;
ret |= (static_cast<uint32_t>(current_[3]));
// @todo - please update
return (ret);
}
} // @todo - please update
/// @brief Read an unsigned 32-bit integer in network byte order
/// from the buffer, and return it.
///
/// // @todo - please update
/// If the remaining length of the buffer is smaller than 32-bit,
/// an exception of class @c isc::OutOfRange will be thrown.
uint32_t readUint32() {
@ -202,7 +202,7 @@ public:
return (ret);
}
// @todo - please update
/// @brief Peek data of the specified length from the buffer and
/// copy it to the caller supplied buffer.
///
@ -214,14 +214,14 @@ public:
if (current_ + len > end_) {
isc_throw(OutOfRange,
"InputBuffer::peekData read beyond end of buffer");
}
} // @todo - please update
// @todo - please update
static_cast<void>(std::memmove(data, current_, len));
}
} // @todo - please update
/// @brief Read data of the specified length from the buffer and
/// copy it to the caller supplied buffer.
///
/// // @todo - please update
/// The data is copied as stored in the buffer; no conversion is
/// performed. If the remaining length of the buffer is smaller
/// than the specified length, an exception of class @c isc::OutOfRange
@ -244,12 +244,12 @@ public:
if (current_ + len > end_) {
isc_throw(OutOfRange,
"InputBuffer::peekVector read beyond end of buffer");
}
} // @todo - please update
// @todo - please update
data.resize(len);
peekData(&data[0], len);
}
} // @todo - please update
// @todo - please update
/// @brief Read specified number of bytes as a vector.
///
/// If specified buffer is too short, it will be expanded using
@ -264,32 +264,32 @@ public:
current_ += len;
}
private:
private: // @todo - please update
/// @brief Base of the buffer.
const uint8_t* base_;
/// @brief Current poisition in the buffer.
const uint8_t* current_;
// @todo - please update
/// @brief End of the buffer (address of the byte after).
const uint8_t* end_;
};
}; // @todo - please update
// @todo - please update
/// @brief Type of pointers to input buffer.
typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// @brief The @c OutputBuffer class is a buffer abstraction for
/// manipulating mutable data.
///
/// The main purpose of this class is to provide a safe workplace for
/// constructing wire-format data to be sent out to a network. Here,
/// // @todo - please update
/// The main purpose of this class is to provide a safe workplace for // @todo - please update
/// constructing wire-format data to be sent out to a network. Here, // @todo - please update
/// <em>safe</em> means that it automatically allocates necessary
/// memory and avoid buffer overrun.
///
/// // @todo - please update
/// Like for the @c InputBuffer class, applications normally use this
/// class only in a limited situation. One common usage of this class
/// for an application would be something like this:
///
/// // @todo - please update
/// @code
/// OutputBuffer buffer(4096); // give a sufficiently large initial size
/// // pass the buffer to a DNS message object to construct a wire-format
@ -297,7 +297,7 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// struct sockaddr to;
/// sendto(s, buffer.getDataAsVoidPtr(), buffer.getLength(), 0, &to, sizeof(to));
/// @endcode
///
/// // @todo - please update
/// where the @c getData() (in fact @c getDataAsVoidPtr()) method gives
/// a reference to the internal memory region stored in the @c buffer
/// object. This is a suboptimal design in that it exposes an
@ -309,7 +309,7 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// such a special circumstance. It should also be noted that the
/// memory region returned by @c getData() may be invalidated after a
/// subsequent write operation.
///
/// // @todo - please update
/// An @c OutputBuffer class object automatically extends its memory
/// region when data is written beyond the end of the current buffer.
/// However, it will involve performance overhead such as reallocating
@ -318,7 +318,7 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// size. The @c getCapacity() method provides the current maximum
/// size of data (including the portion already written) that can be
/// written into the buffer without causing memory reallocation.
///
/// // @todo - please update
/// Methods for writing data into the buffer generally work like an
/// output stream: it begins with the head of the buffer, and once
/// some length of data is written into the buffer, the next write
@ -330,7 +330,7 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// writing multi-GB data, a separate exception (e.g., @c
/// std::bad_alloc) may be thrown by the system. This also applies to
/// the constructor with a very large initial size.
///
/// // @todo - please update
/// Note to developers: it may make more sense to introduce an
/// abstract base class for the @c OutputBuffer and define the simple
/// implementation as a concrete derived class. That way we can
@ -338,16 +338,16 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// buffer implementation or allowing users to have their own
/// customized version without modifying the source code. We in fact
/// considered that option, but at the moment chose the simpler
/// approach with a single concrete class because it may make the
/// approach with a single concrete class because it may make the // @todo - please update
/// implementation unnecessarily complicated while we were still not
/// certain if we really want that flexibility. We may revisit the
/// class design as we see more applications of the class. The same
/// considerations apply to the @c InputBuffer and @c MessageRenderer
/// classes.
class OutputBuffer {
public:
class OutputBuffer { // @todo - please update
public: // @todo - please update
/// @brief Constructor.
///
/// // @todo - please update
/// @param len The initial allocated length of the buffer in bytes.
OutputBuffer(size_t len) : buffer_() {
if (len != 0) {
@ -367,7 +367,7 @@ public:
/// @brief Destructor.
~OutputBuffer() = default;
// @todo - please update
/// @brief Assignment operator.
///
/// @param other Object to copy into "this".
@ -389,10 +389,10 @@ public:
}
/// @brief Return a pointer to the head of the data stored in the buffer.
///
/// // @todo - please update
/// The caller can assume that the subsequent @c getLength() bytes
/// are identical to the stored data of the buffer.
///
/// // @todo - please update
/// Note: The pointer returned by this method may be invalidated
/// after a subsequent write operation.
const uint8_t* getData() const {
@ -414,11 +414,11 @@ public:
}
/// @brief Return the value of the buffer at the specified position.
///
/// // @todo - please update
/// @c pos must specify the valid position of the buffer;
/// otherwise an exception class of @c isc::OutOfRange will
/// be thrown.
///
/// // @todo - please update
/// @param pos The position in the buffer to be returned.
uint8_t operator[](size_t pos) const {
if (pos >= buffer_.size()) {
@ -427,7 +427,7 @@ public:
<< ") >= size (" << buffer_.size() << ")");
}
return (buffer_[pos]);
}
} // @todo - please update
/// @brief Return the buffer.
///
@ -435,9 +435,9 @@ public:
const std::vector<uint8_t>& getVector() const {
return (buffer_);
}
// @todo - please update
/// @brief Insert a specified length of gap at the end of the buffer.
///
/// // @todo - please update
/// The caller should not assume any particular value to be
/// inserted. This method is provided as a shortcut to make a
/// hole in the buffer that is to be filled in later, e.g, by
@ -447,21 +447,21 @@ public:
void skip(size_t len) {
buffer_.resize(buffer_.size() + len);
}
// @todo - please update
/// @brief Trim the specified length of data from the end of the buffer.
///
/// // @todo - please update
/// The specified length must not exceed the current data size of
/// the buffer; otherwise an exception of class @c isc::OutOfRange
/// will be thrown.
///
/// // @todo - please update
/// @param len The length of data that should be trimmed.
void trim(size_t len) {
if (len > buffer_.size()) {
isc_throw(OutOfRange,
"OutputBuffer::trim length too large from output buffer");
}
} // @todo - please update
buffer_.resize(buffer_.size() - len);
}
} // @todo - please update
/// @brief Clear buffer content.
void clear() {
@ -469,68 +469,68 @@ public:
}
/// @brief Write an unsigned 8-bit integer into the buffer.
///
/// // @todo - please update
/// @param data The 8-bit integer to be written into the buffer.
void writeUint8(uint8_t data) {
buffer_.push_back(data);
}
// @todo - please update
/// @brief Write an unsigned 8-bit integer into the buffer.
///
/// The position must be lower than the size of the buffer,
/// // @todo - please update
/// The position must be lower than the size of the buffer, // @todo - please update
/// otherwise an exception of class @c isc::OutOfRange will
/// be thrown.
///
/// // @todo - please update
/// @param data The 8-bit integer to be written into the buffer.
/// @param pos The position in the buffer to write the data.
void writeUint8At(uint8_t data, size_t pos) {
void writeUint8At(uint8_t data, size_t pos) { // @todo - please update
if (pos + sizeof(data) > buffer_.size()) {
isc_throw(OutOfRange,
"OutputBuffer::writeUint8At write at invalid position");
}
} // @todo - please update
buffer_[pos] = data;
}
} // @todo - please update
// @todo - please update
/// @brief Write an unsigned 16-bit integer in host byte order
/// into the buffer in network byte order.
///
/// // @todo - please update
/// @param data The 16-bit integer to be written into the buffer.
void writeUint16(uint16_t data) {
buffer_.push_back(static_cast<uint8_t>((data & 0xff00U) >> 8));
buffer_.push_back(static_cast<uint8_t>(data & 0x00ffU));
}
} // @todo - please update
/// @brief Write an unsigned 16-bit integer in host byte order at
/// the specified position of the buffer in network byte order.
///
/// // @todo - please update
/// The buffer must have a sufficient room to store the given data
/// at the given position, that is, <code>pos + 2 <
/// getLength()</code>; otherwise an exception of class
/// @c isc::OutOfRange will be thrown.
/// Note also that this method never extends the buffer.
///
/// Note also that this method never extends the buffer. // @todo - please update
/// // @todo - please update
/// @param data The 16-bit integer to be written into the buffer.
/// @param pos The beginning position in the buffer to write the data.
void writeUint16At(uint16_t data, size_t pos) {
if (pos + sizeof(data) > buffer_.size()) {
isc_throw(OutOfRange,
"OutputBuffer::writeUint16At write at invalid position");
}
} // @todo - please update
// @todo - please update
buffer_[pos] = static_cast<uint8_t>((data & 0xff00U) >> 8);
buffer_[pos + 1] = static_cast<uint8_t>(data & 0x00ffU);
}
} // @todo - please update
/// @brief Write an unsigned 32-bit integer in host byte order
/// into the buffer in network byte order.
///
/// into the buffer in network byte order. // @todo - please update
/// // @todo - please update
/// @param data The 32-bit integer to be written into the buffer.
void writeUint32(uint32_t data) {
buffer_.push_back(static_cast<uint8_t>((data & 0xff000000) >> 24));
buffer_.push_back(static_cast<uint8_t>((data & 0x00ff0000) >> 16));
buffer_.push_back(static_cast<uint8_t>((data & 0x0000ff00) >> 8));
buffer_.push_back(static_cast<uint8_t>(data & 0x000000ff));
}
} // @todo - please update
/// @brief Write an unsigned 64-bit integer in host byte order
/// into the buffer in network byte order.
@ -548,9 +548,9 @@ public:
}
/// @brief Copy an arbitrary length of data into the buffer.
///
/// No conversion on the copied data is performed.
///
/// // @todo - please update
/// No conversion on the copied data is performed. // @todo - please update
/// // @todo - please update
/// @param data A pointer to the data to be copied into the buffer.
/// @param len The length of the data in bytes.
void writeData(const void *data, size_t len) {
@ -560,17 +560,17 @@ public:
const uint8_t* ptr = static_cast<const uint8_t*>(data);
buffer_.insert(buffer_.end(), ptr, ptr + len);
}
} // @todo - please update
private:
private: // @todo - please update
/// The actual data.
std::vector<uint8_t> buffer_;
};
}; // @todo - please update
// @todo - please update
/// @brief Type of pointers to output buffers.
typedef boost::shared_ptr<OutputBuffer> OutputBufferPtr;
typedef boost::shared_ptr<OutputBuffer> OutputBufferPtr; // @todo - please update
// @todo - please update
} // end of namespace util
} // end of namespace isc
// @todo - please update
#endif // BUFFER_H

View File

@ -1,26 +1,26 @@
// Copyright (C) 2010-2019 Internet Systems Consortium, Inc. ("ISC")
//
// // @todo - please update
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// @todo - please update
#include <config.h>
#include <cstring>
#include <cstdlib>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/types.h> // @todo - please update
#include <sys/socket.h> // @todo - please update
#include <sys/uio.h> // @todo - please update
#include <errno.h>
#include <stdlib.h> // for malloc and free
#include <unistd.h>
#include <util/io/fd_share.h>
namespace isc {
// @todo - please update
namespace isc { // @todo - please update
namespace util {
namespace io {
// @todo - please update
namespace {
// Not all OSes support advanced CMSG macros: CMSG_LEN and CMSG_SPACE.
// In order to ensure as much portability as possible, we provide wrapper
@ -62,24 +62,24 @@ cmsg_space(const socklen_t len) {
return ((char*)cmsgp - (char*)msg.msg_control);
} else {
return (0);
}
} // @todo - please update
#endif // CMSG_SPACE
}
}
int
// @todo - please update
int // @todo - please update
recv_fd(const int sock) {
struct msghdr msghdr;
struct msghdr msghdr; // @todo - please update
struct iovec iov_dummy;
unsigned char dummy_data;
// @todo - please update
iov_dummy.iov_base = &dummy_data;
iov_dummy.iov_len = sizeof(dummy_data);
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_name = NULL; // @todo - please update
msghdr.msg_namelen = 0; // @todo - please update
msghdr.msg_iov = &iov_dummy;
msghdr.msg_iovlen = 1;
msghdr.msg_flags = 0;
msghdr.msg_iovlen = 1; // @todo - please update
msghdr.msg_flags = 0; // @todo - please update
msghdr.msg_controllen = cmsg_space(sizeof(int));
msghdr.msg_control = malloc(msghdr.msg_controllen);
if (msghdr.msg_control == NULL) {
@ -128,39 +128,39 @@ recv_fd(const int sock) {
return (FD_SYSTEM_ERROR);
}
return (new_fd);
}
int
} // @todo - please update
// @todo - please update
int // @todo - please update
send_fd(const int sock, const int fd) {
struct msghdr msghdr;
struct msghdr msghdr; // @todo - please update
struct iovec iov_dummy;
unsigned char dummy_data = 0;
// @todo - please update
iov_dummy.iov_base = &dummy_data;
iov_dummy.iov_len = sizeof(dummy_data);
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_name = NULL; // @todo - please update
msghdr.msg_namelen = 0; // @todo - please update
msghdr.msg_iov = &iov_dummy;
msghdr.msg_iovlen = 1;
msghdr.msg_flags = 0;
msghdr.msg_iovlen = 1; // @todo - please update
msghdr.msg_flags = 0; // @todo - please update
msghdr.msg_controllen = cmsg_space(sizeof(int));
msghdr.msg_control = malloc(msghdr.msg_controllen);
if (msghdr.msg_control == NULL) {
return (FD_OTHER_ERROR);
}
std::memset(msghdr.msg_control, 0, msghdr.msg_controllen);
// @todo - please update
struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msghdr);
cmsg->cmsg_len = cmsg_len(sizeof(int));
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
std::memcpy(CMSG_DATA(cmsg), &fd, sizeof(int));
// @todo - please update
const int ret = sendmsg(sock, &msghdr, 0);
free(msghdr.msg_control);
return (ret >= 0 ? 0 : FD_SYSTEM_ERROR);
}
} // @todo - please update
// @todo - please update
} // namespace io
} // namespace util
} // namespace isc

View File

@ -1,22 +1,22 @@
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
//
// // @todo - please update
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// @todo - please update
#ifndef FD_SHARE_H
#define FD_SHARE_H
// @todo - please update
/**
* \file fd_share.h
* \short Support to transfer file descriptors between processes.
* \todo This interface is very C-ish. Should we have some kind of exceptions?
*/
namespace isc {
namespace isc { // @todo - please update
namespace util {
namespace io {
// @todo - please update
const int FD_SYSTEM_ERROR = -2;
const int FD_OTHER_ERROR = -1;
@ -34,7 +34,7 @@ const int FD_OTHER_ERROR = -1;
* not work with a pipe.
*/
int recv_fd(const int sock);
// @todo - please update
/**
* \short Sends a file descriptor.
* This sends a file descriptor over an unix domain socket. This is the
@ -49,9 +49,9 @@ int recv_fd(const int sock);
* file descriptor.
*/
int send_fd(const int sock, const int fd);
// @todo - please update
} // namespace io
} // namespace util
} // namespace isc
// @todo - please update
#endif // FD_SHARE_H

View File

@ -1,47 +1,47 @@
// Copyright (C) 2009-2024 Internet Systems Consortium, Inc. ("ISC")
//
// // @todo - please update
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// @todo - please update
#include <config.h>
#include <exceptions/exceptions.h>
#include <exceptions/exceptions.h> // @todo - please update
#include <util/buffer.h>
// @todo - please update
#ifdef EXPECT_DEATH
#include <util/unittests/resource.h>
#include <util/unittests/check_valgrind.h>
#endif /* EXPECT_DEATH */
// @todo - please update
#include <gtest/gtest.h>
using namespace isc;
// @todo - please update
using namespace isc; // @todo - please update
using namespace isc::util;
namespace {
class BufferTest : public ::testing::Test {
protected:
BufferTest() : ibuffer(testdata, sizeof(testdata)), obuffer(0),
// @todo - please update
namespace { // @todo - please update
// @todo - please update
class BufferTest : public ::testing::Test { // @todo - please update
protected: // @todo - please update
BufferTest() : ibuffer(testdata, sizeof(testdata)), obuffer(0), // @todo - please update
expected_size(0) {
data16 = (2 << 8) | 3;
data32 = (4 << 24) | (5 << 16) | (6 << 8) | 7;
memset(vdata, 0, sizeof(testdata));
}
InputBuffer ibuffer;
OutputBuffer obuffer;
static const uint8_t testdata[5];
uint8_t vdata[sizeof(testdata)];
size_t expected_size;
uint16_t data16;
uint32_t data32;
data16 = (2 << 8) | 3; // @todo - please update
data32 = (4 << 24) | (5 << 16) | (6 << 8) | 7; // @todo - please update
memset(vdata, 0, sizeof(testdata)); // @todo - please update
} // @todo - please update
// @todo - please update
InputBuffer ibuffer; // @todo - please update
OutputBuffer obuffer; // @todo - please update
static const uint8_t testdata[5]; // @todo - please update
uint8_t vdata[sizeof(testdata)]; // @todo - please update
size_t expected_size; // @todo - please update
uint16_t data16; // @todo - please update
uint32_t data32; // @todo - please update
std::vector<uint8_t> datav;
};
const uint8_t BufferTest::testdata[5] = {1, 2, 3, 4, 5};
}; // @todo - please update
// @todo - please update
const uint8_t BufferTest::testdata[5] = {1, 2, 3, 4, 5}; // @todo - please update
// @todo - please update
TEST_F(BufferTest, outputBufferClear) {
obuffer.writeData(testdata, sizeof(testdata));
obuffer.clear();
@ -160,7 +160,7 @@ TEST_F(BufferTest, outputBufferTrim) {
ASSERT_THROW(obuffer.trim(3), OutOfRange);
}
TEST_F(BufferTest, inputBufferRead) {
TEST_F(BufferTest, inputBufferRead) { // @todo - please update
ASSERT_EQ(5, ibuffer.getLength());
ASSERT_EQ(1, ibuffer.peekUint8());
ASSERT_EQ(0, ibuffer.getPosition());
@ -171,19 +171,19 @@ TEST_F(BufferTest, inputBufferRead) {
ASSERT_EQ(data16, ibuffer.readUint16());
ASSERT_EQ((2 << 8) | 3, data16);
ASSERT_EQ(3, ibuffer.getPosition());
ibuffer.setPosition(1);
ibuffer.setPosition(1); // @todo - please update
ASSERT_EQ(1, ibuffer.getPosition());
data32 = ibuffer.peekUint32();
ASSERT_EQ(1, ibuffer.getPosition());
ASSERT_EQ(data32, ibuffer.readUint32());
ASSERT_EQ((2 << 24) | (3 << 16) | (4 << 8) | 5, data32);
ibuffer.setPosition(0);
memset(vdata, 0, sizeof(vdata));
ibuffer.setPosition(0); // @todo - please update
memset(vdata, 0, sizeof(vdata)); // @todo - please update
ibuffer.peekData(vdata, sizeof(vdata));
ASSERT_EQ(0, memcmp(vdata, testdata, sizeof(testdata)));
ASSERT_EQ(0, ibuffer.getPosition());
memset(vdata, 0, sizeof(vdata));
ibuffer.readData(vdata, sizeof(vdata));
ibuffer.readData(vdata, sizeof(vdata)); // @todo - please update
ASSERT_EQ(0, memcmp(vdata, testdata, sizeof(testdata)));
ASSERT_EQ(sizeof(vdata), ibuffer.getPosition());
ibuffer.setPosition(0);
@ -197,16 +197,16 @@ TEST_F(BufferTest, inputBufferRead) {
ASSERT_EQ(sizeof(vdata), datav.size());
ASSERT_EQ(0, memcmp(&vdata[0], testdata, sizeof(testdata)));
ASSERT_EQ(sizeof(vdata), ibuffer.getPosition());
}
} // @todo - please update
// @todo - please update
TEST_F(BufferTest, outputBufferReadAt) {
obuffer.writeData(testdata, sizeof(testdata));
for (size_t i = 0; i < sizeof(testdata); ++i) {
ASSERT_EQ(testdata[i], obuffer[i]);
}
ASSERT_THROW(obuffer[sizeof(testdata)], isc::OutOfRange);
}
} // @todo - please update
// @todo - please update
TEST_F(BufferTest, inputBufferReadVectorChunks) {
std::vector<uint8_t> vec;
@ -217,33 +217,33 @@ TEST_F(BufferTest, inputBufferReadVectorChunks) {
ASSERT_NO_THROW(ibuffer.readVector(vec, 2));
ASSERT_EQ(2, vec.size());
ASSERT_EQ(0, memcmp(&vec[0], &testdata[3], 2));
}
TEST_F(BufferTest, outputBufferWrite) {
obuffer.writeUint8(1);
expected_size += sizeof(uint8_t);
} // @todo - please update
// @todo - please update
TEST_F(BufferTest, outputBufferWrite) { // @todo - please update
obuffer.writeUint8(1); // @todo - please update
expected_size += sizeof(uint8_t); // @todo - please update
ASSERT_EQ(expected_size, obuffer.getLength());
const uint8_t* cp = obuffer.getData();
ASSERT_EQ(1, *cp);
obuffer.writeUint16(data16);
expected_size += sizeof(data16);
// @todo - please update
obuffer.writeUint16(data16); // @todo - please update
expected_size += sizeof(data16); // @todo - please update
cp = obuffer.getData();
ASSERT_EQ(expected_size, obuffer.getLength());
ASSERT_EQ(2, *(cp + 1));
ASSERT_EQ(3, *(cp + 2));
obuffer.writeUint32(data32);
expected_size += sizeof(data32);
// @todo - please update
obuffer.writeUint32(data32); // @todo - please update
expected_size += sizeof(data32); // @todo - please update
cp = obuffer.getData();
ASSERT_EQ(expected_size, obuffer.getLength());
ASSERT_EQ(4, *(cp + 3));
ASSERT_EQ(5, *(cp + 4));
ASSERT_EQ(6, *(cp + 5));
ASSERT_EQ(7, *(cp + 6));
obuffer.writeData(testdata, sizeof(testdata));
expected_size += sizeof(testdata);
// @todo - please update
obuffer.writeData(testdata, sizeof(testdata)); // @todo - please update
expected_size += sizeof(testdata); // @todo - please update
ASSERT_EQ(expected_size, obuffer.getLength());
cp = obuffer.getData();
ASSERT_EQ(0, memcmp(cp + 7, testdata, sizeof(testdata)));
@ -254,27 +254,27 @@ TEST_F(BufferTest, outputBufferWrite) {
expected.insert(expected.end(), testdata, testdata + sizeof(testdata));
ASSERT_EQ(expected_size, expected.size());
ASSERT_EQ(0, memcmp(&expected[0], &datav[0], expected_size));
}
} // @todo - please update
// @todo - please update
TEST_F(BufferTest, outputBufferWriteAt) {
obuffer.writeUint32(data32);
expected_size += sizeof(data32);
// overwrite 2nd byte
obuffer.writeUint8At(4, 1);
obuffer.writeUint32(data32); // @todo - please update
expected_size += sizeof(data32); // @todo - please update
// @todo - please update
// overwrite 2nd byte // @todo - please update
obuffer.writeUint8At(4, 1); // @todo - please update
ASSERT_EQ(expected_size, obuffer.getLength()); // length shouldn't change
const uint8_t* cp = obuffer.getData();
ASSERT_EQ(4, *(cp + 1));
// overwrite 2nd and 3rd bytes
obuffer.writeUint16At(data16, 1);
// @todo - please update
// overwrite 2nd and 3rd bytes // @todo - please update
obuffer.writeUint16At(data16, 1); // @todo - please update
ASSERT_EQ(expected_size, obuffer.getLength()); // length shouldn't change
cp = obuffer.getData();
ASSERT_EQ(2, *(cp + 1));
ASSERT_EQ(3, *(cp + 2));
// overwrite 3rd and 4th bytes
obuffer.writeUint16At(data16, 2);
// @todo - please update
// overwrite 3rd and 4th bytes // @todo - please update
obuffer.writeUint16At(data16, 2); // @todo - please update
ASSERT_EQ(expected_size, obuffer.getLength());
cp = obuffer.getData();
ASSERT_EQ(2, *(cp + 2));
@ -308,4 +308,4 @@ TEST_F(BufferTest, writeUint64) {
ASSERT_FALSE(memcmp(exp_val2, obuffer.getData(), sizeof(uint64_t)));
}
}
} // @todo - please update