diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-13 19:09:12 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-13 19:09:12 +0200 |
commit | 473c7624c1419c6636addebb183dede5be88b061 (patch) | |
tree | a5e27396bda5a5a2281337a0049b004218e98200 /client-native-rift/src/protocol.rs | |
parent | 7e88c11cbf817cb6cdbaf9b9f55564c4f9081e26 (diff) | |
download | keks-meet-473c7624c1419c6636addebb183dede5be88b061.tar keks-meet-473c7624c1419c6636addebb183dede5be88b061.tar.bz2 keks-meet-473c7624c1419c6636addebb183dede5be88b061.tar.zst |
getting closer to webrtc in rust
Diffstat (limited to 'client-native-rift/src/protocol.rs')
-rw-r--r-- | client-native-rift/src/protocol.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/client-native-rift/src/protocol.rs b/client-native-rift/src/protocol.rs index 5fb1ecb..b3719d0 100644 --- a/client-native-rift/src/protocol.rs +++ b/client-native-rift/src/protocol.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use webrtc::peer_connection::sdp::sdp_type::RTCSdpType; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] @@ -18,3 +19,32 @@ pub enum ServerboundPacket { message: String, }, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RelayMessageWrapper { + sender: usize, // redundant, but ensures the server didnt cheat + inner: RelayMessage, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum RelayMessage { + Offer(RTCSessionDescriptionInit), + Answer(RTCSessionDescriptionInit), + IceCandidate(RTCIceCandidateInit), +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RTCSessionDescriptionInit { + #[serde(rename = "type")] + pub ty: RTCSdpType, + pub sdp: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RTCIceCandidateInit { + pub candidate: String, + pub sdp_m_line_index: Option<usize>, + pub sdp_mid: Option<String>, + pub username_fragment: Option<String>, +} |