Skip to main content

rtc_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;
15pub mod endpoint;
16pub mod extension;
17pub mod flight;
18pub mod fragment_buffer;
19pub mod handshake;
20pub mod handshaker;
21pub mod prf;
22pub mod record_layer;
23pub mod signature_hash_algorithm;
24pub mod state;
25
26use cipher_suite::*;
27use extension::extension_use_srtp::SrtpProtectionProfile;
28
29pub(crate) fn find_matching_srtp_profile(
30    a: &[SrtpProtectionProfile],
31    b: &[SrtpProtectionProfile],
32) -> Result<SrtpProtectionProfile, ()> {
33    for a_profile in a {
34        for b_profile in b {
35            if a_profile == b_profile {
36                return Ok(*a_profile);
37            }
38        }
39    }
40    Err(())
41}
42
43pub(crate) fn find_matching_cipher_suite(
44    a: &[CipherSuiteId],
45    b: &[CipherSuiteId],
46) -> Result<CipherSuiteId, ()> {
47    for a_suite in a {
48        for b_suite in b {
49            if a_suite == b_suite {
50                return Ok(*a_suite);
51            }
52        }
53    }
54    Err(())
55}