Update schema

This commit is contained in:
Gregor Reitzenstein 2020-05-10 16:37:39 +02:00
parent 16a4aba76a
commit 864d20b849
3 changed files with 40 additions and 19 deletions

View File

@ -22,6 +22,9 @@
@0x81ac94a588025602;
using Rust = import "rust.capnp";
$Rust.parentModule("auth");
# ==============================================================================
# SASL Notes:
#

View File

@ -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;
}

24
rust.capnp Normal file
View File

@ -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"));
# }
# }
# }