2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Add isc_nm_has_encryption()

This commit adds an isc_nm_has_encryption() function intended to check
if a given handle is backed by a connection which uses encryption.
This commit is contained in:
Artem Boldariev
2021-11-16 13:35:37 +02:00
parent 07cf827b0b
commit f0e18f3927
4 changed files with 50 additions and 0 deletions

View File

@@ -3500,6 +3500,28 @@ isc_nm_socket_type(const isc_nmhandle_t *handle) {
return (handle->sock->type);
}
bool
isc_nm_has_encryption(const isc_nmhandle_t *handle) {
REQUIRE(VALID_NMHANDLE(handle));
REQUIRE(VALID_NMSOCK(handle->sock));
switch (handle->sock->type) {
case isc_nm_tlsdnssocket:
#if HAVE_LIBNGHTTP2
case isc_nm_tlssocket:
#endif /* HAVE_LIBNGHTTP2 */
return (true);
#if HAVE_LIBNGHTTP2
case isc_nm_httpsocket:
return (isc__nm_http_has_encryption(handle));
#endif /* HAVE_LIBNGHTTP2 */
default:
return (false);
};
return (false);
}
#ifdef NETMGR_TRACE
/*
* Dump all active sockets in netmgr. We output to stderr