xref: /webrtc/dtls/src/lib.rs (revision 2cd6154e)
1 #![warn(rust_2018_idioms)]
2 #![allow(dead_code)]
3 
4 pub mod alert;
5 pub mod application_data;
6 pub mod change_cipher_spec;
7 pub mod cipher_suite;
8 pub mod client_certificate_type;
9 pub mod compression_methods;
10 pub mod config;
11 pub mod conn;
12 pub mod content;
13 pub mod crypto;
14 pub mod curve;
15 mod error;
16 pub mod extension;
17 pub mod flight;
18 pub mod fragment_buffer;
19 pub mod handshake;
20 pub mod handshaker;
21 pub mod listener;
22 pub mod prf;
23 pub mod record_layer;
24 pub mod signature_hash_algorithm;
25 pub mod state;
26 
27 pub use error::Error;
28 
29 use cipher_suite::*;
30 use extension::extension_use_srtp::SrtpProtectionProfile;
31 
find_matching_srtp_profile( a: &[SrtpProtectionProfile], b: &[SrtpProtectionProfile], ) -> Result<SrtpProtectionProfile, ()>32 pub(crate) fn find_matching_srtp_profile(
33     a: &[SrtpProtectionProfile],
34     b: &[SrtpProtectionProfile],
35 ) -> Result<SrtpProtectionProfile, ()> {
36     for a_profile in a {
37         for b_profile in b {
38             if a_profile == b_profile {
39                 return Ok(*a_profile);
40             }
41         }
42     }
43     Err(())
44 }
45 
find_matching_cipher_suite( a: &[CipherSuiteId], b: &[CipherSuiteId], ) -> Result<CipherSuiteId, ()>46 pub(crate) fn find_matching_cipher_suite(
47     a: &[CipherSuiteId],
48     b: &[CipherSuiteId],
49 ) -> Result<CipherSuiteId, ()> {
50     for a_suite in a {
51         for b_suite in b {
52             if a_suite == b_suite {
53                 return Ok(*a_suite);
54             }
55         }
56     }
57     Err(())
58 }
59