protected ApexZone(AuthZoneInfo zoneInfo) : base(zoneInfo) { _zoneTransfer = zoneInfo.ZoneTransfer; _zoneTransferNameServers = zoneInfo.ZoneTransferNameServers; _notify = zoneInfo.Notify; _notifyNameServers = zoneInfo.NotifyNameServers; }
protected AuthZone(AuthZoneInfo zoneInfo) : base(zoneInfo.Name) { _disabled = zoneInfo.Disabled; _zoneTransfer = zoneInfo.ZoneTransfer; _zoneTransferNameServers = zoneInfo.ZoneTransferNameServers; _notify = zoneInfo.Notify; _notifyNameServers = zoneInfo.NotifyNameServers; }
internal AuthZoneInfo(ApexZone apexZone, bool loadHistory = false) { _apexZone = apexZone; _name = _apexZone.Name; if (_apexZone is PrimaryZone primaryZone) { _type = AuthZoneType.Primary; if (loadHistory) { _zoneHistory = primaryZone.GetHistory(); } _tsigKeyNames = primaryZone.TsigKeyNames; _dnssecPrivateKeys = primaryZone.DnssecPrivateKeys; _notifyFailed = primaryZone.NotifyFailed; } else if (_apexZone is SecondaryZone secondaryZone) { _type = AuthZoneType.Secondary; if (loadHistory) { _zoneHistory = secondaryZone.GetHistory(); } _expiry = secondaryZone.Expiry; _tsigKeyNames = secondaryZone.TsigKeyNames; _notifyFailed = secondaryZone.NotifyFailed; _syncFailed = secondaryZone.SyncFailed; } else if (_apexZone is StubZone stubZone) { _type = AuthZoneType.Stub; _expiry = stubZone.Expiry; _syncFailed = stubZone.SyncFailed; } else if (_apexZone is ForwarderZone) { _type = AuthZoneType.Forwarder; } else { _type = AuthZoneType.Unknown; } _disabled = _apexZone.Disabled; _zoneTransfer = _apexZone.ZoneTransfer; _zoneTransferNameServers = _apexZone.ZoneTransferNameServers; _notify = _apexZone.Notify; _notifyNameServers = _apexZone.NotifyNameServers; }
public AuthZoneInfo(string name, AuthZoneType type, bool disabled) { _name = name; _type = type; _disabled = disabled; switch (_type) { case AuthZoneType.Primary: _zoneTransfer = AuthZoneTransfer.AllowOnlyZoneNameServers; _notify = AuthZoneNotify.ZoneNameServers; break; default: _zoneTransfer = AuthZoneTransfer.Deny; _notify = AuthZoneNotify.None; break; } }
internal AuthZoneInfo(AuthZone zone) { _zone = zone; _name = _zone.Name; if (_zone is PrimaryZone) { _type = AuthZoneType.Primary; } else if (_zone is SecondaryZone) { _type = AuthZoneType.Secondary; } else if (_zone is StubZone) { _type = AuthZoneType.Stub; } else if (_zone is ForwarderZone) { _type = AuthZoneType.Forwarder; } else { _type = AuthZoneType.Unknown; } _disabled = _zone.Disabled; _zoneTransfer = zone.ZoneTransfer; _zoneTransferNameServers = zone.ZoneTransferNameServers; _notify = zone.Notify; _notifyNameServers = zone.NotifyNameServers; switch (_type) { case AuthZoneType.Secondary: _expiry = (_zone as SecondaryZone).Expiry; break; case AuthZoneType.Stub: _expiry = (_zone as StubZone).Expiry; break; } }
public AuthZoneInfo(BinaryReader bR) { byte version = bR.ReadByte(); switch (version) { case 1: case 2: _name = bR.ReadShortString(); _type = (AuthZoneType)bR.ReadByte(); _disabled = bR.ReadBoolean(); if (version >= 2) { { _zoneTransfer = (AuthZoneTransfer)bR.ReadByte(); int count = bR.ReadByte(); if (count > 0) { IPAddress[] nameServers = new IPAddress[count]; for (int i = 0; i < count; i++) { nameServers[i] = IPAddressExtension.Parse(bR); } _zoneTransferNameServers = nameServers; } } { _notify = (AuthZoneNotify)bR.ReadByte(); int count = bR.ReadByte(); if (count > 0) { IPAddress[] nameServers = new IPAddress[count]; for (int i = 0; i < count; i++) { nameServers[i] = IPAddressExtension.Parse(bR); } _notifyNameServers = nameServers; } } } else { switch (_type) { case AuthZoneType.Primary: _zoneTransfer = AuthZoneTransfer.AllowOnlyZoneNameServers; _notify = AuthZoneNotify.ZoneNameServers; break; default: _zoneTransfer = AuthZoneTransfer.Deny; _notify = AuthZoneNotify.None; break; } } switch (_type) { case AuthZoneType.Secondary: _expiry = bR.ReadDate(); break; case AuthZoneType.Stub: _expiry = bR.ReadDate(); break; } break; default: throw new InvalidDataException("AuthZoneInfo format version not supported."); } }
public AuthZoneInfo(BinaryReader bR) { byte version = bR.ReadByte(); switch (version) { case 1: case 2: case 3: case 4: _name = bR.ReadShortString(); _type = (AuthZoneType)bR.ReadByte(); _disabled = bR.ReadBoolean(); if (version >= 2) { { _zoneTransfer = (AuthZoneTransfer)bR.ReadByte(); int count = bR.ReadByte(); if (count > 0) { IPAddress[] nameServers = new IPAddress[count]; for (int i = 0; i < count; i++) { nameServers[i] = IPAddressExtension.Parse(bR); } _zoneTransferNameServers = nameServers; } } { _notify = (AuthZoneNotify)bR.ReadByte(); int count = bR.ReadByte(); if (count > 0) { IPAddress[] nameServers = new IPAddress[count]; for (int i = 0; i < count; i++) { nameServers[i] = IPAddressExtension.Parse(bR); } _notifyNameServers = nameServers; } } } else { switch (_type) { case AuthZoneType.Primary: _zoneTransfer = AuthZoneTransfer.AllowOnlyZoneNameServers; _notify = AuthZoneNotify.ZoneNameServers; break; default: _zoneTransfer = AuthZoneTransfer.Deny; _notify = AuthZoneNotify.None; break; } } switch (_type) { case AuthZoneType.Primary: if (version >= 3) { int count = bR.ReadInt32(); DnsResourceRecord[] zoneHistory = new DnsResourceRecord[count]; for (int i = 0; i < count; i++) { zoneHistory[i] = new DnsResourceRecord(bR.BaseStream); zoneHistory[i].Tag = new DnsResourceRecordInfo(bR, zoneHistory[i].Type == DnsResourceRecordType.SOA); } _zoneHistory = zoneHistory; } if (version >= 4) { int count = bR.ReadByte(); Dictionary <string, object> tsigKeyNames = new Dictionary <string, object>(count); for (int i = 0; i < count; i++) { tsigKeyNames.Add(bR.ReadShortString(), null); } _tsigKeyNames = tsigKeyNames; } break; case AuthZoneType.Secondary: _expiry = bR.ReadDateTime(); if (version >= 4) { int count = bR.ReadInt32(); DnsResourceRecord[] zoneHistory = new DnsResourceRecord[count]; for (int i = 0; i < count; i++) { zoneHistory[i] = new DnsResourceRecord(bR.BaseStream); zoneHistory[i].Tag = new DnsResourceRecordInfo(bR, zoneHistory[i].Type == DnsResourceRecordType.SOA); } _zoneHistory = zoneHistory; } if (version >= 4) { int count = bR.ReadByte(); Dictionary <string, object> tsigKeyNames = new Dictionary <string, object>(count); for (int i = 0; i < count; i++) { tsigKeyNames.Add(bR.ReadShortString(), null); } _tsigKeyNames = tsigKeyNames; } break; case AuthZoneType.Stub: _expiry = bR.ReadDateTime(); break; } break; default: throw new InvalidDataException("AuthZoneInfo format version not supported."); } }