0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-12 13:01:07 +01:00

ircd::net::dns: Consolidate cache interfaces in public header; weak unresolved for now.

This commit is contained in:
Jason Volk 2020-03-07 12:37:55 -08:00
parent bfeceea645
commit 4935015b18
6 changed files with 21 additions and 28 deletions

View file

@ -97,25 +97,6 @@ struct ircd::net::dns::opts
opts() = default;
};
/// (internal) DNS cache
namespace ircd::net::dns::cache
{
using closure = std::function<bool (const string_view &, const json::object &)>;
extern conf::item<seconds> min_ttl;
extern conf::item<seconds> error_ttl;
extern conf::item<seconds> nxdomain_ttl;
string_view make_type(const mutable_buffer &out, const string_view &);
string_view make_type(const mutable_buffer &out, const uint16_t &);
bool for_each(const string_view &type, const closure &); // do not make_type() here
bool for_each(const hostport &, const opts &, const closure &);
bool get(const hostport &, const opts &, const callback &);
bool put(const hostport &, const opts &, const records &);
bool put(const hostport &, const opts &, const uint &code, const string_view &msg = {});
}
/// (internal)
struct ircd::net::dns::init
{

View file

@ -8,11 +8,26 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
//
// This file is not included in any include group. It is used when
// implementing the dns::cache by modules and extensions.
//
/// (internal) DNS cache
namespace ircd::net::dns::cache
{
using closure = std::function<bool (const string_view &, const json::object &)>;
extern conf::item<seconds> min_ttl;
extern conf::item<seconds> error_ttl;
extern conf::item<seconds> nxdomain_ttl;
string_view make_type(const mutable_buffer &out, const string_view &);
string_view make_type(const mutable_buffer &out, const uint16_t &);
bool for_each(const string_view &type, const closure &); // do not make_type() here
bool for_each(const hostport &, const opts &, const closure &);
bool get(const hostport &, const opts &, const callback &);
bool put(const hostport &, const opts &, const records &);
bool put(const hostport &, const opts &, const uint &code, const string_view &msg = {});
}
/// (internal) DNS cache
namespace ircd::net::dns::cache
{
struct waiter;
@ -25,6 +40,7 @@ namespace ircd::net::dns::cache
extern ctx::dock dock;
}
/// DNS cache result waiter
struct ircd::net::dns::cache::waiter
{
dns::callback callback;

View file

@ -38,6 +38,7 @@ namespace ircd::net
#include "ipaddr.h"
#include "ipport.h"
#include "dns.h"
#include "dns_cache.h"
#include "listener.h"
#include "listener_udp.h"
#include "sock_opts.h"

View file

@ -9,7 +9,6 @@
// full license for this software is available in the LICENSE file.
#include <RB_INC_NETDB_H
#include <ircd/net/dns_cache.h>
namespace ircd::net::dns
{

View file

@ -8,8 +8,6 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#include <ircd/net/dns_cache.h>
decltype(ircd::net::dns::cache::min_ttl)
ircd::net::dns::cache::min_ttl
{

View file

@ -8,8 +8,6 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#include <ircd/net/dns_cache.h>
namespace ircd::net::dns::cache
{
static bool call_waiter(const string_view &, const string_view &, const json::array &, waiter &);