From 864d20b8493d931358211716687cdb075d75c6e0 Mon Sep 17 00:00:00 2001 From: Gregor Reitzenstein Date: Sun, 10 May 2020 16:37:39 +0200 Subject: [PATCH] Update schema --- auth.capnp | 3 +++ connection.capnp | 32 +++++++++++++------------------- rust.capnp | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 rust.capnp diff --git a/auth.capnp b/auth.capnp index 7e121f3..3931d31 100644 --- a/auth.capnp +++ b/auth.capnp @@ -22,6 +22,9 @@ @0x81ac94a588025602; +using Rust = import "rust.capnp"; +$Rust.parentModule("auth"); + # ============================================================================== # SASL Notes: # diff --git a/connection.capnp b/connection.capnp index a97c145..f685dfe 100644 --- a/connection.capnp +++ b/connection.capnp @@ -24,34 +24,28 @@ using Auth = import "auth.capnp"; using Api = import "api.capnp"; +using Rpc = import "rpc.capnp"; struct Message { union { - hello @0 :Hello; - bye @1 :Bye; - starttls @2 :Void; - auth @3 :Auth.AuthMessage; - bootstrap @4 :Api.Diflouroborane; + open @0 :Open; + # Initialize a connection to the other end + + close @1 :Void; + # The stream can be closed by either end at any time by sending this + # tag. + + auth @2 :Auth.AuthMessage; + # Start an authenticaion exchange + + # TODO: RPC & Crypto } } -struct Hello { +struct Open { # Be nice and say hello to each other first # A client sends this message to a server first thing major @0 :UInt32; # The major part of the API version minor @1 :UInt32; # The minor part of the API version } - -struct Bye { - # Tear down a connection nicely. - - enum Reason { - unset @0; # Just cause - - versionMismatch @1; - # The server doesn't implement a compatible version of the protocol - } - - reason @0 :Reason; -} diff --git a/rust.capnp b/rust.capnp new file mode 100644 index 0000000..f16ea94 --- /dev/null +++ b/rust.capnp @@ -0,0 +1,24 @@ +# This file contains annotations that are recognized by the capnpc-rust code generator. + +@0x83b3c14c3c8dd083; + +annotation name @0xc2fe4c6d100166d0 (field, struct, enum, enumerant, union, group) :Text; +# Rename something in the generated code. The value that you specify in this +# annotation should follow capnp capitalization conventions. So, for example, +# a struct should use CamelCase capitalization like `StructFoo`, even though +# that will get translated to a `struct_foo` module in the generated Rust code. +# +# TODO: support annotating more kinds of things with this. + +annotation parentModule @0xabee386cd1450364 (file) :Text; +# A Rust module path indicating where the generated code will be included. +# For example, if this is set to "foo::bar" and the schema file is named +# "baz.capnp", then you could include the generated code like this: +# +# pub mod foo { +# pub mod bar { +# pub mod baz_capnp { +# include!(concat!(env!("OUT_DIR"), "/baz_capnp.rs")); +# } +# } +# }