Rust 2018 edition
							parent
							
								
									ee8be93855
								
							
						
					
					
						commit
						3510417ce4
					
				|  | @ -2,6 +2,7 @@ | ||||||
| name = "rtp" | name = "rtp" | ||||||
| version = "0.1.0" | version = "0.1.0" | ||||||
| authors = ["Takeru Ohta <phjgt308@gmail.com>"] | authors = ["Takeru Ohta <phjgt308@gmail.com>"] | ||||||
|  | edition = "2018" | ||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| trackable = "0.1" | trackable = "0.1" | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
|  | use trackable::*; | ||||||
| 
 | 
 | ||||||
| use Result; | use crate::Result; | ||||||
| 
 | 
 | ||||||
| pub trait ReadFrom: Sized { | pub trait ReadFrom: Sized { | ||||||
|     fn read_from<R: Read>(reader: &mut R) -> Result<Self>; |     fn read_from<R: Read>(reader: &mut R) -> Result<Self>; | ||||||
|  |  | ||||||
|  | @ -1,16 +1,9 @@ | ||||||
| #[macro_use] |  | ||||||
| extern crate trackable; |  | ||||||
| extern crate crypto; |  | ||||||
| extern crate handy_async; |  | ||||||
| extern crate num; |  | ||||||
| extern crate fixedbitset; |  | ||||||
| 
 |  | ||||||
| #[cfg(feature = "openssl")] | #[cfg(feature = "openssl")] | ||||||
| extern crate openssl; | extern crate openssl; | ||||||
| #[cfg(feature = "tokio")] | #[cfg(feature = "tokio")] | ||||||
| extern crate tokio; | extern crate tokio; | ||||||
| 
 | 
 | ||||||
| pub use error::{Error, ErrorKind}; | pub use crate::error::{Error, ErrorKind}; | ||||||
| 
 | 
 | ||||||
| pub mod io; | pub mod io; | ||||||
| pub mod rfc3550; | pub mod rfc3550; | ||||||
|  |  | ||||||
|  | @ -1,11 +1,12 @@ | ||||||
| use handy_async::sync_io::{ReadExt, WriteExt}; | use handy_async::sync_io::{ReadExt, WriteExt}; | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
|  | use trackable::*; | ||||||
| 
 | 
 | ||||||
| use constants::RTP_VERSION; | use crate::constants::RTP_VERSION; | ||||||
| use io::{ReadFrom, WriteTo}; | use crate::io::{ReadFrom, WriteTo}; | ||||||
| use traits::{self, Packet}; | use crate::traits::{self, Packet}; | ||||||
| use types::{NtpMiddleTimetamp, NtpTimestamp, RtpTimestamp, Ssrc, SsrcOrCsrc, U24, U5}; | use crate::types::{NtpMiddleTimetamp, NtpTimestamp, RtpTimestamp, Ssrc, SsrcOrCsrc, U24, U5}; | ||||||
| use {ErrorKind, Result}; | use crate::{ErrorKind, Result}; | ||||||
| 
 | 
 | ||||||
| pub const RTCP_PACKET_TYPE_SR: u8 = 200; | pub const RTCP_PACKET_TYPE_SR: u8 = 200; | ||||||
| pub const RTCP_PACKET_TYPE_RR: u8 = 201; | pub const RTCP_PACKET_TYPE_RR: u8 = 201; | ||||||
|  |  | ||||||
|  | @ -1,11 +1,12 @@ | ||||||
| use handy_async::sync_io::{ReadExt, WriteExt}; | use handy_async::sync_io::{ReadExt, WriteExt}; | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
|  | use trackable::*; | ||||||
| 
 | 
 | ||||||
| use constants::RTP_VERSION; | use crate::constants::RTP_VERSION; | ||||||
| use io::{ReadFrom, WriteTo}; | use crate::io::{ReadFrom, WriteTo}; | ||||||
| use traits::{self, Packet}; | use crate::traits::{self, Packet}; | ||||||
| use types::{Csrc, RtpTimestamp, Ssrc, U7}; | use crate::types::{Csrc, RtpTimestamp, Ssrc, U7}; | ||||||
| use {ErrorKind, Result}; | use crate::{ErrorKind, Result}; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, PartialEq, Eq)] | #[derive(Debug, Clone, PartialEq, Eq)] | ||||||
| pub struct RtpPacketReader; | pub struct RtpPacketReader; | ||||||
|  |  | ||||||
|  | @ -6,12 +6,13 @@ use num::BigUint; | ||||||
| use std::borrow::Cow; | use std::borrow::Cow; | ||||||
| use std::collections::BTreeMap; | use std::collections::BTreeMap; | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
|  | use trackable::*; | ||||||
| 
 | 
 | ||||||
| use io::{ReadFrom, WriteTo}; | use crate::io::{ReadFrom, WriteTo}; | ||||||
| use rfc3550; | use crate::rfc3550; | ||||||
| use traits::{ReadPacket, RtcpPacket, RtpPacket, WritePacket}; | use crate::traits::{ReadPacket, RtcpPacket, RtpPacket, WritePacket}; | ||||||
| use types::{Ssrc, U48}; | use crate::types::{Ssrc, U48}; | ||||||
| use {ErrorKind, Result}; | use crate::{ErrorKind, Result}; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||||||
| pub enum EncryptionAlgorithm { | pub enum EncryptionAlgorithm { | ||||||
|  | @ -834,8 +835,8 @@ fn prf_n(master_key: &[u8], x: BigUint, n: usize) -> Vec<u8> { | ||||||
| #[cfg(test)] | #[cfg(test)] | ||||||
| pub(crate) mod test { | pub(crate) mod test { | ||||||
|     use super::*; |     use super::*; | ||||||
|     use rfc3550; |     use crate::rfc3550; | ||||||
|     use rfc4585; |     use crate::rfc4585; | ||||||
| 
 | 
 | ||||||
|     #[test] |     #[test] | ||||||
|     fn rtp_packet_index_estimation_works() { |     fn rtp_packet_index_estimation_works() { | ||||||
|  |  | ||||||
|  | @ -1,12 +1,13 @@ | ||||||
| use handy_async::sync_io::{ReadExt, WriteExt}; | use handy_async::sync_io::{ReadExt, WriteExt}; | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
|  | use trackable::*; | ||||||
| 
 | 
 | ||||||
| use constants::RTP_VERSION; | use crate::constants::RTP_VERSION; | ||||||
| use io::{ReadFrom, WriteTo}; | use crate::io::{ReadFrom, WriteTo}; | ||||||
| use rfc3550; | use crate::rfc3550; | ||||||
| use traits::{self, Packet}; | use crate::traits::{self, Packet}; | ||||||
| use types::{Ssrc, U13, U5, U6, U7}; | use crate::types::{Ssrc, U13, U5, U6, U7}; | ||||||
| use {ErrorKind, Result}; | use crate::{ErrorKind, Result}; | ||||||
| 
 | 
 | ||||||
| pub const RTCP_PACKET_TYPE_RTPFB: u8 = 205; | pub const RTCP_PACKET_TYPE_RTPFB: u8 = 205; | ||||||
| pub const RTCP_PACKET_TYPE_PSFB: u8 = 206; | pub const RTCP_PACKET_TYPE_PSFB: u8 = 206; | ||||||
|  |  | ||||||
|  | @ -1,7 +1,8 @@ | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
|  | use trackable::*; | ||||||
| 
 | 
 | ||||||
| use traits::{Packet, ReadPacket, RtcpPacket, RtpPacket, WritePacket}; | use crate::traits::{Packet, ReadPacket, RtcpPacket, RtpPacket, WritePacket}; | ||||||
| use Result; | use crate::Result; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, PartialEq, Eq)] | #[derive(Debug, Clone, PartialEq, Eq)] | ||||||
| pub struct MuxPacketReader<T, U> { | pub struct MuxPacketReader<T, U> { | ||||||
|  |  | ||||||
|  | @ -12,8 +12,8 @@ use std::io::{Read, Write}; | ||||||
| use std::sync::Arc; | use std::sync::Arc; | ||||||
| use std::sync::Mutex; | use std::sync::Mutex; | ||||||
| 
 | 
 | ||||||
| use rfc3711::{AuthenticationAlgorithm, Context, EncryptionAlgorithm, Srtcp, Srtp}; | use crate::rfc3711::{AuthenticationAlgorithm, Context, EncryptionAlgorithm, Srtcp, Srtp}; | ||||||
| use types::Ssrc; | use crate::types::Ssrc; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, PartialEq, Eq)] | #[derive(Debug, Clone, PartialEq, Eq)] | ||||||
| pub struct SrtpProtectionProfile { | pub struct SrtpProtectionProfile { | ||||||
|  | @ -368,7 +368,7 @@ where | ||||||
| #[cfg(test)] | #[cfg(test)] | ||||||
| pub(crate) mod test { | pub(crate) mod test { | ||||||
|     use super::*; |     use super::*; | ||||||
|     use rfc3711::test::{ |     use crate::rfc3711::test::{ | ||||||
|         TEST_MASTER_KEY, TEST_MASTER_SALT, TEST_SRTCP_PACKET, TEST_SRTCP_SSRC, TEST_SRTP_PACKET, |         TEST_MASTER_KEY, TEST_MASTER_SALT, TEST_SRTCP_PACKET, TEST_SRTCP_SSRC, TEST_SRTP_PACKET, | ||||||
|         TEST_SRTP_SSRC, |         TEST_SRTP_SSRC, | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ use openssl::ssl::{ | ||||||
|     HandshakeError, MidHandshakeSslStream, SslAcceptorBuilder, SslConnectorBuilder, SslStream, |     HandshakeError, MidHandshakeSslStream, SslAcceptorBuilder, SslConnectorBuilder, SslStream, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| use rfc5764::{Dtls, DtlsBuilder, DtlsHandshakeResult, DtlsMidHandshake, SrtpProtectionProfile}; | use crate::rfc5764::{Dtls, DtlsBuilder, DtlsHandshakeResult, DtlsMidHandshake, SrtpProtectionProfile}; | ||||||
| 
 | 
 | ||||||
| impl<S: Read + Write + Sync> DtlsBuilder<S> for SslConnectorBuilder { | impl<S: Read + Write + Sync> DtlsBuilder<S> for SslConnectorBuilder { | ||||||
|     type Instance = SslStream<S>; |     type Instance = SslStream<S>; | ||||||
|  | @ -100,8 +100,8 @@ impl<S: Read + Write> Dtls<S> for SslStream<S> { | ||||||
| 
 | 
 | ||||||
| #[cfg(test)] | #[cfg(test)] | ||||||
| mod test { | mod test { | ||||||
|     use rfc5764::test::DummyTransport; |     use crate::rfc5764::test::DummyTransport; | ||||||
|     use rfc5764::{DtlsSrtp, DtlsSrtpHandshakeResult}; |     use crate::rfc5764::{DtlsSrtp, DtlsSrtpHandshakeResult}; | ||||||
| 
 | 
 | ||||||
|     use openssl::asn1::Asn1Time; |     use openssl::asn1::Asn1Time; | ||||||
|     use openssl::hash::MessageDigest; |     use openssl::hash::MessageDigest; | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| use std::io; | use std::io; | ||||||
| use tokio::prelude::{Async, AsyncRead, AsyncSink, AsyncWrite, Future, Sink, Stream}; | use tokio::prelude::{Async, AsyncRead, AsyncSink, AsyncWrite, Future, Sink, Stream}; | ||||||
| 
 | 
 | ||||||
| use rfc5764::{DtlsBuilder, DtlsSrtp, DtlsSrtpHandshakeResult, DtlsSrtpMuxerPart}; | use crate::rfc5764::{DtlsBuilder, DtlsSrtp, DtlsSrtpHandshakeResult, DtlsSrtpMuxerPart}; | ||||||
| 
 | 
 | ||||||
| impl<S, D> AsyncRead for DtlsSrtp<S, D> | impl<S, D> AsyncRead for DtlsSrtp<S, D> | ||||||
| where | where | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
| 
 | 
 | ||||||
| use Result; | use crate::Result; | ||||||
| 
 | 
 | ||||||
| pub trait Packet {} | pub trait Packet {} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue