Update libnl++ class naming to match Android code style

nl::nlbuf -> nl::Buffer
nl::nlmsg -> nl::Message
nl::NetlinkRequest -> nl::MessageFactory
nl::NetlinkSocket -> nl::Socket

Bug: 162032964
Test: it builds
Change-Id: Id9858805ff3fce3e48f9a82b7dbaea09269bcb3c
diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp
index c6f1b04..b047bc9 100644
--- a/automotive/can/1.0/default/libnetdevice/can.cpp
+++ b/automotive/can/1.0/default/libnetdevice/can.cpp
@@ -20,8 +20,8 @@
 
 #include <android-base/logging.h>
 #include <android-base/unique_fd.h>
-#include <libnl++/NetlinkRequest.h>
-#include <libnl++/NetlinkSocket.h>
+#include <libnl++/MessageFactory.h>
+#include <libnl++/Socket.h>
 
 #include <linux/can.h>
 #include <linux/can/error.h>
@@ -70,7 +70,7 @@
     struct can_bittiming bt = {};
     bt.bitrate = bitrate;
 
-    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
+    nl::MessageFactory<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
 
     const auto ifidx = nametoindex(ifname);
     if (ifidx == 0) {
@@ -90,7 +90,7 @@
         }
     }
 
-    nl::NetlinkSocket sock(NETLINK_ROUTE);
+    nl::Socket sock(NETLINK_ROUTE);
     return sock.send(req) && sock.receiveAck();
 }
 
diff --git a/automotive/can/1.0/default/libnetdevice/common.h b/automotive/can/1.0/default/libnetdevice/common.h
index 201909f..661e3f8 100644
--- a/automotive/can/1.0/default/libnetdevice/common.h
+++ b/automotive/can/1.0/default/libnetdevice/common.h
@@ -16,8 +16,6 @@
 
 #pragma once
 
-#include <libnl++/nlbuf.h>
-
 #include <linux/can.h>
 #include <net/if.h>
 
diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
index aeb5005..f7f5f4d 100644
--- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
+++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
@@ -20,8 +20,8 @@
 #include "ifreqs.h"
 
 #include <android-base/logging.h>
-#include <libnl++/NetlinkRequest.h>
-#include <libnl++/NetlinkSocket.h>
+#include <libnl++/MessageFactory.h>
+#include <libnl++/Socket.h>
 
 #include <linux/can.h>
 #include <linux/rtnetlink.h>
@@ -62,7 +62,7 @@
 }
 
 bool add(std::string dev, std::string type) {
-    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK,
+    nl::MessageFactory<struct ifinfomsg> req(RTM_NEWLINK,
                                              NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
     req.addattr(IFLA_IFNAME, dev);
 
@@ -71,15 +71,15 @@
         req.addattr(IFLA_INFO_KIND, type);
     }
 
-    nl::NetlinkSocket sock(NETLINK_ROUTE);
+    nl::Socket sock(NETLINK_ROUTE);
     return sock.send(req) && sock.receiveAck();
 }
 
 bool del(std::string dev) {
-    nl::NetlinkRequest<struct ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST);
+    nl::MessageFactory<struct ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST);
     req.addattr(IFLA_IFNAME, dev);
 
-    nl::NetlinkSocket sock(NETLINK_ROUTE);
+    nl::Socket sock(NETLINK_ROUTE);
     return sock.send(req) && sock.receiveAck();
 }
 
diff --git a/automotive/can/1.0/default/libnetdevice/vlan.cpp b/automotive/can/1.0/default/libnetdevice/vlan.cpp
index e419154..3e07f67 100644
--- a/automotive/can/1.0/default/libnetdevice/vlan.cpp
+++ b/automotive/can/1.0/default/libnetdevice/vlan.cpp
@@ -19,8 +19,8 @@
 #include "common.h"
 
 #include <android-base/logging.h>
-#include <libnl++/NetlinkRequest.h>
-#include <libnl++/NetlinkSocket.h>
+#include <libnl++/MessageFactory.h>
+#include <libnl++/Socket.h>
 
 #include <linux/rtnetlink.h>
 
@@ -33,7 +33,7 @@
         return false;
     }
 
-    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK,
+    nl::MessageFactory<struct ifinfomsg> req(RTM_NEWLINK,
                                              NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
     req.addattr(IFLA_IFNAME, vlan);
     req.addattr<uint32_t>(IFLA_LINK, ethidx);
@@ -48,7 +48,7 @@
         }
     }
 
-    nl::NetlinkSocket sock(NETLINK_ROUTE);
+    nl::Socket sock(NETLINK_ROUTE);
     return sock.send(req) && sock.receiveAck();
 }
 
diff --git a/automotive/can/1.0/default/libnl++/Android.bp b/automotive/can/1.0/default/libnl++/Android.bp
index c4eb805..4042b16 100644
--- a/automotive/can/1.0/default/libnl++/Android.bp
+++ b/automotive/can/1.0/default/libnl++/Android.bp
@@ -32,8 +32,8 @@
         "protocols/NetlinkProtocol.cpp",
         "protocols/all.cpp",
         "Attributes.cpp",
-        "NetlinkRequest.cpp",
-        "NetlinkSocket.cpp",
+        "MessageFactory.cpp",
+        "Socket.cpp",
         "common.cpp",
         "printer.cpp",
     ],
diff --git a/automotive/can/1.0/default/libnl++/Attributes.cpp b/automotive/can/1.0/default/libnl++/Attributes.cpp
index 0f3c7f8..c101647 100644
--- a/automotive/can/1.0/default/libnl++/Attributes.cpp
+++ b/automotive/can/1.0/default/libnl++/Attributes.cpp
@@ -20,7 +20,7 @@
 
 Attributes::Attributes() {}
 
-Attributes::Attributes(nlbuf<nlattr> buffer) : nlbuf<nlattr>(buffer) {}
+Attributes::Attributes(Buffer<nlattr> buffer) : Buffer<nlattr>(buffer) {}
 
 const Attributes::Index& Attributes::index() const {
     if (mIndex.has_value()) return *mIndex;
@@ -28,7 +28,7 @@
     mIndex = Index();
     auto& index = *mIndex;
 
-    for (auto attr : static_cast<nlbuf<nlattr>>(*this)) {
+    for (auto attr : static_cast<Buffer<nlattr>>(*this)) {
         index.emplace(attr->nla_type, attr);
     }
 
@@ -42,38 +42,38 @@
 /* Parser specializations for selected types (more to come if necessary). */
 
 template <>
-Attributes Attributes::parse(nlbuf<nlattr> buf) {
+Attributes Attributes::parse(Buffer<nlattr> buf) {
     return buf.data<nlattr>();
 }
 
 template <>
-std::string Attributes::parse(nlbuf<nlattr> buf) {
+std::string Attributes::parse(Buffer<nlattr> buf) {
     const auto rawString = buf.data<char>().getRaw();
     return std::string(rawString.ptr(), rawString.len());
 }
 
 template <typename T>
-static T parseUnsigned(nlbuf<nlattr> buf) {
+static T parseUnsigned(Buffer<nlattr> buf) {
     return buf.data<T>().copyFirst();
 }
 
 template <>
-uint8_t Attributes::parse(nlbuf<nlattr> buf) {
+uint8_t Attributes::parse(Buffer<nlattr> buf) {
     return parseUnsigned<uint8_t>(buf);
 }
 
 template <>
-uint16_t Attributes::parse(nlbuf<nlattr> buf) {
+uint16_t Attributes::parse(Buffer<nlattr> buf) {
     return parseUnsigned<uint16_t>(buf);
 }
 
 template <>
-uint32_t Attributes::parse(nlbuf<nlattr> buf) {
+uint32_t Attributes::parse(Buffer<nlattr> buf) {
     return parseUnsigned<uint32_t>(buf);
 }
 
 template <>
-uint64_t Attributes::parse(nlbuf<nlattr> buf) {
+uint64_t Attributes::parse(Buffer<nlattr> buf) {
     return parseUnsigned<uint64_t>(buf);
 }
 
diff --git a/automotive/can/1.0/default/libnl++/NetlinkRequest.cpp b/automotive/can/1.0/default/libnl++/MessageFactory.cpp
similarity index 97%
rename from automotive/can/1.0/default/libnl++/NetlinkRequest.cpp
rename to automotive/can/1.0/default/libnl++/MessageFactory.cpp
index b12489c..0c6a331 100644
--- a/automotive/can/1.0/default/libnl++/NetlinkRequest.cpp
+++ b/automotive/can/1.0/default/libnl++/MessageFactory.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <libnl++/NetlinkRequest.h>
+#include <libnl++/MessageFactory.h>
 
 #include <android-base/logging.h>
 
diff --git a/automotive/can/1.0/default/libnl++/NetlinkSocket.cpp b/automotive/can/1.0/default/libnl++/Socket.cpp
similarity index 88%
rename from automotive/can/1.0/default/libnl++/NetlinkSocket.cpp
rename to automotive/can/1.0/default/libnl++/Socket.cpp
index 6f0f0c2..aac6416 100644
--- a/automotive/can/1.0/default/libnl++/NetlinkSocket.cpp
+++ b/automotive/can/1.0/default/libnl++/Socket.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <libnl++/NetlinkSocket.h>
+#include <libnl++/Socket.h>
 
 #include <libnl++/printer.h>
 
@@ -27,8 +27,7 @@
  */
 static constexpr bool kSuperVerbose = false;
 
-NetlinkSocket::NetlinkSocket(int protocol, unsigned int pid, uint32_t groups)
-    : mProtocol(protocol) {
+Socket::Socket(int protocol, unsigned int pid, uint32_t groups) : mProtocol(protocol) {
     mFd.reset(socket(AF_NETLINK, SOCK_RAW, protocol));
     if (!mFd.ok()) {
         PLOG(ERROR) << "Can't open Netlink socket";
@@ -48,7 +47,7 @@
     }
 }
 
-bool NetlinkSocket::send(nlmsghdr* nlmsg, size_t totalLen) {
+bool Socket::send(nlmsghdr* nlmsg, size_t totalLen) {
     if constexpr (kSuperVerbose) {
         nlmsg->nlmsg_seq = mSeq;
         LOG(VERBOSE) << (mFailed ? "(not) " : "")
@@ -79,7 +78,7 @@
     return true;
 }
 
-bool NetlinkSocket::send(const nlbuf<nlmsghdr>& msg, const sockaddr_nl& sa) {
+bool Socket::send(const Buffer<nlmsghdr>& msg, const sockaddr_nl& sa) {
     if constexpr (kSuperVerbose) {
         LOG(VERBOSE) << (mFailed ? "(not) " : "")
                      << "sending Netlink message: " << toString(msg, mProtocol);
@@ -96,12 +95,12 @@
     return true;
 }
 
-std::optional<nlbuf<nlmsghdr>> NetlinkSocket::receive(void* buf, size_t bufLen) {
+std::optional<Buffer<nlmsghdr>> Socket::receive(void* buf, size_t bufLen) {
     sockaddr_nl sa = {};
     return receive(buf, bufLen, sa);
 }
 
-std::optional<nlbuf<nlmsghdr>> NetlinkSocket::receive(void* buf, size_t bufLen, sockaddr_nl& sa) {
+std::optional<Buffer<nlmsghdr>> Socket::receive(void* buf, size_t bufLen, sockaddr_nl& sa) {
     if (mFailed) return std::nullopt;
 
     socklen_t saLen = sizeof(sa);
@@ -120,7 +119,7 @@
         return std::nullopt;
     }
 
-    nlbuf<nlmsghdr> msg(reinterpret_cast<nlmsghdr*>(buf), bytesReceived);
+    Buffer<nlmsghdr> msg(reinterpret_cast<nlmsghdr*>(buf), bytesReceived);
     if constexpr (kSuperVerbose) {
         LOG(VERBOSE) << "received " << toString(msg, mProtocol);
     }
@@ -128,8 +127,8 @@
 }
 
 /* TODO(161389935): Migrate receiveAck to use nlmsg<> internally. Possibly reuse
- * NetlinkSocket::receive(). */
-bool NetlinkSocket::receiveAck() {
+ * Socket::receive(). */
+bool Socket::receiveAck() {
     if (mFailed) return false;
 
     char buf[8192];
@@ -180,7 +179,7 @@
     return false;
 }
 
-std::optional<unsigned int> NetlinkSocket::getSocketPid() {
+std::optional<unsigned int> Socket::getSocketPid() {
     sockaddr_nl sa = {};
     socklen_t sasize = sizeof(sa);
     if (getsockname(mFd.get(), reinterpret_cast<sockaddr*>(&sa), &sasize) < 0) {
diff --git a/automotive/can/1.0/default/libnl++/common.cpp b/automotive/can/1.0/default/libnl++/common.cpp
index 7848646..74eee24 100644
--- a/automotive/can/1.0/default/libnl++/common.cpp
+++ b/automotive/can/1.0/default/libnl++/common.cpp
@@ -41,7 +41,7 @@
     return str;
 }
 
-uint16_t crc16(const nlbuf<uint8_t> data, uint16_t crc) {
+uint16_t crc16(const Buffer<uint8_t> data, uint16_t crc) {
     for (const auto byte : data.getRaw()) {
         crc ^= byte;
         for (unsigned i = 0; i < 8; i++) {
diff --git a/automotive/can/1.0/default/libnl++/common.h b/automotive/can/1.0/default/libnl++/common.h
index dc5777c..1d9dbab 100644
--- a/automotive/can/1.0/default/libnl++/common.h
+++ b/automotive/can/1.0/default/libnl++/common.h
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 
 #include <linux/can.h>
 #include <net/if.h>
@@ -54,6 +54,6 @@
  * \param crc Previous CRC16 value to continue calculating running checksum
  * \return CRC16 checksum
  */
-uint16_t crc16(const nlbuf<uint8_t> data, uint16_t crc = 0);
+uint16_t crc16(const Buffer<uint8_t> data, uint16_t crc = 0);
 
 }  // namespace android::nl
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/Attributes.h b/automotive/can/1.0/default/libnl++/include/libnl++/Attributes.h
index 082b97a..f16d997 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/Attributes.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/Attributes.h
@@ -17,7 +17,7 @@
 #pragma once
 
 #include <android-base/logging.h>
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 #include <libnl++/types.h>
 #include <utils/Mutex.h>
 
@@ -35,7 +35,7 @@
  * WARNING: this class is NOT thread-safe (it's safe to be used in multithreaded application, but
  * a single instance can only be used by a single thread - the one owning the underlying buffer).
  */
-class Attributes : private nlbuf<nlattr> {
+class Attributes : private Buffer<nlattr> {
   public:
     /**
      * Constructs empty attribute map.
@@ -47,7 +47,7 @@
      *
      * \param buffer Source buffer pointing at the first attribute.
      */
-    Attributes(nlbuf<nlattr> buffer);
+    Attributes(Buffer<nlattr> buffer);
 
     /**
      * Checks, if the map contains given attribute type (key).
@@ -131,7 +131,7 @@
     }
 
   private:
-    using Index = std::map<nlattrtype_t, nlbuf<nlattr>>;
+    using Index = std::map<nlattrtype_t, Buffer<nlattr>>;
 
     /**
      * Attribute index.
@@ -164,7 +164,7 @@
      * \return Parsed data.
      */
     template <typename T>
-    static T parse(nlbuf<nlattr> buf);
+    static T parse(Buffer<nlattr> buf);
 };
 
 }  // namespace android::nl
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/nlbuf.h b/automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h
similarity index 84%
rename from automotive/can/1.0/default/libnl++/include/libnl++/nlbuf.h
rename to automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h
index 7625020..a6f8f7a 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/nlbuf.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h
@@ -25,7 +25,7 @@
 namespace android::nl {
 
 /**
- * Buffer containing netlink structure (e.g. struct nlmsghdr, struct nlattr).
+ * Buffer wrapper containing netlink structure (e.g. struct nlmsghdr, struct nlattr).
  *
  * This is a C++-style, memory safe(r) and generic implementation of linux/netlink.h macros.
  *
@@ -33,7 +33,7 @@
  * not be trusted - the value may either be larger than the buffer message is allocated in or
  * smaller than the header itself (so it couldn't even fit itself).
  *
- * As a solution, nlbuf<> keeps track of two lengths (both attribute for header with payload):
+ * As a solution, Buffer<> keeps track of two lengths (both attribute for header with payload):
  * - buffer length - how much memory was allocated to a given structure
  * - declared length - what nlmsg_len or nla_len says how long the structure is
  *
@@ -42,7 +42,7 @@
  * this template attempts to protect against.
  */
 template <typename T>
-class nlbuf {
+class Buffer {
     // The following definitions are C++ equivalents of NLMSG_* macros from linux/netlink.h
 
     static constexpr size_t alignto = NLMSG_ALIGNTO;
@@ -56,15 +56,15 @@
     /**
      * Constructs empty buffer of size 0.
      */
-    nlbuf() : mData(nullptr), mBufferEnd(nullptr) {}
+    Buffer() : mData(nullptr), mBufferEnd(nullptr) {}
 
     /**
-     * Constructor for nlbuf.
+     * Buffer constructor.
      *
-     * \param data A pointer to the data the nlbuf wraps.
-     * \param bufferLen Length of buffer.
+     * \param data A pointer to the data the Buffer wraps.
+     * \param bufLen Length of the buffer.
      */
-    nlbuf(const T* data, size_t bufferLen) : mData(data), mBufferEnd(pointerAdd(data, bufferLen)) {}
+    Buffer(const T* data, size_t bufLen) : mData(data), mBufferEnd(pointerAdd(data, bufLen)) {}
 
     const T* operator->() const {
         CHECK(firstOk()) << "buffer can't fit the first element's header";
@@ -95,7 +95,7 @@
     bool firstOk() const { return sizeof(T) <= remainingLength(); }
 
     template <typename D>
-    const nlbuf<D> data(size_t offset = 0) const {
+    const Buffer<D> data(size_t offset = 0) const {
         // Equivalent to NLMSG_DATA(hdr) + NLMSG_ALIGN(offset)
         const D* dptr = reinterpret_cast<const D*>(uintptr_t(mData) + hdrlen + align(offset));
         return {dptr, dataEnd()};
@@ -106,7 +106,7 @@
         iterator() : mCurrent(nullptr, size_t(0)) {
             CHECK(!mCurrent.ok()) << "end() iterator should indicate it's beyond end";
         }
-        iterator(const nlbuf<T>& buf) : mCurrent(buf) {}
+        iterator(const Buffer<T>& buf) : mCurrent(buf) {}
 
         iterator operator++() {
             // mBufferEnd stays the same
@@ -123,10 +123,10 @@
             return uintptr_t(other.mCurrent.mData) == uintptr_t(mCurrent.mData);
         }
 
-        const nlbuf<T>& operator*() const { return mCurrent; }
+        const Buffer<T>& operator*() const { return mCurrent; }
 
       protected:
-        nlbuf<T> mCurrent;
+        Buffer<T> mCurrent;
     };
     iterator begin() const { return {*this}; }
     iterator end() const { return {}; }
@@ -142,7 +142,7 @@
 
     class raw_view {
       public:
-        raw_view(const nlbuf<T>& buffer) : mBuffer(buffer) {}
+        raw_view(const Buffer<T>& buffer) : mBuffer(buffer) {}
         raw_iterator begin() const { return {mBuffer}; }
         raw_iterator end() const { return {}; }
 
@@ -150,7 +150,7 @@
         size_t len() const { return mBuffer.remainingLength(); }
 
       private:
-        const nlbuf<T> mBuffer;
+        const Buffer<T> mBuffer;
     };
 
     raw_view getRaw() const { return {*this}; }
@@ -159,7 +159,7 @@
     const T* mData;
     const void* mBufferEnd;
 
-    nlbuf(const T* data, const void* bufferEnd) : mData(data), mBufferEnd(bufferEnd) {}
+    Buffer(const T* data, const void* bufferEnd) : mData(data), mBufferEnd(bufferEnd) {}
 
     bool ok() const { return declaredLength() <= remainingLength(); }
 
@@ -192,16 +192,16 @@
     }
 
     template <typename D>
-    friend class nlbuf;  // calling private constructor of data buffers
+    friend class Buffer;  // calling private constructor of data buffers
 };
 
 template <>
-inline size_t nlbuf<nlmsghdr>::declaredLengthImpl() const {
+inline size_t Buffer<nlmsghdr>::declaredLengthImpl() const {
     return mData->nlmsg_len;
 }
 
 template <>
-inline size_t nlbuf<nlattr>::declaredLengthImpl() const {
+inline size_t Buffer<nlattr>::declaredLengthImpl() const {
     return mData->nla_len;
 }
 
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/nlmsg.h b/automotive/can/1.0/default/libnl++/include/libnl++/Message.h
similarity index 86%
rename from automotive/can/1.0/default/libnl++/include/libnl++/nlmsg.h
rename to automotive/can/1.0/default/libnl++/include/libnl++/Message.h
index e9c9238..2b84a86 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/nlmsg.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/Message.h
@@ -17,7 +17,7 @@
 #pragma once
 
 #include <libnl++/Attributes.h>
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 
 namespace android::nl {
 
@@ -32,15 +32,15 @@
  * a single instance can only be used by a single thread - the one owning the underlying buffer).
  */
 template <typename T>
-class nlmsg {
+class Message {
   public:
     /**
-     * Validate buffer contents as a message carrying T data and create instance of nlmsg.
+     * Validate buffer contents as a message carrying T data and create instance of parsed message.
      *
      * \param buf Buffer containing the message.
      * \return Parsed message or nullopt, if the buffer data is invalid.
      */
-    static std::optional<nlmsg<T>> parse(nlbuf<nlmsghdr> buf) {
+    static std::optional<Message<T>> parse(Buffer<nlmsghdr> buf) {
         const auto& [nlOk, nlHeader] = buf.getFirst();
         if (!nlOk) return std::nullopt;
 
@@ -49,18 +49,18 @@
 
         const auto attributes = buf.data<nlattr>(sizeof(T));
 
-        return nlmsg<T>(nlHeader, dataHeader, attributes);
+        return Message<T>(nlHeader, dataHeader, attributes);
     }
 
     /**
-     * Validate buffer contents as a message of a given type and create instance of nlmsg.
+     * Validate buffer contents as a message of a given type and create instance of parsed message.
      *
      * \param buf Buffer containing the message.
      * \param msgtypes Acceptable message types (within a specific Netlink protocol)
      * \return Parsed message or nullopt, if the buffer data is invalid or message type
      *         doesn't match.
      */
-    static std::optional<nlmsg<T>> parse(nlbuf<nlmsghdr> buf, std::set<nlmsgtype_t> msgtypes) {
+    static std::optional<Message<T>> parse(Buffer<nlmsghdr> buf, std::set<nlmsgtype_t> msgtypes) {
         const auto& [nlOk, nlHeader] = buf.getFirst();  // we're doing it twice, but it's fine
         if (!nlOk) return std::nullopt;
 
@@ -91,7 +91,7 @@
     const T* operator->() const { return &data; }
 
   private:
-    nlmsg(const nlmsghdr& nlHeader, const T& dataHeader, Attributes attributes)
+    Message(const nlmsghdr& nlHeader, const T& dataHeader, Attributes attributes)
         : header(nlHeader), data(dataHeader), attributes(attributes) {}
 };
 
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/NetlinkRequest.h b/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h
similarity index 93%
rename from automotive/can/1.0/default/libnl++/include/libnl++/NetlinkRequest.h
rename to automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h
index 29c3601..e00ca20 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/NetlinkRequest.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h
@@ -25,7 +25,7 @@
 
 namespace android::nl {
 
-/** Implementation details, do not use outside NetlinkRequest template. */
+/** Implementation details, do not use outside MessageFactory template. */
 namespace impl {
 
 struct nlattr* addattr_l(struct nlmsghdr* n, size_t maxLen, nlattrtype_t type, const void* data,
@@ -43,7 +43,7 @@
  * \param BUFSIZE how much space to reserve for payload (not counting the header size)
  */
 template <class T, unsigned int BUFSIZE = 128>
-struct NetlinkRequest {
+struct MessageFactory {
     struct RequestData {
         struct nlmsghdr nlmsg;
         T data;
@@ -58,7 +58,7 @@
      * \param type Message type (such as RTM_NEWLINK)
      * \param flags Message flags (such as NLM_F_REQUEST)
      */
-    NetlinkRequest(nlmsgtype_t type, uint16_t flags) {
+    MessageFactory(nlmsgtype_t type, uint16_t flags) {
         mRequest.nlmsg.nlmsg_len = NLMSG_LENGTH(sizeof(mRequest.data));
         mRequest.nlmsg.nlmsg_type = type;
         mRequest.nlmsg.nlmsg_flags = flags;
@@ -96,11 +96,11 @@
 
     /** Guard class to frame nested attributes. See nest(int). */
     struct Nest {
-        Nest(NetlinkRequest& req, nlattrtype_t type) : mReq(req), mAttr(req.nestStart(type)) {}
+        Nest(MessageFactory& req, nlattrtype_t type) : mReq(req), mAttr(req.nestStart(type)) {}
         ~Nest() { mReq.nestEnd(mAttr); }
 
       private:
-        NetlinkRequest& mReq;
+        MessageFactory& mReq;
         struct nlattr* mAttr;
 
         DISALLOW_COPY_AND_ASSIGN(Nest);
@@ -114,7 +114,7 @@
      *
      * Example usage nesting IFLA_CAN_BITTIMING inside IFLA_INFO_DATA, which is nested
      * inside IFLA_LINKINFO:
-     *    NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
+     *    MessageFactory<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
      *    {
      *        auto linkinfo = req.nest(IFLA_LINKINFO);
      *        req.addattr(IFLA_INFO_KIND, "can");
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/NetlinkSocket.h b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h
similarity index 81%
rename from automotive/can/1.0/default/libnl++/include/libnl++/NetlinkSocket.h
rename to automotive/can/1.0/default/libnl++/include/libnl++/Socket.h
index f2a38fb..7685733 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/NetlinkSocket.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h
@@ -18,8 +18,8 @@
 
 #include <android-base/macros.h>
 #include <android-base/unique_fd.h>
-#include <libnl++/NetlinkRequest.h>
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
+#include <libnl++/MessageFactory.h>
 
 #include <linux/netlink.h>
 
@@ -33,9 +33,9 @@
  * This class is not thread safe to use a single instance between multiple threads, but it's fine to
  * use multiple instances over multiple threads.
  */
-struct NetlinkSocket {
+struct Socket {
     /**
-     * NetlinkSocket constructor.
+     * Socket constructor.
      *
      * \param protocol the Netlink protocol to use.
      * \param pid port id. Default value of 0 allows the kernel to assign us a unique pid. (NOTE:
@@ -44,7 +44,7 @@
      * bit is a different group. Default value of 0 means no groups are selected. See man netlink.7
      * for more details.
      */
-    NetlinkSocket(int protocol, unsigned int pid = 0, uint32_t groups = 0);
+    Socket(int protocol, unsigned int pid = 0, uint32_t groups = 0);
 
     /**
      * Send Netlink message to Kernel. The sequence number will be automatically incremented, and
@@ -54,7 +54,7 @@
      * \return true, if succeeded
      */
     template <class T, unsigned int BUFSIZE>
-    bool send(NetlinkRequest<T, BUFSIZE>& req) {
+    bool send(MessageFactory<T, BUFSIZE>& req) {
         if (!req.isGood()) return false;
         return send(req.header(), req.totalLength);
     }
@@ -66,16 +66,16 @@
      * \param sa Destination address.
      * \return true, if succeeded
      */
-    bool send(const nlbuf<nlmsghdr>& msg, const sockaddr_nl& sa);
+    bool send(const Buffer<nlmsghdr>& msg, const sockaddr_nl& sa);
 
     /**
      * Receive Netlink data.
      *
      * \param buf buffer to hold message data.
      * \param bufLen length of buf.
-     * \return nlbuf with message data, std::nullopt on error.
+     * \return Buffer with message data, std::nullopt on error.
      */
-    std::optional<nlbuf<nlmsghdr>> receive(void* buf, size_t bufLen);
+    std::optional<Buffer<nlmsghdr>> receive(void* buf, size_t bufLen);
 
     /**
      * Receive Netlink data with address info.
@@ -83,9 +83,9 @@
      * \param buf buffer to hold message data.
      * \param bufLen length of buf.
      * \param sa Blank struct that recvfrom will populate with address info.
-     * \return nlbuf with message data, std::nullopt on error.
+     * \return Buffer with message data, std::nullopt on error.
      */
-    std::optional<nlbuf<nlmsghdr>> receive(void* buf, size_t bufLen, sockaddr_nl& sa);
+    std::optional<Buffer<nlmsghdr>> receive(void* buf, size_t bufLen, sockaddr_nl& sa);
 
     /**
      * Receive Netlink ACK message from Kernel.
@@ -110,7 +110,7 @@
 
     bool send(nlmsghdr* msg, size_t totalLen);
 
-    DISALLOW_COPY_AND_ASSIGN(NetlinkSocket);
+    DISALLOW_COPY_AND_ASSIGN(Socket);
 };
 
 }  // namespace android::nl
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/printer.h b/automotive/can/1.0/default/libnl++/include/libnl++/printer.h
index 7167965..53a06d8 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/printer.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/printer.h
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 
 #include <linux/netlink.h>
 
@@ -32,6 +32,6 @@
  * \param printPayload True will stringify message data, false will only stringify the header(s).
  * \return Stringified message.
  */
-std::string toString(const nlbuf<nlmsghdr> hdr, int protocol, bool printPayload = false);
+std::string toString(const Buffer<nlmsghdr> hdr, int protocol, bool printPayload = false);
 
 }  // namespace android::nl
diff --git a/automotive/can/1.0/default/libnl++/printer.cpp b/automotive/can/1.0/default/libnl++/printer.cpp
index c32afb3..9735db1 100644
--- a/automotive/can/1.0/default/libnl++/printer.cpp
+++ b/automotive/can/1.0/default/libnl++/printer.cpp
@@ -20,7 +20,7 @@
 #include "protocols/all.h"
 
 #include <android-base/logging.h>
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 
 #include <algorithm>
 #include <iomanip>
@@ -61,7 +61,7 @@
     }
 }
 
-static void toStream(std::stringstream& ss, const nlbuf<uint8_t> data) {
+static void toStream(std::stringstream& ss, const Buffer<uint8_t> data) {
     const auto rawData = data.getRaw();
     const auto dataLen = rawData.len();
     ss << std::hex;
@@ -77,7 +77,7 @@
     if (dataLen > 16) ss << std::endl;
 }
 
-static void toStream(std::stringstream& ss, const nlbuf<nlattr> attr,
+static void toStream(std::stringstream& ss, const Buffer<nlattr> attr,
                      const protocols::AttributeMap& attrMap) {
     using DataType = protocols::AttributeDefinition::DataType;
     const auto attrtype = attrMap[attr->nla_type];
@@ -115,7 +115,7 @@
     }
 }
 
-std::string toString(const nlbuf<nlmsghdr> hdr, int protocol, bool printPayload) {
+std::string toString(const Buffer<nlmsghdr> hdr, int protocol, bool printPayload) {
     if (!hdr.firstOk()) return "nlmsg{buffer overflow}";
 
     std::stringstream ss;
diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
index 046ef47..ef73d09 100644
--- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
+++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 #include <libnl++/types.h>
 
 #include <map>
@@ -60,7 +60,7 @@
         Uint,
         Struct,
     };
-    using ToStream = std::function<void(std::stringstream& ss, const nlbuf<nlattr> attr)>;
+    using ToStream = std::function<void(std::stringstream& ss, const Buffer<nlattr> attr)>;
 
     std::string name;
     DataType dataType = DataType::Raw;
@@ -86,7 +86,7 @@
     const MessageTypeMap& getMessageTypeMap() const;
     const AttributeMap& getAttributeMap() const;
     const std::string getMessageName(nlmsgtype_t msgtype) const;
-    virtual void dataToStream(std::stringstream& ss, const nlbuf<nlmsghdr> hdr) const = 0;
+    virtual void dataToStream(std::stringstream& ss, const Buffer<nlmsghdr> hdr) const = 0;
 
   private:
     const std::string mName;
@@ -109,7 +109,7 @@
             const std::initializer_list<AttributeMap::value_type> attrTypes = {})
         : MessageDescriptor(name, messageTypes, attrTypes, sizeof(T)) {}
 
-    void dataToStream(std::stringstream& ss, const nlbuf<nlmsghdr> hdr) const override {
+    void dataToStream(std::stringstream& ss, const Buffer<nlmsghdr> hdr) const override {
         const auto& [ok, msg] = hdr.data<T>().getFirst();
         if (!ok) {
             ss << "{incomplete payload}";
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp b/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp
index ea923bb..b62cec3 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp
@@ -18,7 +18,7 @@
 
 namespace android::nl::protocols::route {
 
-void mapToStream(std::stringstream& ss, const nlbuf<nlattr> attr) {
+void mapToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
     const auto& [ok, data] = attr.data<rtnl_link_ifmap>().getFirst();
     if (!ok) {
         ss << "invalid structure";
@@ -33,7 +33,7 @@
        << unsigned(data.port) << '}';
 }
 
-void ifla_cacheinfoToStream(std::stringstream& ss, const nlbuf<nlattr> attr) {
+void ifla_cacheinfoToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
     const auto& [ok, data] = attr.data<ifla_cacheinfo>().getFirst();
     if (!ok) {
         ss << "invalid structure";
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.h b/automotive/can/1.0/default/libnl++/protocols/route/structs.h
index 38776fa..b9d622a 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/structs.h
+++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.h
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <libnl++/nlbuf.h>
+#include <libnl++/Buffer.h>
 
 #include <linux/rtnetlink.h>
 
@@ -25,13 +25,13 @@
 namespace android::nl::protocols::route {
 
 // rtnl_link_ifmap
-void mapToStream(std::stringstream& ss, const nlbuf<nlattr> attr);
+void mapToStream(std::stringstream& ss, const Buffer<nlattr> attr);
 
 // ifla_cacheinfo
-void ifla_cacheinfoToStream(std::stringstream& ss, const nlbuf<nlattr> attr);
+void ifla_cacheinfoToStream(std::stringstream& ss, const Buffer<nlattr> attr);
 
 template <typename T>
-void arrayToStream(std::stringstream& ss, const nlbuf<nlattr> attr) {
+void arrayToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
     ss << '{';
     for (const auto it : attr.data<T>().getRaw()) {
         ss << it << ',';
@@ -42,7 +42,7 @@
 
 // rtnl_link_stats or rtnl_link_stats64
 template <typename T>
-void statsToStream(std::stringstream& ss, const nlbuf<nlattr> attr) {
+void statsToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
     const auto& [ok, data] = attr.data<T>().getFirst();
     if (!ok) {
         ss << "invalid structure";