/* Technitium DNS Server Copyright (C) 2021 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; using System.Threading.Tasks; using TechnitiumLibrary.Net.Dns; namespace DnsApplicationCommon { public interface IDnsApplicationRequestHandler : IDisposable { /// /// Allows initializing the DNS application with a config. This function is also called when the config is updated to allow reloading. /// /// The DNS server interface object that allows access to DNS server properties. /// The DNS application config stored in the dnsApp.config file. Task InitializeAsync(IDnsServer dnsServer, string config); /// /// This method is called by the DNS Server to process the DNS application request when an APP record in an Application zone is hit. /// /// The DNS request object to be processed. /// The end point (IP address and port) of the client making the request. /// The name of the application zone that the APP record belongs to. /// The TTL value set in the APP record. /// The record data in the APP record as required for processing the request. /// Tells if the DNS server is configured to allow recursion for the client making this request. /// The DNS server object that allows access to the DNS server properties. /// The DNS response for the DNS request or null to send no answer response with an SOA authority. Task ProcessRequestAsync(DnsDatagram request, IPEndPoint remoteEP, string zoneName, uint appRecordTtl, string appRecordData, bool isRecursionAllowed, IDnsServer dnsServer); /// /// The description about this app to be shown in the Apps section of the DNS web console. /// string Description { get; } /// /// A template of the record data format that is required by this app. This template is populated in the UI to allow the user to edit in the expected values. The format could be JSON or any other custom text based format which the app is programmed to parse. This property is optional and can return null if no APP record data is required by the app. /// string ApplicationRecordDataTemplate { get; } } }