]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/include/encoding.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / include / encoding.h
index 49f2f77be30bb246e48b8c4ce413773a72fcfb6b..40ba9d39c76f819573c181cd41de5ad59be86b38 100644 (file)
@@ -246,6 +246,23 @@ inline void encode(const char *s, bufferlist& bl)
   encode(std::string_view(s, strlen(s)), bl);
 }
 
+// opaque byte vectors
+inline void encode(std::vector<uint8_t>& v, bufferlist& bl)
+{
+  uint32_t len = v.size();
+  encode(len, bl);
+  if (len)
+    bl.append((char *)v.data(), len);
+}
+
+inline void decode(std::vector<uint8_t>& v, bufferlist::const_iterator& p)
+{
+  uint32_t len;
+
+  decode(len, p);
+  v.resize(len);
+  p.copy(len, (char *)v.data());
+}
 
 // -----------------------------
 // buffers