ppd/include/msg.hh
2023-03-14 14:30:03 +01:00

17 lines
415 B
C++

#pragma once
#include <cstdint>
#include <cstddef>
// Max 16MB per message
struct __attribute__((packed)) ppd_msg {
uint32_t size;
char data[0];
};
static constexpr int PPD_MSG_MAX_SZ = 1024 * 16 * 1024;
static constexpr int PPD_MSG_HDR_SZ = offsetof(ppd_msg, data);
static_assert(PPD_MSG_HDR_SZ == sizeof(struct ppd_msg));
static constexpr int PPD_MSG_MAX_DATA_SZ = (PPD_MSG_MAX_SZ - PPD_MSG_HDR_SZ);