File tree Expand file tree Collapse file tree 7 files changed +43
-8
lines changed Expand file tree Collapse file tree 7 files changed +43
-8
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,17 @@ impl CoapContext<'_> {
305305 reserved : [ 0 ; 7 ] ,
306306 validate_id_call_back : Some ( dtls_server_id_callback) ,
307307 id_call_back_arg : inner_ref. raw_context as * mut c_void ,
308- validate_sni_call_back : Some ( dtls_server_sni_callback) ,
308+ validate_sni_call_back : {
309+ // Unsupported by TinyDTLS
310+ #[ cfg( not( feature = "dtls_tinydtls" ) ) ]
311+ {
312+ Some ( dtls_server_sni_callback)
313+ }
314+ #[ cfg( feature = "dtls_tinydtls" ) ]
315+ {
316+ None
317+ }
318+ } ,
309319 sni_call_back_arg : inner_ref. raw_context as * mut c_void ,
310320 psk_info : initial_data,
311321 } ) ) ,
@@ -533,6 +543,13 @@ impl CoapContext<'_> {
533543 . unwrap ( )
534544 . apply_to_spsk_info ( & mut inner_ref. crypto_last_info_ref ) ;
535545 Some ( & inner_ref. crypto_last_info_ref . key )
546+ } else if inner_ref. crypto_default_info . is_some ( ) {
547+ inner_ref
548+ . crypto_default_info
549+ . as_ref ( )
550+ . unwrap ( )
551+ . apply_to_spsk_info ( & mut inner_ref. crypto_last_info_ref ) ;
552+ Some ( & inner_ref. crypto_last_info_ref . key )
536553 } else {
537554 None
538555 }
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ pub trait CoapClientCryptoProvider: Debug {
7979 ///
8080 /// Return a CoapCryptoProviderResponse corresponding to the cryptographic information that
8181 /// should be used.
82+ ///
83+ /// Note: Unsupported by the MBedTLS DTLS backend.
8284 fn provide_key_for_hint (
8385 & mut self ,
8486 hint : & CoapCryptoPskIdentity ,
@@ -110,6 +112,8 @@ pub trait CoapServerCryptoProvider: Debug {
110112 /// hint.
111113 ///
112114 /// Return None if the provided SNI is unacceptable, i.e. you have no key for this server name.
115+ ///
116+ /// Note: Unsupported by the TinyDTLS DTLS backend.
113117 #[ allow( unused_variables) ]
114118 fn provide_hint_for_sni ( & mut self , sni : & str ) -> CoapCryptoProviderResponse < CoapCryptoPskInfo > {
115119 CoapCryptoProviderResponse :: UseCurrent
Original file line number Diff line number Diff line change @@ -509,7 +509,7 @@ impl CoapRequest {
509509 }
510510 pdu. clear_options ( ) ;
511511 for opt in additional_opts {
512- ( & mut pdu) . add_option ( opt) ;
512+ pdu. add_option ( opt) ;
513513 }
514514 if proxy_scheme. is_some ( ) && proxy_uri. is_some ( ) {
515515 return Err ( MessageConversionError :: InvalidOptionCombination (
Original file line number Diff line number Diff line change @@ -244,9 +244,11 @@ impl<D: Any + ?Sized + Debug> CoapResource<D> {
244244 let raw_resource = coap_resource_init (
245245 uri_path,
246246 ( COAP_RESOURCE_FLAGS_RELEASE_URI
247- | ( notify_con
248- . then ( || COAP_RESOURCE_FLAGS_NOTIFY_CON )
249- . unwrap_or ( COAP_RESOURCE_FLAGS_NOTIFY_NON ) ) ) as i32 ,
247+ | if notify_con {
248+ COAP_RESOURCE_FLAGS_NOTIFY_CON
249+ } else {
250+ COAP_RESOURCE_FLAGS_NOTIFY_NON
251+ } ) as i32 ,
250252 ) ;
251253 let inner = CoapFfiRcCell :: new ( CoapResourceInner {
252254 raw_resource,
Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ impl CoapClientSession<'_> {
5555 /// Will return a [SessionCreationError] if libcoap was unable to create a session (most likely
5656 /// because it was not possible to bind to a port).
5757 #[ cfg( feature = "dtls" ) ]
58- pub fn connect_dtls < ' a , ' b , P : ' static + CoapClientCryptoProvider > (
59- ctx : & ' b mut CoapContext < ' a > ,
58+ pub fn connect_dtls < ' a , P : ' static + CoapClientCryptoProvider > (
59+ ctx : & mut CoapContext < ' a > ,
6060 addr : SocketAddr ,
6161 mut crypto_provider : P ,
6262 ) -> Result < CoapClientSession < ' a > , SessionCreationError > {
@@ -65,7 +65,17 @@ impl CoapClientSession<'_> {
6565 let client_setup_data = Box :: into_raw ( Box :: new ( coap_dtls_cpsk_t {
6666 version : COAP_DTLS_SPSK_SETUP_VERSION as u8 ,
6767 reserved : [ 0 ; 7 ] ,
68- validate_ih_call_back : Some ( dtls_ih_callback) ,
68+ validate_ih_call_back : {
69+ // Unsupported by MbedTLS
70+ #[ cfg( not( feature = "dtls_mbedtls" ) ) ]
71+ {
72+ Some ( dtls_ih_callback)
73+ }
74+ #[ cfg( feature = "dtls_mbedtls" ) ]
75+ {
76+ None
77+ }
78+ } ,
6979 ih_call_back_arg : std:: ptr:: null_mut ( ) ,
7080 client_sni : std:: ptr:: null_mut ( ) ,
7181 psk_info : coap_dtls_cpsk_info_t {
Original file line number Diff line number Diff line change 55 * See the README as well as the LICENSE file for more information.
66 */
77/// TODO
8+ #[ allow( dead_code) ]
89#[ cfg( feature = "tcp" ) ]
910pub struct CoapTcpEndpoint { }
Original file line number Diff line number Diff line change 55 * See the README as well as the LICENSE file for more information.
66 */
77/// TODO
8+ #[ allow( dead_code) ]
89#[ cfg( feature = "tcp" ) ]
910pub struct CoapTlsEndpoint { }
You can’t perform that action at this time.
0 commit comments