Class DnsObject
Base class for all DNS objects.
Inherited Members
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.dll
Syntax
public abstract class DnsObject : IWireSerialiser, ICloneable
Remarks
Provides helper methods for IWireSerialiser, cloning and caching.
Properties
| Improve this Doc View SourceCreationTime
When the object was created.
Declaration
public DateTime CreationTime { get; set; }
Property Value
Type | Description |
---|---|
DateTime | Local time. |
Remarks
Cloning does not alter the value.
Methods
| Improve this Doc View SourceClone()
Makes a deep copy of the object.
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
Object | A deep copy of the dns object. |
Remarks
Uses serialisation to make a copy.
Clone<T>()
Makes a deep copy of the object.
Declaration
public T Clone<T>()
where T : DnsObject
Returns
Type | Description |
---|---|
T | A deep copy of the dns object. |
Type Parameters
Name | Description |
---|---|
T | Some type derived from DnsObject. |
Remarks
Use serialisation to make a copy.
Length()
Length in bytes of the object when serialised.
Declaration
public int Length()
Returns
Type | Description |
---|---|
Int32 | Numbers of bytes when serialised. |
Read(WireReader)
Reads the DNS object that is encoded in the wire format.
Declaration
public abstract IWireSerialiser Read(WireReader reader)
Parameters
Type | Name | Description |
---|---|---|
WireReader | reader | The source of the DNS object. |
Returns
Type | Description |
---|---|
IWireSerialiser | The final DNS object. |
Remarks
Reading a ResourceRecord will return a new instance that is type specific unless the GetDataLength() is zero.
Read(Byte[])
Reads the DNS object from a byte array.
Declaration
public IWireSerialiser Read(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The source for the DNS object. |
Returns
Type | Description |
---|---|
IWireSerialiser |
Read(Byte[], Int32, Int32)
Reads the DNS object from a byte array.
Declaration
public IWireSerialiser Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The source for the DNS object. |
Int32 | offset | The offset into the |
Int32 | count | The number of bytes in the |
Returns
Type | Description |
---|---|
IWireSerialiser |
Read(Stream)
Reads the DNS object from a stream.
Declaration
public IWireSerialiser Read(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The source for the DNS object. |
Returns
Type | Description |
---|---|
IWireSerialiser |
ToByteArray()
Writes the DNS object to a byte array.
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
Byte[] | A byte array containing the binary representaton of the DNS object. |
Write(WireWriter)
Writes the DNS object encoded in the wire format.
Declaration
public abstract void Write(WireWriter writer)
Parameters
Type | Name | Description |
---|---|---|
WireWriter | writer | The destination of the DNS object. |
Write(Stream)
Writes the DNS object to a stream.
Declaration
public void Write(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The destination for the DNS object. |