VLink  2.0.0
A high-performance communication middleware
proxy_data.h 文件参考

Routing envelope used by the VLink proxy / monitoring path. 更多...

#include <cstdint>
#include <string_view>
#include "../base/bytes.h"
proxy_data.h 的引用(Include)关系图:

浏览源代码.

命名空间

 
 

函数

struct vlink::zerocopy::VLINK_EXPORT_AND_ALIGNED (8) AudioFrame final
 

详细描述

Routing envelope used by the VLink proxy / monitoring path.

ProxyData bundles a serialised user payload with the metadata that the VLink proxy subsystem needs to forward the message across hosts: topic URL, serialisation type label, source hostname, plus control fields (control id, mode, microsecond timestamp, sequence number, coarse schema family). All variable-length regions share a single owned allocation so a freshly deserialised envelope can expose each region as a string_view or shallow Bytes without further allocation.

Region Meaning
raw Serialised user message bytes
url Topic URL (e.g. "dds://my/topic")
ser Serialisation type label (e.g. "proto.MyMsg")
hostname Source machine identifier (optional)
Wire format
ProxyData is POD; memcpy serialises the struct. The sizeof value is locked by static_assert and forms a permanent contract: the vlink::zerocopy::* containers have NO forward or backward binary compatibility across releases. Pointer / ownership fields inside the wire snapshot must NEVER be interpreted by remote consumers.
static_assert(sizeof(ProxyData) == 80, "Sizeof must be 80 bytes.");
80-byte POD envelope packing payload, URL, serialisation type and host string.
Memory layout
Offset Size Field
------ ---- ---------------------------------
0 8 uint8_t* data_
8 8 size_t size_
16 4 uint32_t control_id_
20 4 uint32_t mode_
24 8 int64_t timestamp_
32 8 int64_t seq_
40 4 uint32_t data_pos_
44 4 uint32_t data_size_
48 4 uint32_t url_pos_
52 4 uint32_t url_size_
56 4 uint32_t ser_pos_
60 4 uint32_t ser_size_
64 4 uint32_t hostname_pos_
68 4 uint32_t hostname_size_
72 4 uint32_t schema_
76 1 bool is_owner_
77 1 uint8_t reserved_buf_
78 2 uint16_t reserved_buf2_
------ ---- ---------------------------------
Total 80 bytes (alignas 8)
Wire envelope:
[ magic_begin (4) | version (4) | ProxyData struct (80) | raw | url | ser | hostname | magic_end (4) ]
Reserved bytes
The 3 bytes that follow is_owner_ are exposed as two explicit wire-locked fields: uint8_t reserved_buf_ (offset 77) and uint16_t reserved_buf2_ (offset 78), reachable through get_reserved() / get_reserved2(). They travel through the wire format and are carried by the copy / move helpers, but MUST NOT be repurposed by application code: future library revisions may bind them to real fields.
Example
vlink::zerocopy::ProxyData envelope;
envelope.set_control_id(42);
envelope.set_timestamp(vlink::time_us());
envelope.create(payload, "dds://lidar/top", "proto.PointCloud",
static_cast<uint32_t>(SchemaType::kProtobuf), "host-a");
envelope >> wire;
vlink::zerocopy::ProxyData rx;
rx << wire;
auto url = rx.url();