webrtc_dtls/
lib.rs

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