14 assert(size < 0x80000000);
15 void *raw =
operator new(offsetof(
message_t, buf_[size + 4]));
17 throw std::bad_alloc();
19 *
reinterpret_cast<std::uint32_t *
>(m->
raw_data()) =
27 const char *p =
reinterpret_cast<const char *
>(pr);
28 std::memcpy(buf, p, len);
35 pr =
reinterpret_cast<const std::uint32_t *
>(p);
41 char *p =
reinterpret_cast<char *
>(pr);
42 std::memcpy(p, buf, len);
48 pr =
reinterpret_cast<std::uint32_t *
>(p);
static void get_bytes(const std::uint32_t *&pr, void *buf, std::size_t len)
Copy len bytes to buf, then consume 0-3 bytes of padding to make the total number of bytes consumed d...
static msg_ptr alloc(std::size_t size)
Allocate a new buffer.
Most of the xdrpp library is encapsulated in the xdr namespace.
Constexpr std::uint32_t swap32le(std::uint32_t v)
Byteswap 32-bit value only on little-endian machines, identity function on big-endian machines...
Message buffer, with room at beginning for 4-byte length.
static void put_bytes(std::uint32_t *&pr, const void *buf, std::size_t len)
Copy len bytes from buf, then add 0-3 zero-valued padding bytes to make the overall marshaled length ...
Support for marshaling XDR types in the format specified by RFC4506.
Padding bytes that should have contained zero don't.
char * raw_data()
4-byte buffer to store size in network byte order, followed by data.