VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
proxy_data.h File Reference

Zero-copy proxy message envelope carrying raw payload plus routing metadata. More...

#include <cstdint>
#include <string_view>
#include "../base/bytes.h"
Include dependency graph for proxy_data.h:

Go to the source code of this file.

Namespaces

Functions

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

Detailed Description

Zero-copy proxy message envelope carrying raw payload plus routing metadata.

ProxyData is used by the VLink proxy layer to bundle a serialised message with its routing context (URL, serialisation type, source hostname) and control fields (control ID, mode, timestamp, sequence number) into a single flat allocation.

The struct is exactly 80 bytes on 64-bit platforms. Internally a single owned buffer is laid out as:

[ raw data | url string | ser type string | hostname string ]

Position and length of each region are stored as uint32_t fields in the struct itself so that after binary round-trip the sub-buffers can be accessed as std::string_view without additional allocation.

Binary wire format
[ magic_begin (4) | ProxyData struct (80) | variable payload | magic_end (4) ]
Proxy routing envelope: raw payload bundled with URL, serialisation type, and hostname.
Usage
vlink::zerocopy::ProxyData pd;
pd.set_control_id(42);
pd.set_timestamp(get_time_us());
pd.create(raw_bytes, "dds://my/topic", "demo.proto.PointCloud",
static_cast<uint32_t>(SchemaType::kProtobuf), "host01");
pd >> wire; // serialise
vlink::zerocopy::ProxyData pd2;
pd2 << wire; // deserialise (zero-copy, borrows wire)
auto url = pd2.url(); // std::string_view into wire
Note
  • 32-bit architectures emit a compile-time warning and are not supported.
  • After operator<<, all sub-buffer string_views reference memory inside the source Bytes. The Bytes must outlive the ProxyData.
  • is_valid() performs an additional internal consistency check that all position + size values are contiguous and sum correctly.