PrimarySubDomainZone.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Technitium DNS Server
  3. Copyright (C) 2020 Shreyas Zare (shreyas@technitium.com)
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. using System.Collections.Generic;
  16. using TechnitiumLibrary.Net.Dns;
  17. namespace DnsServerCore.Dns.Zones
  18. {
  19. class PrimarySubDomainZone : SubDomainZone
  20. {
  21. #region variables
  22. readonly PrimaryZone _primaryZone;
  23. #endregion
  24. #region constructor
  25. public PrimarySubDomainZone(PrimaryZone primaryZone, string name)
  26. : base(name)
  27. {
  28. _primaryZone = primaryZone;
  29. }
  30. #endregion
  31. #region public
  32. public override void SetRecords(DnsResourceRecordType type, IReadOnlyList<DnsResourceRecord> records)
  33. {
  34. base.SetRecords(type, records);
  35. _primaryZone.IncrementSoaSerial();
  36. _primaryZone.NotifyNameServers();
  37. }
  38. public override void AddRecord(DnsResourceRecord record)
  39. {
  40. base.AddRecord(record);
  41. _primaryZone.IncrementSoaSerial();
  42. _primaryZone.NotifyNameServers();
  43. }
  44. public override bool DeleteRecords(DnsResourceRecordType type)
  45. {
  46. if (base.DeleteRecords(type))
  47. {
  48. _primaryZone.IncrementSoaSerial();
  49. _primaryZone.NotifyNameServers();
  50. return true;
  51. }
  52. return false;
  53. }
  54. public override bool DeleteRecord(DnsResourceRecordType type, DnsResourceRecordData record)
  55. {
  56. if (base.DeleteRecord(type, record))
  57. {
  58. _primaryZone.IncrementSoaSerial();
  59. _primaryZone.NotifyNameServers();
  60. return true;
  61. }
  62. return false;
  63. }
  64. #endregion
  65. }
  66. }