summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/dhcp/pkt_filter_inet.cc2
-rw-r--r--src/lib/dhcp/pkt_filter_inet6.cc2
-rw-r--r--src/lib/dhcp/tests/pkt_filter6_test_utils.cc2
-rw-r--r--src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc2
-rw-r--r--src/lib/util/buffer.h26
-rw-r--r--src/lib/util/io/socketsession.cc3
6 files changed, 19 insertions, 18 deletions
diff --git a/src/lib/dhcp/pkt_filter_inet.cc b/src/lib/dhcp/pkt_filter_inet.cc
index 3de58912ff..195696a367 100644
--- a/src/lib/dhcp/pkt_filter_inet.cc
+++ b/src/lib/dhcp/pkt_filter_inet.cc
@@ -269,7 +269,7 @@ PktFilterInet::send(const Iface&, uint16_t sockfd, const Pkt4Ptr& pkt) {
memset(&v, 0, sizeof(v));
// iov_base field is of void * type. We use it for packet
// transmission, so this buffer will not be modified.
- v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVP());
+ v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVoidPtr());
v.iov_len = pkt->getBuffer().getLength();
m.msg_iov = &v;
m.msg_iovlen = 1;
diff --git a/src/lib/dhcp/pkt_filter_inet6.cc b/src/lib/dhcp/pkt_filter_inet6.cc
index 8328b65320..614dfad24b 100644
--- a/src/lib/dhcp/pkt_filter_inet6.cc
+++ b/src/lib/dhcp/pkt_filter_inet6.cc
@@ -322,7 +322,7 @@ PktFilterInet6::send(const Iface&, uint16_t sockfd, const Pkt6Ptr& pkt) {
// to assign const void* to void*.
struct iovec v;
memset(&v, 0, sizeof(v));
- v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVP());
+ v.iov_base = const_cast<void *>(pkt->getBuffer().getDataAsVoidPtr());
v.iov_len = pkt->getBuffer().getLength();
m.msg_iov = &v;
m.msg_iovlen = 1;
diff --git a/src/lib/dhcp/tests/pkt_filter6_test_utils.cc b/src/lib/dhcp/tests/pkt_filter6_test_utils.cc
index aa5d85c7da..3896b5dbdd 100644
--- a/src/lib/dhcp/tests/pkt_filter6_test_utils.cc
+++ b/src/lib/dhcp/tests/pkt_filter6_test_utils.cc
@@ -119,7 +119,7 @@ PktFilter6Test::sendMessage() {
// The iovec structure holds the packet data.
struct iovec v;
memset(&v, 0, sizeof(v));
- v.iov_base = const_cast<void *>(test_message_->getBuffer().getDataAsVP());
+ v.iov_base = const_cast<void *>(test_message_->getBuffer().getDataAsVoidPtr());
v.iov_len = test_message_->getBuffer().getLength();
// Assign the iovec to msghdr structure.
m.msg_iov = &v;
diff --git a/src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc b/src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc
index e0f8973ad6..a09866551e 100644
--- a/src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc
+++ b/src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc
@@ -336,7 +336,7 @@ Dhcp4o6IpcBaseTest::testReceiveError(const Pkt6Ptr& pkt) {
buf.clear();
ASSERT_NO_THROW(pkt->pack());
- ASSERT_NE(-1, ::send(ipc_src.getSocketFd(), buf.getDataAsVP(),
+ ASSERT_NE(-1, ::send(ipc_src.getSocketFd(), buf.getDataAsVoidPtr(),
buf.getLength(), 0));
// Call receive with a timeout. The data should appear on the socket
diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h
index 2a8ac8d2b7..ef1f529058 100644
--- a/src/lib/util/buffer.h
+++ b/src/lib/util/buffer.h
@@ -295,20 +295,20 @@ typedef boost::shared_ptr<InputBuffer> InputBufferPtr;
/// // pass the buffer to a DNS message object to construct a wire-format
/// // DNS message.
/// struct sockaddr to;
-/// sendto(s, buffer.getDataAsVP(), buffer.getLength(), 0, &to, sizeof(to));
+/// sendto(s, buffer.getDataAsVoidPtr(), buffer.getLength(), 0, &to, sizeof(to));
/// @endcode
///
-/// where the @c getData() 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 encapsulated "handle" of
-/// an object to its user. Unfortunately, there is no easy way to
-/// avoid this without involving expensive data copy if we want to use
-/// this object with a legacy API such as a BSD socket interface.
-/// And, indeed, this is one major purpose for this object.
-/// Applications should use this method only under 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.
+/// where the @c getData() (in fact @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
+/// encapsulated "handle" of an object to its user. Unfortunately,
+/// there is no easy way to avoid this without involving expensive
+/// data copy if we want to use this object with a legacy API such as
+/// a BSD socket interface. And, indeed, this is one major purpose
+/// for this object. Applications should use this method only under
+/// 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.
///
/// An @c OutputBuffer class object automatically extends its memory
/// region when data is written beyond the end of the current buffer.
@@ -404,7 +404,7 @@ public:
}
/// @brief Return data as a pointer to void.
- const void* getDataAsVP() const {
+ const void* getDataAsVoidPtr() const {
return (static_cast<const void*>(getData()));
}
diff --git a/src/lib/util/io/socketsession.cc b/src/lib/util/io/socketsession.cc
index 0b21965147..db93820a4f 100644
--- a/src/lib/util/io/socketsession.cc
+++ b/src/lib/util/io/socketsession.cc
@@ -241,7 +241,8 @@ SocketSessionForwarder::push(int sock, int family, int type, int protocol,
impl_->buf_.writeUint16At(impl_->buf_.getLength() - sizeof(uint16_t), 0);
const struct iovec iov[2] = {
- { const_cast<void*>(impl_->buf_.getDataAsVP()), impl_->buf_.getLength() },
+ { const_cast<void*>(impl_->buf_.getDataAsVoidPtr()),
+ impl_->buf_.getLength() },
{ const_cast<void*>(data), data_len }
};
const int cc = writev(impl_->fd_, iov, 2);