⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

TunnelInterface

Struct TunnelInterface 

Source
pub struct TunnelInterface { /* private fields */ }
Expand description

Virtual tunnel network interface

Implementations§

Source§

impl TunnelInterface

Source

pub fn create(config: TunnelConfig) -> Result<Self, TunnelError>

Create a new tunnel interface from configuration

Source

pub fn bring_up(&mut self) -> Result<(), TunnelError>

Bring the interface up

Source

pub fn bring_down(&mut self)

Bring the interface down and flush queues

Source

pub fn send_packet(&mut self, data: &[u8]) -> Result<(), TunnelError>

Enqueue a packet for transmission

Source

pub fn receive_packet(&mut self) -> Result<Vec<u8>, TunnelError>

Dequeue a received packet

Source

pub fn inject_rx(&mut self, data: Vec<u8>) -> Result<(), TunnelError>

Enqueue a packet into the receive queue (called by the VPN transport layer)

Source

pub fn drain_tx(&mut self) -> Option<Vec<u8>>

Dequeue a packet from the transmit queue (called by the VPN transport layer)

Source

pub fn set_mtu(&mut self, mtu: u16) -> Result<(), TunnelError>

Set the MTU for this interface

Source

pub fn get_mtu(&self) -> u16

Get the current MTU

Source

pub fn get_stats(&self) -> TunnelStats

Get interface statistics

Source

pub fn name(&self) -> &str

Get the interface name

Source

pub fn tunnel_type(&self) -> TunnelType

Get the tunnel type

Source

pub fn state(&self) -> TunnelState

Get the current state

Source

pub fn config(&self) -> &TunnelConfig

Get the configuration

Source

pub fn set_encap(&mut self, encap: EncapsulationHeader)

Set the encapsulation header

Source

pub fn encap(&self) -> Option<&EncapsulationHeader>

Get the encapsulation header

Trait Implementations§

Source§

impl Debug for TunnelInterface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TunnelInterface

Source§

fn eq(&self, other: &TunnelInterface) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TunnelInterface

Auto Trait Implementations§

§

impl Freeze for TunnelInterface

§

impl RefUnwindSafe for TunnelInterface

§

impl Send for TunnelInterface

§

impl Sync for TunnelInterface

§

impl Unpin for TunnelInterface

§

impl UnwindSafe for TunnelInterface

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.