pub trait NetworkProtocolHandler: Sync + Send {
    // Required methods
    fn minimum_supported_version(&self) -> ProtocolVersion;
    fn initialize(&self, _io: &dyn NetworkContext);
    fn on_message(&self, io: &dyn NetworkContext, node_id: &NodeId, data: &[u8]);
    fn on_peer_connected(
        &self,
        io: &dyn NetworkContext,
        node_id: &NodeId,
        peer_protocol_version: ProtocolVersion,
        pos_public_key: Option<(ConsensusPublicKey, ConsensusVRFPublicKey)>
    );
    fn on_peer_disconnected(&self, io: &dyn NetworkContext, node_id: &NodeId);
    fn on_timeout(&self, io: &dyn NetworkContext, timer: TimerToken);
    fn send_local_message(&self, _io: &dyn NetworkContext, _message: Vec<u8>);
    fn on_work_dispatch(
        &self,
        _io: &dyn NetworkContext,
        _work_type: HandlerWorkType
    );
}

Required Methods§

source

fn minimum_supported_version(&self) -> ProtocolVersion

source

fn initialize(&self, _io: &dyn NetworkContext)

source

fn on_message(&self, io: &dyn NetworkContext, node_id: &NodeId, data: &[u8])

source

fn on_peer_connected( &self, io: &dyn NetworkContext, node_id: &NodeId, peer_protocol_version: ProtocolVersion, pos_public_key: Option<(ConsensusPublicKey, ConsensusVRFPublicKey)> )

source

fn on_peer_disconnected(&self, io: &dyn NetworkContext, node_id: &NodeId)

source

fn on_timeout(&self, io: &dyn NetworkContext, timer: TimerToken)

source

fn send_local_message(&self, _io: &dyn NetworkContext, _message: Vec<u8>)

source

fn on_work_dispatch( &self, _io: &dyn NetworkContext, _work_type: HandlerWorkType )

Implementors§