diff options
Diffstat (limited to 'abi/wire.zig')
| -rw-r--r-- | abi/wire.zig | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/abi/wire.zig b/abi/wire.zig index 5f8e1f97..88a82e52 100644 --- a/abi/wire.zig +++ b/abi/wire.zig @@ -10,6 +10,9 @@ const pardes = @import("core"); const config = @import("pardes_options"); const build_info = @import("build_info"); +/// 27: a pair's first client makes its own core from the session's +/// options and says its digest (`boot`) before its `far`: the session sends +/// no dump when its own at the join has the same; /// 26: a view kept for its client's rejoin says when it went away /// (View.away_ns), and is that client's for Views.away_kept_ns; /// 25: the 9P state a session's requests made (its open records, each @@ -43,7 +46,7 @@ const build_info = @import("build_info"); /// part B); 14: the hello names a session and /// carries the semantics hash, and a ping is answered (phase 5's /// groundwork); 13: the frames went (phase 3). -pub const version: u16 = 26; +pub const version: u16 = 27; /// The terminal's build and the window's step alike (`semantics`). const family = switch (config.platform) { @@ -117,6 +120,12 @@ pub const ClientTag = enum(u8) { /// guessed them for the input that follows: its time, which the step /// reads (core/replica.zig). stamp = 0x08, + /// A pair's first client's word before its `far`: the digest of the + /// core it made itself, from the session's options (Options.pair): + /// the session's at the join the same, no dump is sent. Not 0x09: a + /// stream's reader (replica.zig `Framer`) unpacks that tag as zstd + /// whichever way the stream runs. + boot = 0x0a, key = 0x10, mouse = 0x11, @@ -313,6 +322,7 @@ pub const ClientMsg = union(enum) { far: bool, want: []const u8, stamp: [2]i64, + boot: u64, event: pardes.Event, }; @@ -524,7 +534,7 @@ pub fn encodeClient(out: []u8, msg: ClientMsg) Error![]const u8 { }, // 0 it leaves, 1 it joins again, 2 its window was closed. .bye => |b| try w.writeByte(if (b.close) 2 else @intFromBool(b.again)), - .ping => |v| try w.writeInt(u64, v, .little), + .ping, .boot => |v| try w.writeInt(u64, v, .little), .screen_ack, .want => |bytes| try w.writeAll(bytes), .check => {}, .far => |far| try w.writeByte(@intFromBool(far)), @@ -605,6 +615,7 @@ pub fn decodeClient(tag: u8, payload: []const u8) Error!ClientMsg { .far => .{ .far = try getBool(&r) }, .want => return .{ .want = payload }, .stamp => .{ .stamp = .{ try r.takeInt(i64, .little), try r.takeInt(i64, .little) } }, + .boot => .{ .boot = try r.takeInt(u64, .little) }, .key => blk: { const cp = try r.takeInt(u32, .little); // `Key.cp` is a u21, and the specials live in the private-use @@ -661,7 +672,7 @@ const msg_slack = header_len + 64; pub fn clientBound(msg: ClientMsg) usize { return msg_slack + switch (msg) { .hello => |h| h.session.len, - .bye, .ping, .check, .far, .stamp => 0, + .bye, .ping, .check, .far, .stamp, .boot => 0, .screen_ack, .want => |bytes| bytes.len, .event => |ev| switch (ev) { // Its hits' places (14 bytes each) past the slack. @@ -788,6 +799,8 @@ test "detached wire: a session is never told to do a frontend's remembering" { "hello", "bye", "ping", "screen_ack", "check", // ...and how far it is, and which of the join's blobs it lacks. "far", "want", + // ...and the digest of the core it made itself (a pair's). + "boot", // ...and when its next input was, by the session's clocks. "stamp", // ...and everything a person can do to a window. |
