flatbuffer base
This commit is contained in:
27
flatbuffers/stream/stream.fbs
Normal file
27
flatbuffers/stream/stream.fbs
Normal file
@@ -0,0 +1,27 @@
|
||||
include "stream_reg.fbs";
|
||||
include "stream_data.fbs";
|
||||
|
||||
namespace hmmmm.stream;
|
||||
|
||||
// ── Client → Server ──────────────────────────────────────────────────────────
|
||||
|
||||
union StreamClientPayload {
|
||||
StreamRegRequest,
|
||||
StreamDeregRequest,
|
||||
StreamWritePush,
|
||||
}
|
||||
|
||||
table StreamClientMessage {
|
||||
payload: StreamClientPayload;
|
||||
}
|
||||
|
||||
// ── Server → Client ──────────────────────────────────────────────────────────
|
||||
|
||||
union StreamServerPayload {
|
||||
StreamRegConfirm,
|
||||
StreamDataPush,
|
||||
}
|
||||
|
||||
table StreamServerMessage {
|
||||
payload: StreamServerPayload;
|
||||
}
|
||||
18
flatbuffers/stream/stream_data.fbs
Normal file
18
flatbuffers/stream/stream_data.fbs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace hmmmm.stream;
|
||||
|
||||
// Server → Client: memory region snapshot pushed by the server.
|
||||
// tclk is the virtual clock tick at which this data became valid —
|
||||
// clients may buffer and apply it at the appropriate simulation point.
|
||||
table StreamDataPush {
|
||||
stream_id: uint32;
|
||||
tclk: uint64;
|
||||
data: [ubyte];
|
||||
}
|
||||
|
||||
// Client → Server: write into a registered write-mode stream.
|
||||
// offset is relative to the registered region start.
|
||||
table StreamWritePush {
|
||||
stream_id: uint32;
|
||||
offset: uint32;
|
||||
data: [ubyte];
|
||||
}
|
||||
32
flatbuffers/stream/stream_reg.fbs
Normal file
32
flatbuffers/stream/stream_reg.fbs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace hmmmm.stream;
|
||||
|
||||
enum StreamMode: byte {
|
||||
mode_read = 0,
|
||||
mode_write = 1,
|
||||
}
|
||||
|
||||
// Client → Server: subscribe to a memory region.
|
||||
table StreamRegRequest {
|
||||
device_id: uint32; // from DeviceIdMappingNotif
|
||||
seg_id: uint32; // from DeviceIdMappingNotif
|
||||
offset: uint32; // start offset within segment, in bytes
|
||||
length: uint32; // region length, in bytes
|
||||
mode: StreamMode;
|
||||
}
|
||||
|
||||
// Client → Server: cancel a stream subscription.
|
||||
// No confirmation is sent by the server.
|
||||
table StreamDeregRequest {
|
||||
stream_id: uint32;
|
||||
}
|
||||
|
||||
// Server → Client: subscription confirmed, stream_id assigned.
|
||||
// Echoes the original request fields for client-side reconciliation.
|
||||
table StreamRegConfirm {
|
||||
stream_id: uint32;
|
||||
device_id: uint32;
|
||||
seg_id: uint32;
|
||||
offset: uint32;
|
||||
length: uint32;
|
||||
mode: StreamMode;
|
||||
}
|
||||
Reference in New Issue
Block a user