pub trait ServerPskSniKeyProvider<'a>: Debug {
// Required method
fn key_for_sni(
&self,
sni: &CStr,
session: &CoapServerSession<'_>,
) -> Option<PskKey<'a>>;
}Expand description
Trait for things that can provide PSK DTLS keys for a given Server Name Indication.
Required Methods§
Sourcefn key_for_sni(
&self,
sni: &CStr,
session: &CoapServerSession<'_>,
) -> Option<PskKey<'a>>
fn key_for_sni( &self, sni: &CStr, session: &CoapServerSession<'_>, ) -> Option<PskKey<'a>>
Provide a key for the server name indication given as sni, or None if the SNI is not
valid and no key is available.
Note that libcoap will remember the returned key and re-use it for future handshakes with
the same SNI (even if the peer is not the same), the return value should therefore not
depend on the provided session.
Implementations on Foreign Types§
Source§impl<'a, T: Borrow<[u8]> + Debug + Eq + Hash, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for HashMap<T, U>
impl<'a, T: Borrow<[u8]> + Debug + Eq + Hash, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for HashMap<T, U>
Source§fn key_for_sni(
&self,
sni: &CStr,
_session: &CoapServerSession<'_>,
) -> Option<PskKey<'a>>
fn key_for_sni( &self, sni: &CStr, _session: &CoapServerSession<'_>, ) -> Option<PskKey<'a>>
Return the map value if the key matches the given SNI.
Source§impl<'a, T: Borrow<[u8]> + Debug + Ord, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for BTreeMap<T, U>
impl<'a, T: Borrow<[u8]> + Debug + Ord, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for BTreeMap<T, U>
Source§fn key_for_sni(
&self,
sni: &CStr,
_session: &CoapServerSession<'_>,
) -> Option<PskKey<'a>>
fn key_for_sni( &self, sni: &CStr, _session: &CoapServerSession<'_>, ) -> Option<PskKey<'a>>
Return the map value if the key matches the given SNI.
Source§impl<'a, T: AsRef<[u8]> + Debug, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for Vec<(T, U)>
impl<'a, T: AsRef<[u8]> + Debug, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for Vec<(T, U)>
Source§fn key_for_sni(
&self,
sni: &CStr,
_session: &CoapServerSession<'_>,
) -> Option<PskKey<'a>>
fn key_for_sni( &self, sni: &CStr, _session: &CoapServerSession<'_>, ) -> Option<PskKey<'a>>
Return the second tuple object if the first one matches the given SNI.
Source§impl<'a, T: AsRef<[u8]> + Debug, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for [(T, U)]
impl<'a, T: AsRef<[u8]> + Debug, U: AsRef<PskKey<'a>> + Debug> ServerPskSniKeyProvider<'a> for [(T, U)]
Source§fn key_for_sni(
&self,
sni: &CStr,
_session: &CoapServerSession<'_>,
) -> Option<PskKey<'a>>
fn key_for_sni( &self, sni: &CStr, _session: &CoapServerSession<'_>, ) -> Option<PskKey<'a>>
Return the second tuple object if the first one matches the given SNI.