pub trait ParseDownstreamCommonMessages<Router: CommonRouter>
where Self: Sized,
{ // Required method fn handle_setup_connection( &mut self, m: SetupConnection<'_>, result: Option<Result<(CommonDownstreamData, SetupConnectionSuccess), Error>>, ) -> Result<SendTo, Error>; // Provided methods fn parse_message( message_type: u8, payload: &mut [u8], ) -> Result<SetupConnection<'_>, Error> { ... } fn handle_message_common( self_: Arc<Mutex<Self>>, message_type: u8, payload: &mut [u8], routing_logic: CommonRoutingLogic<Router>, ) -> Result<SendTo, Error> { ... } fn handle_message_common_deserilized( self_: Arc<Mutex<Self>>, message: Result<CommonMessages<'_>, Error>, routing_logic: CommonRoutingLogic<Router>, ) -> Result<SendTo, Error> { ... } }
Expand description

A trait that is implemented by the upstream node, and is used to handle crate::parsers::CommonMessages::SetupConnection messages sent by the downstream to the upstream

Required Methods§

source

fn handle_setup_connection( &mut self, m: SetupConnection<'_>, result: Option<Result<(CommonDownstreamData, SetupConnectionSuccess), Error>>, ) -> Result<SendTo, Error>

Called by Self::handle_message_common when a setup connection message is received from the downstream node.

Provided Methods§

source

fn parse_message( message_type: u8, payload: &mut [u8], ) -> Result<SetupConnection<'_>, Error>

Used to parse a serialized downstream setup connection message into a crate::parsers::CommonMessages::SetupConnection

source

fn handle_message_common( self_: Arc<Mutex<Self>>, message_type: u8, payload: &mut [u8], routing_logic: CommonRoutingLogic<Router>, ) -> Result<SendTo, Error>

It takes a message type and a payload, and if the message is a serialized setup connection message, it calls the on_setup_connection function on the routing logic, and then calls the handle_setup_connection function on the router

Arguments:

source

fn handle_message_common_deserilized( self_: Arc<Mutex<Self>>, message: Result<CommonMessages<'_>, Error>, routing_logic: CommonRoutingLogic<Router>, ) -> Result<SendTo, Error>

It takes a message do setup connection message, it calls the on_setup_connection function on the routing logic, and then calls the handle_setup_connection function on the router

Object Safety§

This trait is not object safe.

Implementors§