public class ErrorCodeAttribute extends StunAttribute
| Modifier and Type | Field and Description |
|---|---|
static char |
BAD_REQUEST |
static char |
GLOBAL_FAILURE |
static char |
INTEGRITY_CHECK_FAILURE |
static char |
MISSING_USERNAME |
static String |
NAME |
static char |
ROLE_CONFLICT |
static char |
SERVER_ERROR |
static char |
STALE_CREDENTIALS |
static char |
UNAUTHORIZED |
static char |
UNKNOWN_ATTRIBUTE |
static char |
USE_TLS |
ALTERNATE_SERVER, attributeType, CHANGE_REQUEST, CHANGED_ADDRESS, CHANNEL_NUMBER, DATA, DESTINATION_ADDRESS, DONT_FRAGMENT, ERROR_CODE, EVEN_PORT, FINGERPRINT, HEADER_LENGTH, ICE_CONTROLLED, ICE_CONTROLLING, LIFETIME, MAGIC_COOKIE, MAPPED_ADDRESS, MESSAGE_INTEGRITY, NONCE, PASSWORD, PRIORITY, REALM, REFLECTED_FROM, REMOTE_ADDRESS, REQUESTED_TRANSPORT, RESERVATION_TOKEN, RESPONSE_ADDRESS, SOFTWARE, SOURCE_ADDRESS, UNKNOWN_ATTRIBUTES, UNKNOWN_OPTIONAL_ATTRIBUTE, USE_CANDIDATE, USERNAME, XOR_MAPPED_ADDRESS, XOR_ONLY, XOR_PEER_ADDRESS, XOR_RELAYED_ADDRESS| Constructor and Description |
|---|
ErrorCodeAttribute() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decodeAttributeBody(byte[] data,
char offset,
char length)
Sets this attribute's fields according to attributeValue array.
|
byte[] |
encode()
Returns a binary representation of this attribute.
|
boolean |
equals(Object other)
Compares two STUN Attributes.
|
char |
getDataLength()
Returns the length of this attribute's body.
|
static String |
getDefaultReasonPhrase(char errorCode)
Returns a default reason phrase corresponding to the specified error
code, as described by rfc 3489.
|
byte |
getErrorClass() |
char |
getErrorCode()
A convenience method that constructs an error code from this attribute's
class and number.
|
byte |
getErrorNumber() |
String |
getName()
Returns the human readable name of this attribute.
|
byte[] |
getReasonPhrase()
Returns the reason phrase.
|
void |
setErrorClass(byte errorClass)
Sets the class of the error.
|
void |
setErrorCode(char code)
A convenience method that sets error class and number according to the
specified error code.
|
void |
setErrorNumber(byte errorNumber) |
void |
setReasonPhrase(String reason)
Set's a reason phrase.
|
getAttributeType, getLocationInMessage, setAttributeType, setLocationInMessagepublic static final String NAME
public static final char BAD_REQUEST
public static final char UNAUTHORIZED
public static final char UNKNOWN_ATTRIBUTE
public static final char STALE_CREDENTIALS
public static final char INTEGRITY_CHECK_FAILURE
public static final char MISSING_USERNAME
public static final char USE_TLS
public static final char ROLE_CONFLICT
public static final char SERVER_ERROR
public static final char GLOBAL_FAILURE
public byte getErrorClass()
public void setErrorClass(byte errorClass)
throws IllegalArgumentException
errorClass - The error class.IllegalArgumentException - Only error classes between 0 and 99 are valid.public byte getErrorNumber()
public void setErrorNumber(byte errorNumber)
public void setErrorCode(char code)
The class represents the hundreds digit of the error code.
The value MUST be between 1 and 6.
The number represents the response code modulo 100, and its value MUST be
between 0 and 99.
errorCode - the errorCode that this class encapsulates.public char getErrorCode()
public static String getDefaultReasonPhrase(char errorCode)
errorCode - the code of the error that the reason phrase must describe.public void setReasonPhrase(String reason)
reasonPhrase - a reason phrase that describes this error.public byte[] getReasonPhrase()
public char getDataLength()
StunAttributegetDataLength in class StunAttributepublic String getName()
StunAttributegetName in class StunAttributepublic boolean equals(Object other)
StunAttributeequals in class StunAttributeother - the object to compare this attribute with.public byte[] encode()
StunAttributeencode in class StunAttributeprotected void decodeAttributeBody(byte[] data,
char offset,
char length)
throws StunException
StunAttributedecodeAttributeBody in class StunAttributedata - a binary array containing this attribute's field values and
NOT containing the attribute header.offset - the position where attribute values begin (most often offset
is equal to the index of the first byte after length)length - the length of the binary array.StunException - if attrubteValue contains invalid data.Copyright © 2017 TeleStax, Inc.. All Rights Reserved.