ZeroTierOne/network-hypervisor/src/vl2/switch.rs

60 lines
1.6 KiB
Rust

// (c) 2020-2022 ZeroTier, Inc. -- currently propritery pending actual release and licensing. See LICENSE.md.
use std::sync::Arc;
use crate::protocol::PacketBuffer;
use crate::vl1::node::{HostSystem, InnerProtocol, Node, PacketHandlerResult};
use crate::vl1::{Identity, Path, Peer};
pub trait SwitchInterface: Sync + Send {}
pub struct Switch {}
impl InnerProtocol for Switch {
fn handle_packet<HostSystemImpl: HostSystem>(
&self,
node: &Node<HostSystemImpl>,
source: &Arc<Peer<HostSystemImpl>>,
source_path: &Arc<Path<HostSystemImpl>>,
message_id: u64,
verb: u8,
payload: &PacketBuffer,
) -> PacketHandlerResult {
PacketHandlerResult::NotHandled
}
fn handle_error<HostSystemImpl: HostSystem>(
&self,
node: &Node<HostSystemImpl>,
source: &Arc<Peer<HostSystemImpl>>,
source_path: &Arc<Path<HostSystemImpl>>,
message_id: u64,
in_re_verb: u8,
in_re_message_id: u64,
error_code: u8,
payload: &PacketBuffer,
cursor: &mut usize,
) -> PacketHandlerResult {
PacketHandlerResult::NotHandled
}
fn handle_ok<HostSystemImpl: HostSystem>(
&self,
node: &Node<HostSystemImpl>,
source: &Arc<Peer<HostSystemImpl>>,
source_path: &Arc<Path<HostSystemImpl>>,
message_id: u64,
in_re_verb: u8,
in_re_message_id: u64,
payload: &PacketBuffer,
cursor: &mut usize,
) -> PacketHandlerResult {
PacketHandlerResult::NotHandled
}
fn should_communicate_with(&self, id: &Identity) -> bool {
true
}
}
impl Switch {}