Commit 5fbe7e86 authored by Jan Včelák's avatar Jan Včelák 🚀

libknot: add knot_dname_in()

parent fe1bf738
......@@ -453,6 +453,13 @@ bool knot_dname_is_sub(const knot_dname_t *sub, const knot_dname_t *domain)
/*----------------------------------------------------------------------------*/
bool knot_dname_in(const knot_dname_t *domain, const knot_dname_t *sub)
{
return knot_dname_is_equal(domain, sub) || knot_dname_is_sub(sub, domain);
}
/*----------------------------------------------------------------------------*/
bool knot_dname_is_wildcard(const knot_dname_t *name)
{
assert(name != NULL);
......
......@@ -191,6 +191,17 @@ int knot_dname_realsize(const knot_dname_t *name, const uint8_t *pkt);
*/
bool knot_dname_is_sub(const knot_dname_t *sub, const knot_dname_t *domain);
/*!
* \brief Check if the domain name is a subdomain of or equal to other.
*
* \param domain Domain name to be the possible parent domain.
* \param sub Domain name to be the possible subdomain.
*
* \retval true \a sub us a subdomain or equal to \a domain.
* \retval false otherwise.
*/
bool knot_dname_in(const knot_dname_t *domain, const knot_dname_t *sub);
/*!
* \brief Checks if the domain name is a wildcard.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment