[][src]Struct libccp::Connection

pub struct Connection<'dp, T: CongestionOps + 'static>(_, _, _, _);

An individual Connection. Connections cannot outlive the Datapath they belong to, since they contain a pointer to memory that is freed when Datapath is dropped. So, their lifetime is 'dp from the &'dp Datapath.

You can regain access to the impl CongestionOps by dereferencing Connection

struct Dp();
impl libccp::DatapathOps for Dp {
    fn send_msg(&mut self, _: &[u8]) { /* ___ */ }
}
struct Cn(u32);
impl libccp::CongestionOps for Cn {
    fn set_cwnd(&mut self, cwnd: u32) { /* ___ */ }   
    fn set_rate_abs(&mut self, cwnd: u32) { /* ___ */ }   
}
fn main() {
    let d = libccp::Datapath::init(Dp()).unwrap();
    let mut c = libccp::Connection::start(&d, Cn(0), libccp::FlowInfo::default()).unwrap();
    c.load_primitives(libccp::Primitives::default());
    c.0 = 1;
}

Methods

impl<'dp, T: CongestionOps + 'static> Connection<'dp, T>[src]

pub fn start(
    token: &'dp Datapath,
    conn: T,
    flow_info: FlowInfo
) -> Result<Self, Error>
[src]

Call this function when a connection starts. conn: impl CongestionOps represents per-connection state, and how to mutate it in response to changing congestion windows or rates.

pub fn load_primitives(&mut self, prims: Primitives)[src]

Inform libccp of new measurements.

pub fn primitives(&self, _token: &Datapath) -> Primitives[src]

pub fn invoke(&mut self) -> Result<(), Error>[src]

Tell libccp to invoke. This will run the congestion control's datapath program, and potentially result in calls to the CongestionOps callbacks. Therefore, ensure that when you call this function, you are not holding locks that the CongestionOps functionality tries to acquire - this will deadlock.

Trait Implementations

impl<'dp, T: CongestionOps> Send for Connection<'dp, T>[src]

impl<'dp, T: CongestionOps> Drop for Connection<'dp, T>[src]

impl<'dp, T: CongestionOps> DerefMut for Connection<'dp, T>[src]

impl<'dp, T: CongestionOps> Deref for Connection<'dp, T>[src]

type Target = T

The resulting type after dereferencing.

Auto Trait Implementations

impl<'dp, T> !Sync for Connection<'dp, T>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]