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

Represents the Method of a Stun Message as defined in RFC 5389 Section 6 More...

Inherited by NobleConnect.Turn.MessageMethod.

Public Member Functions

 MessageMethod (ushort value)
 Construct a MessageMethod instance with the specified value More...
 
override string ToString ()
 Return a human-readable description of the MessageMethod value More...
 
override bool Equals (object obj)
 Compare two MessageMethod objects using their values More...
 
override int GetHashCode ()
 Calculate a hash for this MessageClass using the value. More...
 

Static Public Member Functions

static ushort ParseMethodValue (byte[] buffer, int bufferIndex)
 
static bool IsValidMethod (ushort value)
 
static implicit operator ushort (MessageMethod m)
 Cast a MessageMethod to a ushort by returning the value More...
 
static bool operator== (MessageMethod a, MessageMethod b)
 Compare two MessageMethods using their values More...
 
static bool operator!= (MessageMethod a, MessageMethod b)
 Compare two MessageMethods using their values More...
 

Public Attributes

readonly ushort value
 The unsigned short value that this MessageMethod represents. More...
 

Static Public Attributes

const ushort BIND = 1
 Value for messages related to binding More...
 
static readonly MessageMethod Bind = new MessageMethod(BIND)
 The Bind MessageMethod is used for Messages related to binding. More...
 

Detailed Description

Represents the Method of a Stun Message as defined in RFC 5389 Section 6

I would have preferred this to be an enum, but it needs to be extendable for Turn and Ice. So instead it is this weird enum-like class that exposes static instances of itself for each different MessageMethod.

Constructor & Destructor Documentation

◆ MessageMethod()

NobleConnect.Stun.MessageMethod.MessageMethod ( ushort  value)

Construct a MessageMethod instance with the specified value

Parameters
value

Member Function Documentation

◆ Equals()

override bool NobleConnect.Stun.MessageMethod.Equals ( object  obj)

Compare two MessageMethod objects using their values

Parameters
a
b
Returns

◆ GetHashCode()

override int NobleConnect.Stun.MessageMethod.GetHashCode ( )

Calculate a hash for this MessageClass using the value.

Returns

◆ IsValidMethod()

static bool NobleConnect.Stun.MessageMethod.IsValidMethod ( ushort  value)
static

◆ operator ushort()

static implicit NobleConnect.Stun.MessageMethod.operator ushort ( MessageMethod  m)
static

Cast a MessageMethod to a ushort by returning the value

Parameters
m

◆ operator!=()

static bool NobleConnect.Stun.MessageMethod.operator!= ( MessageMethod  a,
MessageMethod  b 
)
static

Compare two MessageMethods using their values

Parameters
a
b
Returns

◆ operator==()

static bool NobleConnect.Stun.MessageMethod.operator== ( MessageMethod  a,
MessageMethod  b 
)
static

Compare two MessageMethods using their values

Parameters
a
b
Returns

◆ ParseMethodValue()

static ushort NobleConnect.Stun.MessageMethod.ParseMethodValue ( byte[]  buffer,
int  bufferIndex 
)
static

◆ ToString()

override string NobleConnect.Stun.MessageMethod.ToString ( )

Return a human-readable description of the MessageMethod value

Returns

Member Data Documentation

◆ BIND

const ushort NobleConnect.Stun.MessageMethod.BIND = 1
static

Value for messages related to binding

◆ Bind

readonly MessageMethod NobleConnect.Stun.MessageMethod.Bind = new MessageMethod(BIND)
static

The Bind MessageMethod is used for Messages related to binding.

◆ value

readonly ushort NobleConnect.Stun.MessageMethod.value

The unsigned short value that this MessageMethod represents.