Class Tlv
- Namespace
- NLightning.Common.Types
- Assembly
- NLightning.Common.dll
A TLV (Type-Length-Value) object
public class Tlv : IEquatable<Tlv>
- Inheritance
-
Tlv
- Implements
- Derived
- Inherited Members
Constructors
Tlv(BigSize, BigSize, byte[])
A TLV (Type-Length-Value) object
public Tlv(BigSize type, BigSize length, byte[] value)
Parameters
type
BigSizeA message-specific, 64-bit identifier for the TLV
length
BigSizeThe length of the value
value
byte[]The value
Tlv(BigSize, byte[])
Create a new TLV
public Tlv(BigSize type, byte[] value)
Parameters
Remarks
The length of the value is automatically calculated
Properties
Length
The length of the value
public BigSize Length { get; }
Property Value
Type
The type of the TLV
public BigSize Type { get; }
Property Value
Value
The value
public byte[] Value { get; }
Property Value
- byte[]
Methods
DeserializeAsync(Stream)
Deserialize a TLV from a stream
public static Task<Tlv> DeserializeAsync(Stream stream)
Parameters
stream
StreamThe stream to use
Returns
Exceptions
- SerializationException
Error deserializing TLV or any of it's parts
Equals(Tlv?)
Check if two TLVs are equal
public bool Equals(Tlv? other)
Parameters
other
TlvThe other TLV
Returns
- bool
true if the specified object is equal to the current object; otherwise, false.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
SerializeAsync(Stream)
Serialize the TLV to a stream
public Task SerializeAsync(Stream stream)
Parameters
stream
StreamThe stream to write to
Returns
- Task
A task that represents the asynchronous operation
Exceptions
- SerializationException
Error serializing TLV or any of it's parts