2020-01-22 16:44:32 +00:00
|
|
|
use crate::{
|
2020-02-04 15:42:04 +00:00
|
|
|
api::Address,
|
|
|
|
worker::types::{Mid, Sid},
|
2020-01-22 16:44:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
pub(crate) const VELOREN_MAGIC_NUMBER: &str = "VELOREN";
|
|
|
|
pub const VELOREN_NETWORK_VERSION: [u32; 3] = [0, 1, 0];
|
2020-01-13 16:53:28 +00:00
|
|
|
|
|
|
|
pub(crate) enum Protocol {
|
|
|
|
Tcp,
|
|
|
|
Udp,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Address {
|
|
|
|
pub(crate) fn get_protocol(&self) -> Protocol {
|
|
|
|
match self {
|
|
|
|
Address::Tcp(_) => Protocol::Tcp,
|
|
|
|
Address::Udp(_) => Protocol::Udp,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-22 16:44:32 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2020-02-04 15:42:04 +00:00
|
|
|
pub struct RemoteParticipant {
|
|
|
|
pub stream_id_pool: tlid::Pool<tlid::Wrapping<Sid>>,
|
|
|
|
pub msg_id_pool: tlid::Pool<tlid::Wrapping<Mid>>,
|
2020-01-22 16:44:32 +00:00
|
|
|
}
|
|
|
|
|
2020-02-04 15:42:04 +00:00
|
|
|
impl RemoteParticipant {
|
|
|
|
pub(crate) fn new() -> Self {
|
|
|
|
Self {
|
|
|
|
stream_id_pool: tlid::Pool::new_full(),
|
|
|
|
msg_id_pool: tlid::Pool::new_full(),
|
2020-01-22 16:44:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|