Noble Connect
Add relays and punchthrough to Mirror or UNet
NobleConnect.Turn.AttributeChannelNumber Class Reference

An attribute that a channel number for use in channel operation More...

Inherits NobleConnect.Stun.Attribute.

Public Member Functions

 AttributeChannelNumber (AttributeType attributeType, ushort channelNumber)
 Construct an AttributeChannelNumber of the provided AttributeType using the provided ProtocolType More...
 
 AttributeChannelNumber (AttributeType type, byte[] buffer, ref int offset)
 Construct an AttributeChannelNumber from the provided byte array More...
 
override void SerializeValues (BufferView buffer, ReadOnlyByteArray transactionID)
 Serializing values to payload as byte array More...
 
override ushort GetValueSize ()
 Get the serialized size of the attribute values More...
 
- Public Member Functions inherited from NobleConnect.Stun.Attribute
 Attribute (AttributeType type)
 Construct an Attribute of the provided AttributeType More...
 
 Attribute (AttributeType type, ref int offset)
 
void Serialize (BufferView buffer, ReadOnlyByteArray transactionID)
 Convert this attribute to a bunch of bytes and add them to the provided buffer More...
 
ushort GetSize ()
 

Public Attributes

readonly ushort channelNumber = 0
 The transfer protocol More...
 
- Public Attributes inherited from NobleConnect.Stun.Attribute
readonly AttributeType attributeType
 The AttributeType of this Attribute More...
 

Additional Inherited Members

- Static Public Member Functions inherited from NobleConnect.Stun.Attribute
static ushort DeserializeLength (byte[] buffer, ref int offset)
 Read the Attribute length from a byte array. More...
 
static ushort GetNumPaddingBytes (int length)
 Calculate padding based on length More...
 
- Static Public Attributes inherited from NobleConnect.Stun.Attribute
const int HEADER_SIZE = 4
 

Detailed Description

An attribute that a channel number for use in channel operation

The CHANNEL-NUMBER attribute contains the number of the channel.
The value portion of this attribute is 4 bytes long and consists of a 16-bit unsigned integer, followed by a two-octet RFFU (Reserved For Future Use) field, which MUST be set to 0 on transmission and MUST be ignored on reception.

0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Channel Number | RFFU = 0 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Constructor & Destructor Documentation

◆ AttributeChannelNumber() [1/2]

NobleConnect.Turn.AttributeChannelNumber.AttributeChannelNumber ( AttributeType  attributeType,
ushort  channelNumber 
)

Construct an AttributeChannelNumber of the provided AttributeType using the provided ProtocolType

This is called when constructing an Attribute to send to a Stun server.

Parameters
attributeType
protocol

◆ AttributeChannelNumber() [2/2]

NobleConnect.Turn.AttributeChannelNumber.AttributeChannelNumber ( AttributeType  type,
byte[]  buffer,
ref int  offset 
)

Construct an AttributeChannelNumber from the provided byte array

This is called when deserializing an AttributeChannelNumber received from a Stun server.

Parameters
type
buffer
offset

Member Function Documentation

◆ GetValueSize()

override ushort NobleConnect.Turn.AttributeChannelNumber.GetValueSize ( )
virtual

Get the serialized size of the attribute values

Returns
4

Reimplemented from NobleConnect.Stun.Attribute.

◆ SerializeValues()

override void NobleConnect.Turn.AttributeChannelNumber.SerializeValues ( BufferView  buffer,
ReadOnlyByteArray  transactionID 
)
virtual

Serializing values to payload as byte array

Four bytes long. First byte is the encoded protocol. The rest are 0.

Reimplemented from NobleConnect.Stun.Attribute.

Member Data Documentation

◆ channelNumber

readonly ushort NobleConnect.Turn.AttributeChannelNumber.channelNumber = 0

The transfer protocol