/*
Technitium DNS Server
Copyright (C) 2024 Shreyas Zare (shreyas@technitium.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
using System;
using System.Net.Mail;
using System.Threading.Tasks;
using TechnitiumLibrary.Net.Dns;
using TechnitiumLibrary.Net.Proxy;
namespace DnsServerCore.ApplicationCommon
{
///
/// Provides an interface to access the internal DNS Server core.
///
public interface IDnsServer : IDnsClient
{
///
/// Allows querying the DNS server core directly. This call supports recursion even if its not enabled in the DNS server configuration. The request wont be routed to any of the installed DNS Apps except for processing APP records. The request and its response are not counted in any stats or logged.
///
/// The question record containing the details to query.
/// The timeout value in milliseconds to wait for response.
/// The DNS response for the DNS query.
/// When request times out.
Task DirectQueryAsync(DnsQuestionRecord question, int timeout = 4000);
///
/// Allows querying the DNS server core directly. This call supports recursion even if its not enabled in the DNS server configuration. The request wont be routed to any of the installed DNS Apps except for processing APP records. The request and its response are not counted in any stats or logged.
///
/// The DNS request to query.
/// The timeout value in milliseconds to wait for response.
/// The DNS response for the DNS query.
/// When request times out.
Task DirectQueryAsync(DnsDatagram request, int timeout = 4000);
///
/// Writes a log entry to the DNS server log file.
///
/// The message to log.
void WriteLog(string message);
///
/// Writes a log entry to the DNS server log file.
///
/// The exception to log.
void WriteLog(Exception ex);
///
/// The name of this installed application.
///
string ApplicationName { get; }
///
/// The folder where this application is saved on the disk. Can be used to create temp files, read/write files, etc. for this application.
///
string ApplicationFolder { get; }
///
/// The primary domain name used by this DNS Server to identify itself.
///
string ServerDomain { get; }
///
/// The default responsible person email address for this DNS Server.
///
MailAddress ResponsiblePerson { get; }
///
/// The DNS cache object which provides direct access to the DNS server cache.
///
IDnsCache DnsCache { get; }
///
/// The proxy server setting on the DNS server to be used when required to make any outbound network connection.
///
NetProxy Proxy { get; }
///
/// Tells if the DNS server prefers using IPv6 as per the settings.
///
bool PreferIPv6 { get; }
///
/// Returns the UDP payload size configured in the settings.
///
public ushort UdpPayloadSize { get; }
}
}