Noble Connect
Add relays and punchthrough to Mirror or UNet
NobleConnect.Stun.AttributeChangeRequest Class Reference

The CHANGE-REQUEST attribute contains two flags to control the IP address and port that the server uses to send the response. More...

Inherits NobleConnect.Stun.Attribute.

Public Member Functions

 AttributeChangeRequest (bool changeIP, bool changePort)
 Construct an AttributeChangeRequest using the provided flags More...
 
override void SerializeValues (BufferView buffer, ReadOnlyByteArray transactionID)
 Transform the string into an ArraySegment of bytes to be sent over the network. 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 bool changeIP
 Used to instruct the server to send the binding response from the alternative IP. More...
 
readonly bool changePort
 Used to instruct the server to send the binding response from the alternative port. 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

The CHANGE-REQUEST attribute contains two flags to control the IP address and port that the server uses to send the response.

These flags are called the "change IP" and "change port" flags. The CHANGE-REQUEST attribute is allowed only in Binding Requests. The "change IP" and "change port" flags are useful for determining the current filtering behavior of a NAT. They instruct the server to send the Binding Responses from the alternate source IP address and/or alternate port.

Constructor & Destructor Documentation

◆ AttributeChangeRequest()

NobleConnect.Stun.AttributeChangeRequest.AttributeChangeRequest ( bool  changeIP,
bool  changePort 
)

Construct an AttributeChangeRequest using the provided flags

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

Parameters
errorCode
errorMessage

Member Function Documentation

◆ GetValueSize()

override ushort NobleConnect.Stun.AttributeChangeRequest.GetValueSize ( )
virtual

Get the serialized size of the attribute values

Returns
Defined to be 4 bytes even though only 2 bits are ever used.

Reimplemented from NobleConnect.Stun.Attribute.

◆ SerializeValues()

override void NobleConnect.Stun.AttributeChangeRequest.SerializeValues ( BufferView  buffer,
ReadOnlyByteArray  transactionID 
)
virtual

Transform the string into an ArraySegment of bytes to be sent over the network.

Uses UTF8 encoding

Reimplemented from NobleConnect.Stun.Attribute.

Member Data Documentation

◆ changeIP

readonly bool NobleConnect.Stun.AttributeChangeRequest.changeIP

Used to instruct the server to send the binding response from the alternative IP.

◆ changePort

readonly bool NobleConnect.Stun.AttributeChangeRequest.changePort

Used to instruct the server to send the binding response from the alternative port.