### GET new_cipher_suite_tls_psk_with_aes_128_ccm8 Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_tls_psk_with_aes_128_ccm8/fn.new_cipher_suite_tls_psk_with_aes_128_ccm8.html Initializes a new instance of the TLS_PSK_WITH_AES_128_CCM_8 cipher suite. ```APIDOC ## GET new_cipher_suite_tls_psk_with_aes_128_ccm8 ### Description Creates and returns a new instance of the CipherSuiteAes128Ccm struct configured for TLS_PSK_WITH_AES_128_CCM_8. ### Method GET ### Endpoint webrtc_dtls::cipher_suite::new_cipher_suite_tls_psk_with_aes_128_ccm8 ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example N/A (Function call) ### Response #### Success Response (200) - **CipherSuiteAes128Ccm** (Object) - The initialized cipher suite instance. #### Response Example { "cipher_suite": "TLS_PSK_WITH_AES_128_CCM_8" } ``` -------------------------------- ### Initialize and Manage DTLSConn Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/conn/struct.DTLSConn.html?search=std%3A%3Avec Demonstrates the initialization of a new DTLSConn instance and basic lifecycle operations like reading, writing, and closing the connection. ```rust pub struct DTLSConn { /* private fields */ } // Creating a new connection let conn = DTLSConn::new(inner_conn, config, is_client, None).await?; // Reading data let mut buf = [0u8; 1024]; let n = conn.read(&mut buf, None).await?; // Writing data let n = conn.write(b"hello", None).await?; // Closing the connection conn.close().await?; ``` -------------------------------- ### Initialize and use CryptoGcm in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_gcm/struct.CryptoGcm.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates the instantiation of the CryptoGcm struct and the usage of its encryption and decryption methods. It requires local and remote keys and initialization vectors to secure RecordLayerHeader data. ```rust use webrtc_dtls::crypto::crypto_gcm::CryptoGcm; // Initialize CryptoGcm let crypto = CryptoGcm::new(local_key, local_write_iv, remote_key, remote_write_iv); // Encrypt a packet let encrypted = crypto.encrypt(&pkt_rlh, raw_data)?; // Decrypt a packet let decrypted = crypto.decrypt(&encrypted)?; ``` -------------------------------- ### Get Listener Address Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/struct.DTLSListener.html?search= Retrieves the network address that the DTLS listener is currently bound to. ```rust fn addr<'life0, 'async_trait>(&'life0 self) -> Pin> + Send + 'async_trait>> ``` -------------------------------- ### Initialize and Manage DTLSListener in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/struct.DTLSListener.html?search=u32+-%3E+bool Demonstrates the instantiation of a DTLSListener and the primary asynchronous interface for accepting connections and managing the listener lifecycle. ```rust pub struct DTLSListener { /* private fields */ } // Creating a new listener pub fn new(parent: Arc, config: Config) -> Result; // Accepting a new connection fn accept<'life0, 'async_trait>(&'life0 self) -> Pin, SocketAddr), Error>> + Send + 'async_trait>>; // Closing the listener fn close<'life0, 'async_trait>(&'life0 self) -> Pin> + Send + 'async_trait>>; ``` -------------------------------- ### GET OID_ED25519 Constant Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/constant.OID_ED25519.html Retrieves the definition and details of the OID_ED25519 cryptographic constant used in the webrtc-dtls library. ```APIDOC ## GET /crypto/OID_ED25519 ### Description Returns the static Oid (Object Identifier) for the ED25519 cryptographic algorithm used within the webrtc_dtls::crypto module. ### Method GET ### Endpoint webrtc_dtls::crypto::OID_ED25519 ### Parameters #### Path Parameters - None ### Request Example N/A (Constant access) ### Response #### Success Response (200) - **value** (Oid<'static>) - The static Oid representing ED25519. #### Response Example { "constant": "OID_ED25519", "type": "Oid<'static>", "value": "1.3.101.112" } ``` -------------------------------- ### Get DTLSListener Address Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/struct.DTLSListener.html Asynchronously retrieves the network address of the `DTLSListener`. This method returns the socket address the listener is bound to. ```rust fn addr<'life0, 'async_trait>( &'life0 self, ) -> Pin> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, ``` -------------------------------- ### Implement Blanket Implementations for ExtensionRenegotiationInfo in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/renegotiation_info/struct.ExtensionRenegotiationInfo.html?search=std%3A%3Avec Showcases blanket implementations for ExtensionRenegotiationInfo, demonstrating how generic traits like Any, Borrow, BorrowMut, CloneToUninit, From, Into, Same, ToOwned, TryFrom, TryInto, and VZip are applied. ```rust impl Any for T where T: 'static + ?Sized { fn type_id(&self) -> TypeId } impl<'a, T, E> AsTaggedExplicit<'a, E> for T where T: 'a { fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E> } impl<'a, T, E> AsTaggedImplicit<'a, E> for T where T: 'a { fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E> } impl Borrow for T where T: ?Sized { fn borrow(&self) -> &T } impl BorrowMut for T where T: ?Sized { fn borrow_mut(&mut self) -> &mut T } impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8) } impl From for T { fn from(t: T) -> T } impl Into for T where U: From { fn into(self) -> U } impl Same for T { type Output = T } impl ToOwned for T where T: Clone { type Owned = T fn to_owned(&self) -> T fn clone_into(&self, target: &mut T) } impl TryFrom for T where U: Into { type Error = Infallible fn try_from(value: U) -> Result>::Error> } impl TryInto for T where U: TryFrom { type Error = >::Error fn try_into(self) -> Result>::Error> } impl VZip for T where V: MultiLane { // No methods shown for VZip implementation } ``` -------------------------------- ### Initialize CipherSuiteAes256CbcSha (Rust) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_256_cbc_sha/struct.CipherSuiteAes256CbcSha.html?search=u32+-%3E+bool Provides the implementation for initializing a CipherSuiteAes256CbcSha instance. The `init` function takes mutable reference to self and several byte slices (master_secret, client_random, server_random) along with a boolean indicating if it's a client. It returns a Result, indicating potential errors during initialization. ```Rust fn init( &mut self, master_secret: &[u8], client_random: &[u8], server_random: &[u8], is_client: bool, ) -> Result<(), Error> ``` -------------------------------- ### Get DTLSListener Address in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/struct.DTLSListener.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the network address of the DTLS listener. This method returns the local address the listener is bound to. ```rust fn addr<'life0, 'async_trait>( &'life0 self, ) -> Pin> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, ``` -------------------------------- ### HandshakeHeader Methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_header/struct.HandshakeHeader.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides methods for the HandshakeHeader struct, including getting its size, marshalling it into a writer, and unmarshalling it from a reader. These are essential for data serialization and deserialization. ```rust pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result ``` -------------------------------- ### CloneToUninit Trait (Nightly Only) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/config/struct.Config.html?search=std%3A%3Avec This is a nightly-only experimental API that performs copy-assignment from `self` to a raw pointer destination. Use with caution. ```APIDOC ## impl CloneToUninit for T ### Description 🔬This is a nightly-only experimental API. Performs copy-assignment from `self` to `dest`. ### Method `unsafe fn clone_to_uninit(&self, dest: *mut u8)` ### Endpoint N/A (Standard Library Trait) ### Parameters - `dest` (*mut u8) - The destination pointer to copy the data to. ### Request Body None ### Response #### Success Response (N/A) None #### Response Example N/A ``` -------------------------------- ### Initialize and use CryptoCbc in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_cbc/struct.CryptoCbc.html?search=u32+-%3E+bool Demonstrates the structure definition and the primary interface for the CryptoCbc cryptographic handler. It includes methods for creating a new instance and performing packet encryption and decryption. ```rust pub struct CryptoCbc { /* private fields */ } impl CryptoCbc { pub fn new( local_key: &[u8], local_mac: &[u8], remote_key: &[u8], remote_mac: &[u8], ) -> Result; pub fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error>; pub fn decrypt(&self, r: &[u8]) -> Result, Error>; } ``` -------------------------------- ### Get String Representation of CipherSuite (Rust) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_256_cbc_sha/struct.CipherSuiteAes256CbcSha.html?search=std%3A%3Avec Retrieves a string representation of the cipher suite. This method is part of the `CipherSuite` trait implementation for `CipherSuiteAes256CbcSha` and is useful for debugging or logging. ```rust fn to_string(&self) -> String ``` -------------------------------- ### Error Conversion Implementations Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/enum.Error.html?search=std%3A%3Avec Examples of From trait implementations that allow automatic conversion from various error types into the library's main Error type. ```rust impl From for Error { fn from(source: FromUtf8Error) -> Self { Error::InvalidPEM(source.to_string()) } } impl From for Error { fn from(source: InvalidLength) -> Self { Error::Other(source.to_string()) } } ``` -------------------------------- ### Initialize CipherSuiteAes128GcmSha256 Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_128_gcm_sha256/struct.CipherSuiteAes128GcmSha256.html?search= Constructor method to create a new instance of the cipher suite, optionally specifying if it is for RSA. ```rust pub fn new(rsa: bool) -> Self ``` -------------------------------- ### Get CipherSuite Hash Function (Rust) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_256_cbc_sha/struct.CipherSuiteAes256CbcSha.html?search=std%3A%3Avec Returns the hash function used by the cipher suite. This method is part of the `CipherSuite` trait and specifies the cryptographic hash algorithm employed. ```rust fn hash_func(&self) -> CipherSuiteHash ``` -------------------------------- ### Default DTLS Configuration in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/config/struct.Config.html?search= Shows how to obtain the default configuration for DTLS in Rust, providing a baseline set of parameters for establishing a connection. ```rust impl Default for Config { fn default() -> Self { // ... implementation details ... } } ``` -------------------------------- ### CryptoCbc Initialization and Operations - Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_cbc/struct.CryptoCbc.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides methods for initializing and performing cryptographic operations using the `CryptoCbc` struct. This includes creating a new instance with keys and MACs, encrypting data, and decrypting data. ```rust pub fn new( local_key: &[u8], local_mac: &[u8], remote_key: &[u8], remote_mac: &[u8], ) -> Result pub fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error> pub fn decrypt(&self, r: &[u8]) -> Result, Error> ``` -------------------------------- ### Get Client Certificate Type (Rust) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_256_cbc_sha/struct.CipherSuiteAes256CbcSha.html?search=std%3A%3Avec Returns the client certificate type associated with the cipher suite. This method is part of the `CipherSuite` trait and is relevant in scenarios involving client authentication. ```rust fn certificate_type(&self) -> ClientCertificateType ``` -------------------------------- ### Initialize and use CryptoCcm for encryption and decryption Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_ccm/struct.CryptoCcm.html Demonstrates how to instantiate the CryptoCcm struct and perform encryption on a record layer header and raw data, as well as decrypting encrypted packets. ```rust use webrtc_dtls::crypto::crypto_ccm::CryptoCcm; // Initialize the CryptoCcm instance let ccm = CryptoCcm::new(&tag_len, &local_key, &local_write_iv, &remote_key, &remote_write_iv); // Encrypt data let encrypted = ccm.encrypt(&pkt_rlh, &raw_data)?; // Decrypt data let decrypted = ccm.decrypt(&encrypted)?; ``` -------------------------------- ### Get CipherSuite ID (Rust) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_256_cbc_sha/struct.CipherSuiteAes256CbcSha.html?search=std%3A%3Avec Returns the unique identifier for the cipher suite. This method is part of the `CipherSuite` trait and provides a way to programmatically identify the specific cipher suite being used. ```rust fn id(&self) -> CipherSuiteId ``` -------------------------------- ### async fn listen Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/fn.listen.html?search=u32+-%3E+bool Initializes a new DTLS listener bound to a specific address with a provided configuration. ```APIDOC ## ASYNC fn listen ### Description Creates a DTLS listener that binds to the specified address and applies the provided configuration. ### Method N/A (Rust Function) ### Endpoint webrtc_dtls::listener::listen ### Parameters #### Arguments - **laddr** (ToSocketAddrs) - Required - The local address to bind the listener to. - **config** (Config) - Required - The DTLS configuration settings. ### Request Example ```rust let laddr = "127.0.0.1:4444"; let config = Config::default(); let listener = listen(laddr, config).await?; ``` ### Response #### Success Response (Result) - **impl Listener** (Object) - A handle to the active DTLS listener. #### Error Response - **Error** (Enum) - Returns an error if binding fails or configuration is invalid. ``` -------------------------------- ### Implement HandshakeHeader Methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_header/struct.HandshakeHeader.html?search=u32+-%3E+bool Provides implementations for key methods of the HandshakeHeader struct, including `size` to get the header size, `marshal` to serialize the header into a writer, and `unmarshal` to deserialize it from a reader. ```rust impl HandshakeHeader { pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result } ``` -------------------------------- ### Implement ExtensionSupportedPointFormats Methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_supported_point_formats/struct.ExtensionSupportedPointFormats.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides implementations for key methods of the ExtensionSupportedPointFormats struct in Rust. These methods include retrieving the extension value, getting its size, and marshaling/unmarshaling the struct to/from a writer/reader. ```rust impl ExtensionSupportedPointFormats { pub fn extension_value(&self) -> ExtensionValue pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result } ``` -------------------------------- ### Initialize and Manage DTLSConn Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/conn/struct.DTLSConn.html?search=u32+-%3E+bool Demonstrates the structure definition and the primary constructor for creating a new DTLS connection instance. It requires an underlying connection, configuration, and optional initial state. ```rust pub struct DTLSConn { /* private fields */ } impl DTLSConn { pub async fn new( conn: Arc, config: Config, is_client: bool, initial_state: Option, ) -> Result { /* ... */ } } ``` -------------------------------- ### Rust CryptoCbc Initialization Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_cbc/struct.CryptoCbc.html Provides a constructor for the CryptoCbc struct. It requires local and remote keys and MACs to initialize the cryptographic context. Returns a Result indicating success or an Error. ```rust pub fn new( local_key: &[u8], local_mac: &[u8], remote_key: &[u8], remote_mac: &[u8], ) -> Result ``` -------------------------------- ### Get selected SRTP protection profile in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/conn/struct.DTLSConn.html?search= Returns the selected SRTPProtectionProfile for the DTLS connection. This information is important for configuring secure real-time transport protocol (SRTP) if used in conjunction with DTLS. ```rust pub fn selected_srtpprotection_profile(&self) -> SrtpProtectionProfile ``` -------------------------------- ### webrtc-dtls Content Enum Methods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/content/enum.Content.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides implementations for key methods of the `Content` enum, including `content_type` to get the type, `size` to determine its byte size, and `marshal`/`unmarshal` for serialization and deserialization. ```rust pub fn content_type(&self) -> ContentType pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal( content_type: ContentType, reader: &mut R, ) -> Result ``` -------------------------------- ### Initialize CipherSuiteAes256CbcSha Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_256_cbc_sha/struct.CipherSuiteAes256CbcSha.html Demonstrates the instantiation of the CipherSuiteAes256CbcSha struct. The constructor accepts a boolean flag to indicate if RSA is used. ```rust use webrtc_dtls::cipher_suite::cipher_suite_aes_256_cbc_sha::CipherSuiteAes256CbcSha; let cipher_suite = CipherSuiteAes256CbcSha::new(true); ``` -------------------------------- ### Try Conversion for ExtensionRenegotiationInfo in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/renegotiation_info/struct.ExtensionRenegotiationInfo.html?search=u32+-%3E+bool Implements `TryFrom` and `TryInto` for ExtensionRenegotiationInfo. `TryFrom` attempts to create an instance from another type, returning a `Result`. `TryInto` is the reciprocal, attempting conversion into another type that implements `TryFrom`. ```Rust type Error = Infallible ``` ```Rust fn try_from(value: U) -> Result>::Error> ``` ```Rust type Error = >::Error ``` ```Rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Implement HandshakeMessageCertificateVerify Methods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_message_certificate_verify/struct.HandshakeMessageCertificateVerify.html?search= Provides implementations for core methods of the HandshakeMessageCertificateVerify struct. These include retrieving the handshake type, getting the size of the message, and methods for marshaling (writing) and unmarshaling (reading) the message to/from a writer/reader. ```Rust pub fn handshake_type(&self) -> HandshakeType pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result ``` -------------------------------- ### Initialize and use CryptoCbc for encryption and decryption Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_cbc/struct.CryptoCbc.html?search=std%3A%3Avec Demonstrates the instantiation of the CryptoCbc struct and the usage of its encrypt and decrypt methods for handling cryptographic operations on packet data. ```rust use webrtc_dtls::crypto::crypto_cbc::CryptoCbc; // Initialize the struct let crypto = CryptoCbc::new(local_key, local_mac, remote_key, remote_mac)?; // Encrypt a packet let encrypted_data = crypto.encrypt(&pkt_rlh, raw_data)?; // Decrypt a packet let decrypted_data = crypto.decrypt(&encrypted_data)?; ``` -------------------------------- ### Implement HandshakeMessageCertificate Methods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_message_certificate/struct.HandshakeMessageCertificate.html?search= Provides implementations for key methods of the `HandshakeMessageCertificate` struct. These include retrieving the handshake type, getting the size of the message, and methods for marshaling (writing) and unmarshaling (reading) the message to/from a writer or reader. ```rust impl HandshakeMessageCertificate { pub fn handshake_type(&self) -> HandshakeType pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result } ``` -------------------------------- ### Implement CipherSuite Trait for CipherSuiteAes128Ccm in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_128_ccm/struct.CipherSuiteAes128Ccm.html?search= Details the implementation of the CipherSuite trait for the CipherSuiteAes128Ccm struct. This includes methods for converting to a string, getting the ID, certificate type, hash function, PSK status, initialization, encryption, and decryption. ```Rust impl CipherSuite for CipherSuiteAes128Ccm { fn to_string(&self) -> String fn id(&self) -> CipherSuiteId fn certificate_type(&self) -> ClientCertificateType fn hash_func(&self) -> CipherSuiteHash fn is_psk(&self) -> bool fn is_initialized(&self) -> bool fn init( &mut self, master_secret: &[u8], client_random: &[u8], server_random: &[u8], is_client: bool, ) -> Result<(), Error> fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error> fn decrypt(&self, input: &[u8]) -> Result, Error> } ``` -------------------------------- ### Initialize CryptoGcm Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_gcm/struct.CryptoGcm.html?search= Provides a constructor function 'new' for the CryptoGcm struct. This function initializes a new CryptoGcm instance with the necessary local and remote keys and initialization vectors. ```rust pub fn new( local_key: &[u8], local_write_iv: &[u8], remote_key: &[u8], remote_write_iv: &[u8], ) -> Self ``` -------------------------------- ### Define ExtensionServerName struct and methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_server_name/struct.ExtensionServerName.html?search=u32+-%3E+bool The ExtensionServerName struct provides functionality to manage DTLS server name extensions. It includes methods to retrieve the extension value, get the size, and perform binary serialization and deserialization. ```rust pub struct ExtensionServerName { /* private fields */ } impl ExtensionServerName { pub fn extension_value(&self) -> ExtensionValue { /* ... */ } pub fn size(&self) -> usize { /* ... */ } pub fn marshal(&self, writer: &mut W) -> Result<(), Error> { /* ... */ } pub fn unmarshal(reader: &mut R) -> Result { /* ... */ } } ``` -------------------------------- ### Initialize CryptoCcm in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_ccm/struct.CryptoCcm.html?search= Provides a constructor for the CryptoCcm struct. It takes cryptographic keys and initialization vectors for both local and remote endpoints to set up the encryption context. ```rust pub fn new( tag_len: &CryptoCcmTagLen, local_key: &[u8], local_write_iv: &[u8], remote_key: &[u8], remote_write_iv: &[u8], ) -> Self ``` -------------------------------- ### listen Function Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/index.html?search=u32+-%3E+bool Listen creates a DTLS listener. ```APIDOC ## Function: listen ### Description Listen creates a DTLS listener. ### Signature (Signature details not provided in the input text.) ### Parameters (No parameters documented in the provided text.) ### Returns (Return type and value not documented in the provided text.) ``` -------------------------------- ### Get DTLSConn connection state in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/conn/struct.DTLSConn.html?search= Asynchronously retrieves the current state of the DTLS connection. This method provides basic DTLS details and replaced the `Export` function in v1. The returned `State` enum indicates the connection's status. ```rust pub async fn connection_state(&self) -> State ``` -------------------------------- ### Implement CipherSuite Trait for CipherSuiteTlsPskWithAes128GcmSha256 in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_tls_psk_with_aes_128_gcm_sha256/struct.CipherSuiteTlsPskWithAes128GcmSha256.html?search=u32+-%3E+bool Implements the `CipherSuite` trait for `CipherSuiteTlsPskWithAes128GcmSha256`, providing methods for converting to a string, getting the cipher suite ID, determining certificate type, hash function, PSK status, initialization status, encryption, and decryption. ```rust impl CipherSuite for CipherSuiteTlsPskWithAes128GcmSha256 { fn to_string(&self) -> String; fn id(&self) -> CipherSuiteId; fn certificate_type(&self) -> ClientCertificateType; fn hash_func(&self) -> CipherSuiteHash; fn is_psk(&self) -> bool; fn is_initialized(&self) -> bool; fn init( &mut self, master_secret: &[u8], client_random: &[u8], server_random: &[u8], is_client: bool, ) -> Result<(), Error>; fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error>; fn decrypt(&self, input: &[u8]) -> Result, Error>; } ``` -------------------------------- ### Implement Blanket Traits for ExtensionSupportedPointFormats (Rust) Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_supported_point_formats/struct.ExtensionSupportedPointFormats.html Demonstrates blanket implementations of traits like Any, AsTaggedExplicit, AsTaggedImplicit, Borrow, BorrowMut, CloneToUninit, From, Into, Same, ToOwned, TryFrom, TryInto, and VZip for ExtensionSupportedPointFormats, showcasing generic functionality. ```rust impl Any for T where T: 'static + ?Sized { fn type_id(&self) -> TypeId } impl<'a, T, E> AsTaggedExplicit<'a, E> for T where T: 'a { fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E> } impl<'a, T, E> AsTaggedImplicit<'a, E> for T where T: 'a { fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E> } impl Borrow for T where T: ?Sized { fn borrow(&self) -> &T } impl BorrowMut for T where T: ?Sized { fn borrow_mut(&mut self) -> &mut T } impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8) } impl From for T { fn from(t: T) -> T } impl Into for T where U: From { fn into(self) -> U } impl Same for T { type Output = T } impl ToOwned for T where T: Clone { type Owned = T; fn to_owned(&self) -> T; fn clone_into(&self, target: &mut T) } impl TryFrom for T where U: Into { type Error = Infallible; fn try_from(value: U) -> Result>::Error> } impl TryInto for T where U: TryFrom { type Error = >::Error; fn try_into(self) -> Result>::Error> } impl VZip for T where V: MultiLane { fn vzip(self) -> V } ``` -------------------------------- ### Implement serialization and deserialization for CompressionMethods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/compression_methods/struct.CompressionMethods.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides methods to calculate the binary size, serialize (marshal) to a writer, and deserialize (unmarshal) from a reader for the CompressionMethods struct. ```rust impl CompressionMethods { pub fn size(&self) -> usize { ... } pub fn marshal(&self, writer: &mut W) -> Result<(), Error> { ... } pub fn unmarshal(reader: &mut R) -> Result { ... } } ``` -------------------------------- ### Implement CipherSuite Trait for CipherSuiteTlsPskWithAes128GcmSha256 in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_tls_psk_with_aes_128_gcm_sha256/struct.CipherSuiteTlsPskWithAes128GcmSha256.html Implements the CipherSuite trait for the CipherSuiteTlsPskWithAes128GcmSha256 struct. This includes methods for converting to a string, getting the cipher suite ID, determining certificate type, hash function, PSK status, initialization, encryption, and decryption. ```Rust impl CipherSuite for CipherSuiteTlsPskWithAes128GcmSha256 { fn to_string(&self) -> String; fn id(&self) -> CipherSuiteId; fn certificate_type(&self) -> ClientCertificateType; fn hash_func(&self) -> CipherSuiteHash; fn is_psk(&self) -> bool; fn is_initialized(&self) -> bool; fn init( &mut self, master_secret: &[u8], client_random: &[u8], server_random: &[u8], is_client: bool, ) -> Result<(), Error>; fn encrypt(&self, pkt_rlh: &RecordLayerHeader, raw: &[u8]) -> Result, Error>; fn decrypt(&self, input: &[u8]) -> Result, Error>; } ``` -------------------------------- ### DTLSListener Initialization Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/struct.DTLSListener.html?search= Create a new instance of a DTLSListener using a parent listener and configuration. ```APIDOC ## POST /new ### Description Creates a new DTLS listener that accepts connections from an inner listener. ### Method POST ### Parameters #### Request Body - **parent** (Arc) - Required - The underlying listener to accept connections from. - **config** (Config) - Required - Configuration settings including handshake timeouts. ### Response #### Success Response (200) - **DTLSListener** (Struct) - The initialized listener instance. ### Response Example { "status": "success", "message": "DTLSListener created" } ``` -------------------------------- ### Implement CipherSuite Trait for CipherSuiteAes128Ccm Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_128_ccm/struct.CipherSuiteAes128Ccm.html?search=u32+-%3E+bool Implements the CipherSuite trait for the CipherSuiteAes128Ccm struct. This includes methods for converting the cipher suite to a string, getting its ID, certificate type, hash function, PSK status, initialization status, and performing encryption and decryption operations. ```rust fn to_string(&self) -> String fn id(&self) -> CipherSuiteId fn certificate_type(&self) -> ClientCertificateType fn hash_func(&self) -> CipherSuiteHash fn is_psk(&self) -> bool fn is_initialized(&self) -> bool fn init( &mut self, master_secret: &[u8], client_random: &[u8], server_random: &[u8], is_client: bool, ) -> Result<(), Error> fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error> fn decrypt(&self, input: &[u8]) -> Result, Error> ``` -------------------------------- ### CryptoGcm Struct and Methods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_gcm/struct.CryptoGcm.html?search=u32+-%3E+bool Documentation for the CryptoGcm struct, including its constructor, encryption, and decryption methods. ```APIDOC ## Struct CryptoGcm ### Description Represents a cryptographic context for GCM mode encryption and decryption. ### Methods #### `new(local_key: &[u8], local_write_iv: &[u8], remote_key: &[u8], remote_write_iv: &[u8]) -> Self` ##### Description Constructs a new `CryptoGcm` instance with the provided keys and initialization vectors. ##### Parameters - **local_key** (`&[u8]`) - The local encryption key. - **local_write_iv** (`&[u8]`) - The local initialization vector for writing. - **remote_key** (`&[u8]`) - The remote encryption key. - **remote_write_iv** (`&[u8]`) - The remote initialization vector for writing. #### `encrypt(&self, pkt_rlh: &RecordLayerHeader, raw: &[u8]) -> Result, Error>` ##### Description Encrypts a raw byte slice using the provided `RecordLayerHeader`. ##### Parameters - **pkt_rlh** (`&RecordLayerHeader`) - The record layer header containing metadata for encryption. - **raw** (`&[u8]`) - The raw data to encrypt. ##### Returns - `Result, Error>` - A `Result` containing the encrypted data as a `Vec` on success, or an `Error` on failure. #### `decrypt(&self, r: &[u8]) -> Result, Error>` ##### Description Decrypts a byte slice using the stored keys and IVs. ##### Parameters - **r** (`&[u8]`) - The encrypted data to decrypt. ##### Returns - `Result, Error>` - A `Result` containing the decrypted data as a `Vec` on success, or an `Error` on failure. ``` -------------------------------- ### Implement Extension Methods for ExtensionUseExtendedMasterSecret in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_use_extended_master_secret/struct.ExtensionUseExtendedMasterSecret.html?search= Provides implementations for key methods of the `ExtensionUseExtendedMasterSecret` struct. These include `extension_value` to get the extension's type, `size` to determine its byte size, `marshal` to serialize it into a writer, and `unmarshal` to deserialize it from a reader. These methods are crucial for handling the extension during DTLS communication. ```rust impl ExtensionUseExtendedMasterSecret { pub fn extension_value(&self) -> ExtensionValue pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result } ``` -------------------------------- ### Initialize CipherSuiteAes128Ccm Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_128_ccm/struct.CipherSuiteAes128Ccm.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Constructor for creating a new instance of the CipherSuiteAes128Ccm struct with specific security parameters. ```rust pub fn new( client_certificate_type: ClientCertificateType, id: CipherSuiteId, psk: bool, crypto_ccm_tag_len: CryptoCcmTagLen, ) -> Self ``` -------------------------------- ### Implement Handshake Methods for HandshakeMessageServerHelloDone in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_message_server_hello_done/struct.HandshakeMessageServerHelloDone.html?search= Provides implementations for core handshake-related methods for the `HandshakeMessageServerHelloDone` struct. These include `handshake_type` to get the type of the handshake message, `size` to determine its byte size, `marshal` to serialize the message into a writer, and `unmarshal` to deserialize it from a reader. These methods are crucial for message processing during the DTLS handshake. ```rust pub fn handshake_type(&self) -> HandshakeType pub fn size(&self) -> usize pub fn marshal(&self, _writer: &mut W) -> Result<(), Error> pub fn unmarshal(_reader: &mut R) -> Result ``` -------------------------------- ### Implement ExtensionUseSrtp Methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_use_srtp/struct.ExtensionUseSrtp.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides implementations for key methods of the ExtensionUseSrtp struct. These include retrieving the extension value, its size, and methods for marshaling (writing) and unmarshaling (reading) the extension data to/from a writer or reader. ```rust impl ExtensionUseSrtp { pub fn extension_value(&self) -> ExtensionValue pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result } ``` -------------------------------- ### CipherSuite Trait Definition in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/trait.CipherSuite.html?search=u32+-%3E+bool Defines the CipherSuite trait, outlining the essential methods for cryptographic operations within the webrtc-dtls library. It includes functions for converting to string, getting an ID, determining certificate type, specifying hash functions, checking for PSK usage, verifying initialization status, initializing the suite with secrets and random values, and performing encryption and decryption. ```rust pub trait CipherSuite { // Required methods fn to_string(&self) -> String; fn id(&self) -> CipherSuiteId; fn certificate_type(&self) -> ClientCertificateType; fn hash_func(&self) -> CipherSuiteHash; fn is_psk(&self) -> bool; fn is_initialized(&self) -> bool; fn init( &mut self, master_secret: &[u8], client_random: &[u8], server_random: &[u8], is_client: bool, ) -> Result<(), Error>; fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error>; fn decrypt(&self, input: &[u8]) -> Result, Error>; } ``` -------------------------------- ### Implement core methods for ExtensionSupportedPointFormats Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_supported_point_formats/struct.ExtensionSupportedPointFormats.html?search=std%3A%3Avec Methods for retrieving extension values, calculating size, and performing binary serialization/deserialization. ```rust impl ExtensionSupportedPointFormats { pub fn extension_value(&self) -> ExtensionValue { ... } pub fn size(&self) -> usize { ... } pub fn marshal(&self, writer: &mut W) -> Result<(), Error> { ... } pub fn unmarshal(reader: &mut R) -> Result { ... } } ``` -------------------------------- ### Initialize and Manage DTLSConn in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/conn/struct.DTLSConn.html Demonstrates the creation of a new DTLS connection and the primary methods for reading, writing, and closing the connection. These methods are asynchronous and return Result types to handle potential errors during network operations. ```rust pub async fn new(conn: Arc, config: Config, is_client: bool, initial_state: Option) -> Result; pub async fn read(&self, p: &mut [u8], duration: Option) -> Result; pub async fn write(&self, p: &[u8], duration: Option) -> Result; pub async fn close(&self) -> Result<(), Error>; ``` -------------------------------- ### Cloning DTLS Configuration in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/config/struct.Config.html?search= Demonstrates how to clone the DTLS configuration object in Rust, allowing for the creation of independent copies of the configuration settings. ```rust impl Clone for Config { fn clone(&self) -> Config { // ... implementation details ... } fn clone_from(&mut self, source: &Self) { // ... implementation details ... } } ``` -------------------------------- ### Initialize and use CryptoCcm for encryption and decryption Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_ccm/struct.CryptoCcm.html?search=u32+-%3E+bool Demonstrates the instantiation of the CryptoCcm struct and the usage of its primary encryption and decryption methods. These methods handle packet processing for DTLS record layers. ```rust pub struct CryptoCcm { /* private fields */ } impl CryptoCcm { pub fn new(tag_len: &CryptoCcmTagLen, local_key: &[u8], local_write_iv: &[u8], remote_key: &[u8], remote_write_iv: &[u8]) -> Self; pub fn encrypt(&self, pkt_rlh: &RecordLayerHeader, raw: &[u8]) -> Result, Error>; pub fn decrypt(&self, r: &[u8]) -> Result, Error>; } ``` -------------------------------- ### Create CipherSuiteAes128Ccm Instance Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_128_ccm/struct.CipherSuiteAes128Ccm.html?search=u32+-%3E+bool Provides the constructor for the CipherSuiteAes128Ccm struct. This function initializes a new instance with parameters such as client certificate type, cipher suite ID, PSK status, and crypto CCM tag length. It returns a new CipherSuiteAes128Ccm instance. ```rust pub fn new( client_certificate_type: ClientCertificateType, id: CipherSuiteId, psk: bool, crypto_ccm_tag_len: CryptoCcmTagLen, ) -> Self ``` -------------------------------- ### Implement Copy and Eq for CompressionMethodId in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/compression_methods/enum.CompressionMethodId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the `Copy` and `Eq` traits for `CompressionMethodId`. `Copy` allows simple bitwise copies, while `Eq` guarantees that equality is reflexive, symmetric, and transitive, reinforcing the behavior of the `PartialEq` implementation. ```rust impl Copy for CompressionMethodId impl Eq for CompressionMethodId ``` -------------------------------- ### Debug and PartialEq Implementations for ExtensionUseSrtp Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/extension_use_srtp/struct.ExtensionUseSrtp.html This Rust code illustrates the `Debug` and `PartialEq` trait implementations for the `ExtensionUseSrtp` struct. The `Debug` implementation allows the struct to be formatted for debugging output. The `PartialEq` implementation enables comparison for equality (`eq`) and inequality (`ne`) between two `ExtensionUseSrtp` instances. ```rust fn fmt(&self, f: &mut Formatter<'_>) -> Result fn eq(&self, other: &ExtensionUseSrtp) -> bool fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Implement ExtensionRenegotiationInfo Methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/extension/renegotiation_info/struct.ExtensionRenegotiationInfo.html?search=std%3A%3Avec Provides implementations for key methods of the ExtensionRenegotiationInfo struct, including retrieving the extension value, its size, and methods for marshaling (encoding) and unmarshaling (decoding) the extension data. These methods are crucial for data serialization and deserialization. ```rust impl ExtensionRenegotiationInfo { pub fn extension_value(&self) -> ExtensionValue pub fn size(&self) -> usize pub fn marshal(&self, writer: &mut W) -> Result<(), Error> pub fn unmarshal(reader: &mut R) -> Result } ``` -------------------------------- ### Implement CryptoCcm Constructor and Methods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_ccm/struct.CryptoCcm.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides the implementation for the CryptoCcm struct, including a constructor 'new' to initialize the struct with keys and IVs, and methods for 'encrypt' and 'decrypt' operations on raw data. ```rust pub fn new( tag_len: &CryptoCcmTagLen, local_key: &[u8], local_write_iv: &[u8], remote_key: &[u8], remote_write_iv: &[u8], ) -> Self ``` ```rust pub fn encrypt( &self, pkt_rlh: &RecordLayerHeader, raw: &[u8], ) -> Result, Error> ``` ```rust pub fn decrypt(&self, r: &[u8]) -> Result, Error> ``` -------------------------------- ### Implement HandshakeMessageServerKeyExchange methods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_message_server_key_exchange/struct.HandshakeMessageServerKeyExchange.html?search= Core methods for interacting with the handshake message, including type identification, size calculation, and binary serialization/deserialization. ```rust impl HandshakeMessageServerKeyExchange { pub fn handshake_type(&self) -> HandshakeType; pub fn size(&self) -> usize; pub fn marshal(&self, writer: &mut W) -> Result<(), Error>; pub fn unmarshal(reader: &mut R) -> Result; } ``` -------------------------------- ### Config Struct Implementations Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/config/struct.Config.html This section details the trait implementations for the `Config` struct, including cloning behavior and default value instantiation. ```APIDOC ## Config Struct Implementations This section outlines the available trait implementations for the `Config` struct. ### Trait Implementations #### `impl Clone for Config` - **`fn clone(&self) -> Config`**: Returns a duplicate of the `Config` value. - **`fn clone_from(&mut self, source: &Self)`**: Performs copy-assignment from a source `Config`. #### `impl Default for Config` - **`fn default() -> Self`**: Returns the default value for the `Config` type. ``` -------------------------------- ### Implement PartialEq for CompressionMethods in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/compression_methods/struct.CompressionMethods.html?search=u32+-%3E+bool Implements the `PartialEq` trait for the `CompressionMethods` struct in Rust, allowing instances to be compared for equality. It provides `eq` and `ne` methods for equality and inequality checks. ```rust impl PartialEq for CompressionMethods { fn eq(&self, other: &CompressionMethods) -> bool fn ne(&self, other: &Rhs) -> bool } ``` -------------------------------- ### Initialize CipherSuiteAes128GcmSha256 Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/cipher_suite/cipher_suite_aes_128_gcm_sha256/struct.CipherSuiteAes128GcmSha256.html Defines the structure and instantiation of the CipherSuiteAes128GcmSha256 cipher suite. The constructor accepts a boolean flag to indicate if RSA is used. ```rust pub struct CipherSuiteAes128GcmSha256 { /* private fields */ } impl CipherSuiteAes128GcmSha256 { pub fn new(rsa: bool) -> Self { // Implementation details } } ``` -------------------------------- ### Clone To Uninit with CryptoCcm in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/crypto/crypto_ccm/struct.CryptoCcm.html?search= Implements the CloneToUninit trait (nightly-only experimental API). This allows copying data from a CryptoCcm instance to an uninitialized memory location. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Implement HandshakeMessageServerHello methods Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/handshake/handshake_message_server_hello/struct.HandshakeMessageServerHello.html?search=std%3A%3Avec Methods for interacting with the ServerHello message, including type identification, size calculation, and binary serialization/deserialization. ```rust impl HandshakeMessageServerHello { pub fn handshake_type(&self) -> HandshakeType; pub fn size(&self) -> usize; pub fn marshal(&self, writer: &mut W) -> Result<(), Error>; pub fn unmarshal(reader: &mut R) -> Result; } ``` -------------------------------- ### Async listen function Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/listener/fn.listen.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Initializes a DTLS listener on a specified address with a given configuration. ```APIDOC ## [ASYNC] listen ### Description Creates a new DTLS listener bound to the provided socket address using the specified configuration. ### Method ASYNC FUNCTION ### Endpoint webrtc_dtls::listener::listen ### Parameters #### Arguments - **laddr** (ToSocketAddrs) - Required - The local address to bind the listener to. - **config** (Config) - Required - The DTLS configuration settings. ### Request Example ```rust let laddr = "127.0.0.1:4444"; let config = Config::default(); let listener = listen(laddr, config).await?; ``` ### Response #### Success Response (Ok) - **impl Listener** (Result) - Returns an implementation of the Listener trait upon success. #### Error Response (Err) - **Error** (Result) - Returns an error if binding fails or configuration is invalid. ``` -------------------------------- ### Blanket Implementations for Generic Types in Rust Source: https://docs.rs/webrtc-dtls/0.12.0/webrtc_dtls/curve/enum.EllipticCurveType.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Showcases blanket implementations for generic types, demonstrating how traits like Any, AsTaggedExplicit, AsTaggedImplicit, Borrow, BorrowMut, CloneToUninit, From, Into, Same, ToOwned, TryFrom, TryInto, and VZip can be applied to various types. ```Rust impl Any for T impl<'a, T, E> AsTaggedExplicit<'a, E> for T impl<'a, T, E> AsTaggedImplicit<'a, E> for T impl Borrow for T impl BorrowMut for T impl CloneToUninit for T impl From for T impl Into for T impl Same for T impl ToOwned for T impl TryFrom for T impl TryInto for T impl VZip for T ```