pub struct TransactionHarness { /* private fields */ }Expand description
Two SIP transaction layers connected through a seeded virtual-time link.
Implementations§
Source§impl TransactionHarness
impl TransactionHarness
Sourcepub fn new(seed: u64, faults: Faults) -> Self
pub fn new(seed: u64, faults: Faults) -> Self
Start at virtual time zero with a reproducible faulty link.
Sourcepub fn place(&mut self, request: Request) -> Result<(), HarnessError>
pub fn place(&mut self, request: Request) -> Result<(), HarnessError>
Place a request from the calling side and deliver everything due now.
Sourcepub fn answer(
&mut self,
status: StatusCode,
reason: impl Into<Bytes>,
) -> Result<(), HarnessError>
pub fn answer( &mut self, status: StatusCode, reason: impl Into<Bytes>, ) -> Result<(), HarnessError>
Answer the most recent invitation delivered to the callee.
The harness supplies deterministic To and Contact values. Tests that need exact header
policy can build a Response and use Self::answer_with instead.
Sourcepub fn answer_ok(&mut self) -> Result<(), HarnessError>
pub fn answer_ok(&mut self) -> Result<(), HarnessError>
Answer the pending invitation with 200 OK.
Sourcepub fn answer_with(&mut self, response: Response) -> Result<(), HarnessError>
pub fn answer_with(&mut self, response: Response) -> Result<(), HarnessError>
Send an application-built response from the answering side.
Sourcepub fn advance(&mut self, by: Duration)
pub fn advance(&mut self, by: Duration)
Move virtual time forward, fire transaction timers, and deliver packets now due.
Sourcepub fn invitation(&self) -> Option<&Request>
pub fn invitation(&self) -> Option<&Request>
The most recently delivered INVITE, if one reached the callee.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TransactionHarness
impl RefUnwindSafe for TransactionHarness
impl Send for TransactionHarness
impl Sync for TransactionHarness
impl Unpin for TransactionHarness
impl UnsafeUnpin for TransactionHarness
impl UnwindSafe for TransactionHarness
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more