Skip to content

icon: octicons/gear-24 search: exclude: false categories: - engine - node tags: - transport-protocol-engine - engine-definition


Juvix imports

module arch.node.net.transport_protocol;

import arch.node.net.transport_protocol_messages open;
import arch.node.net.transport_protocol_config open;
import arch.node.net.transport_protocol_environment open;
import arch.node.net.transport_protocol_behaviour open;
import arch.node.types.basics open;
import arch.node.types.engine open;
import arch.node.types.anoma as Anoma open;

open transport_protocol_config_example;
open transport_protocol_environment_example;
open transport_protocol_behaviour_example;

Transport Protocol Engine

Purpose

A Transport Protocol engine is responsible for accepting and initiating transport connections for one specific transport protocol, such as QUIC or TLS.

Engine Components

Type

TransportProtocolEngine : Type :=
Engine
TransportProtocolLocalCfg
TransportProtocolLocalState
TransportProtocolMailboxState
TransportProtocolTimerHandle
TransportProtocolActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Instantiation

exTransportProtocolEngine : TransportProtocolEngine :=
mkEngine@{
cfg := exTransportProtocolCfg;
env := exTransportProtocolEnv;
behaviour := exTransportProtocolBehaviour;
};

Where exTransportProtocolCfg is defined as follows:

exTransportProtocolCfg : TransportProtocolCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "transport-protocol";
cfg := mkTransportProtocolLocalCfg;
};

exTransportProtocolEnv is defined as follows:

exTransportProtocolEnv : TransportProtocolEnv :=
mkEngineEnv@{
localState := mkTransportProtocolLocalState;
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and exTransportProtocolBehaviour is defined as follows:

module transport_protocol_behaviour_example;
exTransportProtocolBehaviour : TransportProtocolBehaviour :=
mkEngineBehaviour@{
guards := First [exampleReplyGuard];
};
end;