mirror of
https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git
synced 2025-03-12 06:41:51 +01:00
added annotations to api.capnp to resolve name conflicts in csharp
This commit is contained in:
parent
53ff3665a9
commit
6faafddf80
14
api.capnp
14
api.capnp
@ -25,6 +25,8 @@
|
||||
using Rust = import "rust.capnp";
|
||||
$Rust.parentModule("schema");
|
||||
|
||||
using CSharp = import "csharp.capnp";
|
||||
|
||||
struct FabAccess {
|
||||
permissions @0 :Permissions;
|
||||
# Permission subsystem to manage permissions and systems underlying the authorization process
|
||||
@ -92,13 +94,13 @@ struct Machine {
|
||||
}
|
||||
|
||||
read @0 :Read;
|
||||
interface Read {
|
||||
interface Read $CSharp.name("ReadInterface") {
|
||||
info @0 () -> ( minfo :MInfo );
|
||||
# Check the state of a machine.
|
||||
}
|
||||
|
||||
write @1 :Write;
|
||||
interface Write {
|
||||
interface Write $CSharp.name("WriteInterface") {
|
||||
use @0 () -> ( ret :GiveBack );
|
||||
# Try to use a machine. Returns a NULL-ptr if the user does not have the required
|
||||
# permissions to use this machine
|
||||
@ -115,7 +117,7 @@ struct Machine {
|
||||
# After a machine has been used by an user with low enough permissions it's
|
||||
# in the 'toCheck' state. This call then allows more priviledged users to
|
||||
# "check" the machine and move it to the `free` state.
|
||||
interface Manage {
|
||||
interface Manage $CSharp.name("ManageInterface") {
|
||||
ok @0 () -> (); # The machine was clean & ok. -> free
|
||||
notOk @1 () -> ();
|
||||
# The machine was left in an unacceptable state.
|
||||
@ -125,7 +127,7 @@ struct Machine {
|
||||
admin @3 :Admin;
|
||||
# Administrative overrides. This is only not-NULL if you have the required permissions
|
||||
# to use it.
|
||||
interface Admin{
|
||||
interface Admin $CSharp.name("AdminInterface") {
|
||||
forceSetState @0 ( state :State ) -> (); # Forcefully set a machine state
|
||||
forceSetUser @1 ( user :Text ) -> (); # Set the given user as current responsible
|
||||
}
|
||||
@ -139,12 +141,12 @@ struct User {
|
||||
}
|
||||
|
||||
read @0 :Read;
|
||||
interface Read {
|
||||
interface Read $CSharp.name("ReadInterface") {
|
||||
info @0 () -> ( uinfo :UserInformation );
|
||||
}
|
||||
|
||||
write @1 :Write;
|
||||
interface Write {
|
||||
interface Write $CSharp.name("WriteInterface") {
|
||||
setName @0 ( name :Text ) -> ();
|
||||
}
|
||||
}
|
||||
|
2231
api.capnp.cs
Normal file
2231
api.capnp.cs
Normal file
File diff suppressed because it is too large
Load Diff
663
auth.capnp.cs
Normal file
663
auth.capnp.cs
Normal file
@ -0,0 +1,663 @@
|
||||
using Capnp;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapnpGen
|
||||
{
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xd82dcd751f51b615UL)]
|
||||
public class AuthMessage : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0xd82dcd751f51b615UL;
|
||||
public enum WHICH : ushort
|
||||
{
|
||||
Mechanisms = 0,
|
||||
Request = 1,
|
||||
Challenge = 2,
|
||||
Response = 3,
|
||||
Outcome = 4,
|
||||
Abort = 5,
|
||||
undefined = 65535
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
switch (reader.which)
|
||||
{
|
||||
case WHICH.Mechanisms:
|
||||
Mechanisms = reader.Mechanisms;
|
||||
break;
|
||||
case WHICH.Request:
|
||||
Request = CapnpSerializable.Create<CapnpGen.Request>(reader.Request);
|
||||
break;
|
||||
case WHICH.Challenge:
|
||||
Challenge = reader.Challenge;
|
||||
break;
|
||||
case WHICH.Response:
|
||||
Response = reader.Response;
|
||||
break;
|
||||
case WHICH.Outcome:
|
||||
Outcome = CapnpSerializable.Create<CapnpGen.Outcome>(reader.Outcome);
|
||||
break;
|
||||
case WHICH.Abort:
|
||||
which = reader.which;
|
||||
break;
|
||||
}
|
||||
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
private WHICH _which = WHICH.undefined;
|
||||
private object _content;
|
||||
public WHICH which
|
||||
{
|
||||
get => _which;
|
||||
set
|
||||
{
|
||||
if (value == _which)
|
||||
return;
|
||||
_which = value;
|
||||
switch (value)
|
||||
{
|
||||
case WHICH.Mechanisms:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Request:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Challenge:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Response:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Outcome:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Abort:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.which = which;
|
||||
switch (which)
|
||||
{
|
||||
case WHICH.Mechanisms:
|
||||
writer.Mechanisms.Init(Mechanisms);
|
||||
break;
|
||||
case WHICH.Request:
|
||||
Request?.serialize(writer.Request);
|
||||
break;
|
||||
case WHICH.Challenge:
|
||||
writer.Challenge.Init(Challenge);
|
||||
break;
|
||||
case WHICH.Response:
|
||||
writer.Response.Init(Response);
|
||||
break;
|
||||
case WHICH.Outcome:
|
||||
Outcome?.serialize(writer.Outcome);
|
||||
break;
|
||||
case WHICH.Abort:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public IReadOnlyList<string> Mechanisms
|
||||
{
|
||||
get => _which == WHICH.Mechanisms ? (IReadOnlyList<string>)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Mechanisms;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CapnpGen.Request Request
|
||||
{
|
||||
get => _which == WHICH.Request ? (CapnpGen.Request)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Request;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<byte> Challenge
|
||||
{
|
||||
get => _which == WHICH.Challenge ? (IReadOnlyList<byte>)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Challenge;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<byte> Response
|
||||
{
|
||||
get => _which == WHICH.Response ? (IReadOnlyList<byte>)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Response;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome Outcome
|
||||
{
|
||||
get => _which == WHICH.Outcome ? (CapnpGen.Outcome)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Outcome;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public WHICH which => (WHICH)ctx.ReadDataUShort(0U, (ushort)0);
|
||||
public IReadOnlyList<string> Mechanisms => which == WHICH.Mechanisms ? ctx.ReadList(0).CastText2() : default;
|
||||
public CapnpGen.Request.READER Request => which == WHICH.Request ? ctx.ReadStruct(0, CapnpGen.Request.READER.create) : default;
|
||||
public IReadOnlyList<byte> Challenge => which == WHICH.Challenge ? ctx.ReadList(0).CastByte() : default;
|
||||
public IReadOnlyList<byte> Response => which == WHICH.Response ? ctx.ReadList(0).CastByte() : default;
|
||||
public CapnpGen.Outcome.READER Outcome => which == WHICH.Outcome ? ctx.ReadStruct(0, CapnpGen.Outcome.READER.create) : default;
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
this.SetStruct(1, 1);
|
||||
}
|
||||
|
||||
public WHICH which
|
||||
{
|
||||
get => (WHICH)this.ReadDataUShort(0U, (ushort)0);
|
||||
set => this.WriteData(0U, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public ListOfTextSerializer Mechanisms
|
||||
{
|
||||
get => which == WHICH.Mechanisms ? BuildPointer<ListOfTextSerializer>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public CapnpGen.Request.WRITER Request
|
||||
{
|
||||
get => which == WHICH.Request ? BuildPointer<CapnpGen.Request.WRITER>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public ListOfPrimitivesSerializer<byte> Challenge
|
||||
{
|
||||
get => which == WHICH.Challenge ? BuildPointer<ListOfPrimitivesSerializer<byte>>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public ListOfPrimitivesSerializer<byte> Response
|
||||
{
|
||||
get => which == WHICH.Response ? BuildPointer<ListOfPrimitivesSerializer<byte>>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome.WRITER Outcome
|
||||
{
|
||||
get => which == WHICH.Outcome ? BuildPointer<CapnpGen.Outcome.WRITER>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x80d8dfaa4dbfbb83UL)]
|
||||
public class Request : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0x80d8dfaa4dbfbb83UL;
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
Mechanism = reader.Mechanism;
|
||||
InitialResponse = CapnpSerializable.Create<CapnpGen.Request.initialResponse>(reader.InitialResponse);
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.Mechanism = Mechanism;
|
||||
InitialResponse?.serialize(writer.InitialResponse);
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public string Mechanism
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public CapnpGen.Request.initialResponse InitialResponse
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public string Mechanism => ctx.ReadText(0, null);
|
||||
public initialResponse.READER InitialResponse => new initialResponse.READER(ctx);
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
this.SetStruct(1, 2);
|
||||
}
|
||||
|
||||
public string Mechanism
|
||||
{
|
||||
get => this.ReadText(0, null);
|
||||
set => this.WriteText(0, value, null);
|
||||
}
|
||||
|
||||
public initialResponse.WRITER InitialResponse
|
||||
{
|
||||
get => Rewrap<initialResponse.WRITER>();
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xcb5a6f246a9c7196UL)]
|
||||
public class initialResponse : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0xcb5a6f246a9c7196UL;
|
||||
public enum WHICH : ushort
|
||||
{
|
||||
None = 0,
|
||||
Initial = 1,
|
||||
undefined = 65535
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
switch (reader.which)
|
||||
{
|
||||
case WHICH.None:
|
||||
which = reader.which;
|
||||
break;
|
||||
case WHICH.Initial:
|
||||
Initial = reader.Initial;
|
||||
break;
|
||||
}
|
||||
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
private WHICH _which = WHICH.undefined;
|
||||
private object _content;
|
||||
public WHICH which
|
||||
{
|
||||
get => _which;
|
||||
set
|
||||
{
|
||||
if (value == _which)
|
||||
return;
|
||||
_which = value;
|
||||
switch (value)
|
||||
{
|
||||
case WHICH.None:
|
||||
break;
|
||||
case WHICH.Initial:
|
||||
_content = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.which = which;
|
||||
switch (which)
|
||||
{
|
||||
case WHICH.None:
|
||||
break;
|
||||
case WHICH.Initial:
|
||||
writer.Initial.Init(Initial);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public IReadOnlyList<byte> Initial
|
||||
{
|
||||
get => _which == WHICH.Initial ? (IReadOnlyList<byte>)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Initial;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public WHICH which => (WHICH)ctx.ReadDataUShort(0U, (ushort)0);
|
||||
public IReadOnlyList<byte> Initial => which == WHICH.Initial ? ctx.ReadList(1).CastByte() : default;
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
}
|
||||
|
||||
public WHICH which
|
||||
{
|
||||
get => (WHICH)this.ReadDataUShort(0U, (ushort)0);
|
||||
set => this.WriteData(0U, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public ListOfPrimitivesSerializer<byte> Initial
|
||||
{
|
||||
get => which == WHICH.Initial ? BuildPointer<ListOfPrimitivesSerializer<byte>>(1) : default;
|
||||
set => Link(1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9f2f3c9cd9974434UL)]
|
||||
public class Outcome : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0x9f2f3c9cd9974434UL;
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
TheResult = reader.TheResult;
|
||||
TheAction = reader.TheAction;
|
||||
HelpText = reader.HelpText;
|
||||
AdditionalData = CapnpSerializable.Create<CapnpGen.Outcome.additionalData>(reader.AdditionalData);
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.TheResult = TheResult;
|
||||
writer.TheAction = TheAction;
|
||||
writer.HelpText = HelpText;
|
||||
AdditionalData?.serialize(writer.AdditionalData);
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome.Result TheResult
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome.Action TheAction
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string HelpText
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome.additionalData AdditionalData
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public CapnpGen.Outcome.Result TheResult => (CapnpGen.Outcome.Result)ctx.ReadDataUShort(0UL, (ushort)0);
|
||||
public CapnpGen.Outcome.Action TheAction => (CapnpGen.Outcome.Action)ctx.ReadDataUShort(16UL, (ushort)0);
|
||||
public string HelpText => ctx.ReadText(0, null);
|
||||
public additionalData.READER AdditionalData => new additionalData.READER(ctx);
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
this.SetStruct(1, 2);
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome.Result TheResult
|
||||
{
|
||||
get => (CapnpGen.Outcome.Result)this.ReadDataUShort(0UL, (ushort)0);
|
||||
set => this.WriteData(0UL, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public CapnpGen.Outcome.Action TheAction
|
||||
{
|
||||
get => (CapnpGen.Outcome.Action)this.ReadDataUShort(16UL, (ushort)0);
|
||||
set => this.WriteData(16UL, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public string HelpText
|
||||
{
|
||||
get => this.ReadText(0, null);
|
||||
set => this.WriteText(0, value, null);
|
||||
}
|
||||
|
||||
public additionalData.WRITER AdditionalData
|
||||
{
|
||||
get => Rewrap<additionalData.WRITER>();
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xcd5312ea76df43c1UL)]
|
||||
public class additionalData : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0xcd5312ea76df43c1UL;
|
||||
public enum WHICH : ushort
|
||||
{
|
||||
None = 0,
|
||||
Additional = 1,
|
||||
undefined = 65535
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
switch (reader.which)
|
||||
{
|
||||
case WHICH.None:
|
||||
which = reader.which;
|
||||
break;
|
||||
case WHICH.Additional:
|
||||
Additional = reader.Additional;
|
||||
break;
|
||||
}
|
||||
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
private WHICH _which = WHICH.undefined;
|
||||
private object _content;
|
||||
public WHICH which
|
||||
{
|
||||
get => _which;
|
||||
set
|
||||
{
|
||||
if (value == _which)
|
||||
return;
|
||||
_which = value;
|
||||
switch (value)
|
||||
{
|
||||
case WHICH.None:
|
||||
break;
|
||||
case WHICH.Additional:
|
||||
_content = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.which = which;
|
||||
switch (which)
|
||||
{
|
||||
case WHICH.None:
|
||||
break;
|
||||
case WHICH.Additional:
|
||||
writer.Additional.Init(Additional);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public IReadOnlyList<byte> Additional
|
||||
{
|
||||
get => _which == WHICH.Additional ? (IReadOnlyList<byte>)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Additional;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public WHICH which => (WHICH)ctx.ReadDataUShort(32U, (ushort)0);
|
||||
public IReadOnlyList<byte> Additional => which == WHICH.Additional ? ctx.ReadList(1).CastByte() : default;
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
}
|
||||
|
||||
public WHICH which
|
||||
{
|
||||
get => (WHICH)this.ReadDataUShort(32U, (ushort)0);
|
||||
set => this.WriteData(32U, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public ListOfPrimitivesSerializer<byte> Additional
|
||||
{
|
||||
get => which == WHICH.Additional ? BuildPointer<ListOfPrimitivesSerializer<byte>>(1) : default;
|
||||
set => Link(1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xf76eb72a8d2bf5f3UL)]
|
||||
public enum Result : ushort
|
||||
{
|
||||
successful,
|
||||
badMechanism,
|
||||
unwilling,
|
||||
invalidCredentials,
|
||||
unauthorized,
|
||||
malformedAuthZid,
|
||||
failed
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xbc1167ff63f623d0UL)]
|
||||
public enum Action : ushort
|
||||
{
|
||||
unset,
|
||||
retry,
|
||||
wait,
|
||||
permanent
|
||||
}
|
||||
}
|
||||
}
|
386
connection.capnp.cs
Normal file
386
connection.capnp.cs
Normal file
@ -0,0 +1,386 @@
|
||||
using Capnp;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapnpGen
|
||||
{
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9363e93d60b35057UL)]
|
||||
public class Message : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0x9363e93d60b35057UL;
|
||||
public enum WHICH : ushort
|
||||
{
|
||||
Greet = 0,
|
||||
Leave = 1,
|
||||
Auth = 2,
|
||||
Api = 3,
|
||||
undefined = 65535
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
switch (reader.which)
|
||||
{
|
||||
case WHICH.Greet:
|
||||
Greet = CapnpSerializable.Create<CapnpGen.Greeting>(reader.Greet);
|
||||
break;
|
||||
case WHICH.Leave:
|
||||
Leave = CapnpSerializable.Create<CapnpGen.Leave>(reader.Leave);
|
||||
break;
|
||||
case WHICH.Auth:
|
||||
Auth = CapnpSerializable.Create<CapnpGen.AuthMessage>(reader.Auth);
|
||||
break;
|
||||
case WHICH.Api:
|
||||
Api = CapnpSerializable.Create<CapnpGen.FabAccess>(reader.Api);
|
||||
break;
|
||||
}
|
||||
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
private WHICH _which = WHICH.undefined;
|
||||
private object _content;
|
||||
public WHICH which
|
||||
{
|
||||
get => _which;
|
||||
set
|
||||
{
|
||||
if (value == _which)
|
||||
return;
|
||||
_which = value;
|
||||
switch (value)
|
||||
{
|
||||
case WHICH.Greet:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Leave:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Auth:
|
||||
_content = null;
|
||||
break;
|
||||
case WHICH.Api:
|
||||
_content = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.which = which;
|
||||
switch (which)
|
||||
{
|
||||
case WHICH.Greet:
|
||||
Greet?.serialize(writer.Greet);
|
||||
break;
|
||||
case WHICH.Leave:
|
||||
Leave?.serialize(writer.Leave);
|
||||
break;
|
||||
case WHICH.Auth:
|
||||
Auth?.serialize(writer.Auth);
|
||||
break;
|
||||
case WHICH.Api:
|
||||
Api?.serialize(writer.Api);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public CapnpGen.Greeting Greet
|
||||
{
|
||||
get => _which == WHICH.Greet ? (CapnpGen.Greeting)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Greet;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CapnpGen.Leave Leave
|
||||
{
|
||||
get => _which == WHICH.Leave ? (CapnpGen.Leave)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Leave;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CapnpGen.AuthMessage Auth
|
||||
{
|
||||
get => _which == WHICH.Auth ? (CapnpGen.AuthMessage)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Auth;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CapnpGen.FabAccess Api
|
||||
{
|
||||
get => _which == WHICH.Api ? (CapnpGen.FabAccess)_content : null;
|
||||
set
|
||||
{
|
||||
_which = WHICH.Api;
|
||||
_content = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public WHICH which => (WHICH)ctx.ReadDataUShort(0U, (ushort)0);
|
||||
public CapnpGen.Greeting.READER Greet => which == WHICH.Greet ? ctx.ReadStruct(0, CapnpGen.Greeting.READER.create) : default;
|
||||
public CapnpGen.Leave.READER Leave => which == WHICH.Leave ? ctx.ReadStruct(0, CapnpGen.Leave.READER.create) : default;
|
||||
public CapnpGen.AuthMessage.READER Auth => which == WHICH.Auth ? ctx.ReadStruct(0, CapnpGen.AuthMessage.READER.create) : default;
|
||||
public CapnpGen.FabAccess.READER Api => which == WHICH.Api ? ctx.ReadStruct(0, CapnpGen.FabAccess.READER.create) : default;
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
this.SetStruct(1, 1);
|
||||
}
|
||||
|
||||
public WHICH which
|
||||
{
|
||||
get => (WHICH)this.ReadDataUShort(0U, (ushort)0);
|
||||
set => this.WriteData(0U, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public CapnpGen.Greeting.WRITER Greet
|
||||
{
|
||||
get => which == WHICH.Greet ? BuildPointer<CapnpGen.Greeting.WRITER>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public CapnpGen.Leave.WRITER Leave
|
||||
{
|
||||
get => which == WHICH.Leave ? BuildPointer<CapnpGen.Leave.WRITER>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public CapnpGen.AuthMessage.WRITER Auth
|
||||
{
|
||||
get => which == WHICH.Auth ? BuildPointer<CapnpGen.AuthMessage.WRITER>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
|
||||
public CapnpGen.FabAccess.WRITER Api
|
||||
{
|
||||
get => which == WHICH.Api ? BuildPointer<CapnpGen.FabAccess.WRITER>(0) : default;
|
||||
set => Link(0, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xd7c6c8a7ec8a94ffUL)]
|
||||
public class Greeting : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0xd7c6c8a7ec8a94ffUL;
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
Host = reader.Host;
|
||||
Program = reader.Program;
|
||||
Major = reader.Major;
|
||||
Minor = reader.Minor;
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.Host = Host;
|
||||
writer.Program = Program;
|
||||
writer.Major = Major;
|
||||
writer.Minor = Minor;
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public string Host
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Program
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public uint Major
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public uint Minor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public string Host => ctx.ReadText(0, null);
|
||||
public string Program => ctx.ReadText(1, null);
|
||||
public uint Major => ctx.ReadDataUInt(0UL, 0U);
|
||||
public uint Minor => ctx.ReadDataUInt(32UL, 0U);
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
this.SetStruct(1, 2);
|
||||
}
|
||||
|
||||
public string Host
|
||||
{
|
||||
get => this.ReadText(0, null);
|
||||
set => this.WriteText(0, value, null);
|
||||
}
|
||||
|
||||
public string Program
|
||||
{
|
||||
get => this.ReadText(1, null);
|
||||
set => this.WriteText(1, value, null);
|
||||
}
|
||||
|
||||
public uint Major
|
||||
{
|
||||
get => this.ReadDataUInt(0UL, 0U);
|
||||
set => this.WriteData(0UL, value, 0U);
|
||||
}
|
||||
|
||||
public uint Minor
|
||||
{
|
||||
get => this.ReadDataUInt(32UL, 0U);
|
||||
set => this.WriteData(32UL, value, 0U);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xc4edbaef246784cbUL)]
|
||||
public class Leave : ICapnpSerializable
|
||||
{
|
||||
public const UInt64 typeId = 0xc4edbaef246784cbUL;
|
||||
void ICapnpSerializable.Deserialize(DeserializerState arg_)
|
||||
{
|
||||
var reader = READER.create(arg_);
|
||||
TheReason = reader.TheReason;
|
||||
Message = reader.Message;
|
||||
applyDefaults();
|
||||
}
|
||||
|
||||
public void serialize(WRITER writer)
|
||||
{
|
||||
writer.TheReason = TheReason;
|
||||
writer.Message = Message;
|
||||
}
|
||||
|
||||
void ICapnpSerializable.Serialize(SerializerState arg_)
|
||||
{
|
||||
serialize(arg_.Rewrap<WRITER>());
|
||||
}
|
||||
|
||||
public void applyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public CapnpGen.Leave.Reason TheReason
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public struct READER
|
||||
{
|
||||
readonly DeserializerState ctx;
|
||||
public READER(DeserializerState ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public static READER create(DeserializerState ctx) => new READER(ctx);
|
||||
public static implicit operator DeserializerState(READER reader) => reader.ctx;
|
||||
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
|
||||
public CapnpGen.Leave.Reason TheReason => (CapnpGen.Leave.Reason)ctx.ReadDataUShort(0UL, (ushort)0);
|
||||
public string Message => ctx.ReadText(0, null);
|
||||
}
|
||||
|
||||
public class WRITER : SerializerState
|
||||
{
|
||||
public WRITER()
|
||||
{
|
||||
this.SetStruct(1, 1);
|
||||
}
|
||||
|
||||
public CapnpGen.Leave.Reason TheReason
|
||||
{
|
||||
get => (CapnpGen.Leave.Reason)this.ReadDataUShort(0UL, (ushort)0);
|
||||
set => this.WriteData(0UL, (ushort)value, (ushort)0);
|
||||
}
|
||||
|
||||
public string Message
|
||||
{
|
||||
get => this.ReadText(0, null);
|
||||
set => this.WriteText(0, value, null);
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xb6e0e07e2ab5f7b2UL)]
|
||||
public enum Reason : ushort
|
||||
{
|
||||
other,
|
||||
incompatible
|
||||
}
|
||||
}
|
||||
}
|
17
csharp.capnp.cs
Normal file
17
csharp.capnp.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Capnp;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Capnp.Annotations
|
||||
{
|
||||
[System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xeb0d831668c6eda5UL)]
|
||||
public enum TypeVisibility : ushort
|
||||
{
|
||||
@public,
|
||||
@internal
|
||||
}
|
||||
}
|
11
rust.capnp.cs
Normal file
11
rust.capnp.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using Capnp;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapnpGen
|
||||
{
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user