]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3211] Renamed getDataAsVP
authorFrancis Dupont <fdupont@isc.org>
Tue, 19 Mar 2024 18:17:32 +0000 (19:17 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 19 Mar 2024 23:18:25 +0000 (00:18 +0100)
src/lib/dhcp/pkt_filter_inet.cc
src/lib/dhcp/pkt_filter_inet6.cc
src/lib/dhcp/tests/pkt_filter6_test_utils.cc
src/lib/dhcpsrv/tests/dhcp4o6_ipc_unittest.cc
src/lib/util/buffer.h
src/lib/util/io/socketsession.cc

index 3de58912ffe7dcef7da72120dea094a3ef906971..195696a3679cecae9b7d28215f84fd1258808b69 100644 (file)
@@ -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;
index 8328b6532058420d0b3f24c28df70072c690e95a..614dfad24b48a0116b1c44949aceb2d1ae6e8170 100644 (file)
@@ -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;
index aa5d85c7da3253f66bcb359d06cf8b82e86f75e5..3896b5dbdd64d04afab98a0b780c57c334f71f57 100644 (file)
@@ -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;
index e0f8973ad6cc474ea737965a0ccdcff32cf9d96f..a09866551e5893c74714bee529d3ecac3bdc80a0 100644 (file)
@@ -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
index 2a8ac8d2b7e91608560217d51f0cfa5f5306dacd..ef1f52905814a573f558e1e0027dd43d68618828 100644 (file)
@@ -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()));
     }
 
index 0b2196514751872237141ed803bf2281a41d54c0..db93820a4ff3e64fd702d16efc7918eb0faa75df 100644 (file)
@@ -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);