-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yngrtc
committed
Jun 29, 2024
1 parent
1a9bfce
commit 18cb778
Showing
7 changed files
with
105 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use crate::error::Result; | ||
use retty::transport::Transmit; | ||
use std::time::Instant; | ||
|
||
pub trait RTCHandler { | ||
/// Associated event input message type | ||
type Ein: 'static; | ||
/// Associated event output message type | ||
type Eout: 'static; | ||
/// Associated read input message type | ||
type Rin: 'static; | ||
/// Associated read output message type | ||
type Rout: 'static; | ||
/// Associated write input message type | ||
type Win: 'static; | ||
/// Associated write output message type for | ||
type Wout: 'static; | ||
|
||
/// Handles Rin and returns Rout for next inbound handler handling | ||
fn handle_read(&mut self, msg: Transmit<Self::Rin>) -> Result<()>; | ||
|
||
/// Polls Rout from internal queue for next inbound handler handling | ||
fn poll_read(&mut self) -> Option<Transmit<Self::Rout>>; | ||
|
||
/// Handles Win and returns Wout for next outbound handler handling | ||
fn handle_write(&mut self, msg: Transmit<Self::Win>) -> Result<()>; | ||
|
||
/// Polls Wout from internal queue for next outbound handler handling | ||
fn poll_write(&mut self) -> Option<Transmit<Self::Wout>>; | ||
|
||
/// Handles event | ||
fn handle_event(&mut self, _evt: Self::Ein) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
/// Polls event | ||
fn poll_event(&mut self) -> Option<Self::Eout> { | ||
None | ||
} | ||
|
||
/// Handles timeout | ||
fn handle_timeout(&mut self, _now: Instant) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
/// Polls timeout | ||
fn poll_timeout(&mut self) -> Option<Instant> { | ||
None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,5 @@ | ||
use crate::messages::{RTCEvent, RTCMessage}; | ||
use shared::error::Error; | ||
use shared::Transmit; | ||
use std::time::Instant; | ||
|
||
pub mod demuxer; | ||
pub mod dtls; | ||
/*TODO:pub mod dtls; | ||
pub mod ice; | ||
mod sctp; | ||
|
||
pub trait RTCHandler { | ||
/// Handles input message | ||
fn handle_transmit(&mut self, msg: Transmit<RTCMessage>) -> Vec<Transmit<RTCMessage>> { | ||
vec![msg] | ||
} | ||
|
||
/// Polls output message from internal transmit queue | ||
fn poll_transmit(&mut self, msg: Option<Transmit<RTCMessage>>) -> Option<Transmit<RTCMessage>> { | ||
msg | ||
} | ||
|
||
fn poll_event(&mut self) -> Option<RTCEvent> { | ||
None | ||
} | ||
|
||
/// Handles a timeout event | ||
fn handle_timeout(&mut self, _now: Instant) {} | ||
|
||
/// Polls a timeout event | ||
fn poll_timeout(&mut self, _eto: &mut Instant) {} | ||
|
||
/// Handle an error event | ||
fn handle_error(&mut self, _err: Error) {} | ||
|
||
/// Handle a close event | ||
fn handle_close(&mut self) {} | ||
} | ||
pub mod sctp; | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters