Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ResourceAddressRecord.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Net;
8
10{
14 public abstract class ResourceAddressRecord : ResourceRecord
15 {
16 private IPAddress address;
17
22 : base()
23 {
24 this.address = null;
25 }
26
35 public ResourceAddressRecord(string Name, TYPE Type, CLASS Class, uint Ttl, Stream Data)
36 : base(Name, Type, Class, Ttl)
37 {
38 int c = this.AddressSize;
39 byte[] Bin = new byte[c];
40 Data.ReadAll(Bin, 0, c);
41
42 this.address = new IPAddress(Bin);
43 }
44
48 protected abstract int AddressSize
49 {
50 get;
51 }
52
56 [IgnoreMember]
57 public IPAddress Address
58 {
59 get => this.address;
60 set => this.address = value;
61 }
62
66 [DefaultValueNull]
67 public byte[] AddressBytes
68 {
69 get => this.address?.GetAddressBytes();
70 set => this.address = value is null ? null : new IPAddress(value);
71 }
72
74 public override string ToString()
75 {
76 return base.ToString() + "\t" + this.address?.ToString();
77 }
78 }
79}
Abstract base class for Resource Address Records.
ResourceAddressRecord()
Abstract base class for Resource Address Records.
ResourceAddressRecord(string Name, TYPE Type, CLASS Class, uint Ttl, Stream Data)
Abstract base class for Resource Address Records.
Abstract base class for a resource record.
CLASS
TYPE fields are used in resource records.
Definition: CLASS.cs:11
TYPE
TYPE fields are used in resource records.
Definition: TYPE.cs:11