An Attribute that stores an numeric error code and string error message. More...
Inherits NobleConnect.Stun.Attribute.
Public Member Functions | |
AttributeErrorCode (AttributeType attributeType, ushort errorCode, string errorMessage) | |
Construct an AttributeErrorCode of the provided AttributeType using the provided error code and message More... | |
AttributeErrorCode (AttributeType type, byte[] buffer, ref int offset) | |
Construct an AttributeErrorCode from the provided byte array 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... | |
![]() | |
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 | errorCode |
The numeric error code. More... | |
readonly string | errorMessage |
A human readable error message More... | |
![]() | |
readonly AttributeType | attributeType |
The AttributeType of this Attribute More... | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
const int | HEADER_SIZE = 4 |
An Attribute that stores an numeric error code and string error message.
The error code is weirdly encoded as described below but you don't really need to know about that to use this class. Once the errorCode is decoded it is a 3 digit number between 300 and 699.
See RFC 5389 Section 15.6 for details on specific error codes.
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved, should be 0 |Class| Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reason Phrase(variable) .. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The class of the error code (the hundreds digit) is encoded separately from the rest of the code, as shown in the diagram. The Reserved bits are ignored and are for 32bit alignment The Class represents the hundreds digit of the error code. The value is be between 3 and 6. The Number represents the error code modulo 100, and its value is be between 0 and 99.
NobleConnect.Stun.AttributeErrorCode.AttributeErrorCode | ( | AttributeType | attributeType, |
ushort | errorCode, | ||
string | errorMessage | ||
) |
Construct an AttributeErrorCode of the provided AttributeType using the provided error code and message
This is called when constructing an Attribute to send to a Stun server.
attributeType | |
errorCode | |
errorMessage |
NobleConnect.Stun.AttributeErrorCode.AttributeErrorCode | ( | AttributeType | type, |
byte[] | buffer, | ||
ref int | offset | ||
) |
Construct an AttributeErrorCode from the provided byte array
This is called when deserializing an AttributeErrorCode received from a Stun server.
type | |
buffer | |
offset |
|
virtual |
Get the serialized size of the attribute values
Reimplemented from NobleConnect.Stun.Attribute.
|
virtual |
Transform the string into an ArraySegment of bytes to be sent over the network.
Uses UTF8 encoding
Reimplemented from NobleConnect.Stun.Attribute.
readonly ushort NobleConnect.Stun.AttributeErrorCode.errorCode |
The numeric error code.
See RFC 5389 Section 15.6 for details on specific error codes.
readonly string NobleConnect.Stun.AttributeErrorCode.errorMessage |
A human readable error message