public class ErrorCodeAttribute extends Attribute
Modifier and Type | Field and Description |
---|---|
static char |
ADDRESS_FAMILY_NOT_SUPPORTED
Address Family not Supported error code.
|
static char |
ALLOCATION_MISMATCH
Allocation Mismatch error code.
|
static char |
ALLOCATION_QUOTA_REACHED
Allocation Quota reached error code.
|
static char |
BAD_REQUEST
Bad request error code.
|
static char |
CONNECTION_ALREADY_EXISTS
Connection Already Exists error code.
|
static char |
CONNECTION_TIMEOUT_OR_FAILURE
Connection Timeout or Failure error code.
|
private byte |
errorClass
The class represents the hundreds digit of the response code.
|
private byte |
errorNumber
The number represents the response
code modulo 100, and its value MUST be between 0 and 99.
|
static char |
FORBIDDEN
Forbidden error code.
|
static char |
GLOBAL_FAILURE
Global failure error code.
|
static char |
INSUFFICIENT_CAPACITY
Insufficient Capacity error code.
|
static char |
INTEGRITY_CHECK_FAILURE
Integrity check failure error code.
|
static char |
MISSING_USERNAME
Missing username error code.
|
static String |
NAME
Attribute's name.
|
static char |
PEER_ADDRESS_FAMILY_MISMATCH
Peer Address Family Mismatch error code.
|
private byte[] |
reasonPhrase
The reason phrase is meant for user consumption, and can
be anything appropriate for the response code.
|
static char |
ROLE_CONFLICT
Role conflict error code.
|
static char |
SERVER_ERROR
Server error code.
|
static char |
STALE_CREDENTIALS
Stale credentials error code.
|
static char |
STALE_NONCE
Stale Nonce error code.
|
static char |
TRY_ALTERNATE
Try Alternate error code.
|
static char |
UNAUTHORIZED
Unauthorized error code.
|
static char |
UNKNOWN_ATTRIBUTE
Unknown attribute error code.
|
static char |
UNSUPPORTED_TRANSPORT_PROTOCOL
Unsupported Transport Protocol error code.
|
static char |
USE_TLS
Use TLS error code.
|
static char |
WRONG_CREDENTIALS
Wrong Credentials error code.
|
ALTERNATE_SERVER, attributeType, CHANGE_REQUEST, CHANGED_ADDRESS, CHANNEL_NUMBER, CONNECTION_ID, 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_ADDRESS_FAMILY, 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()
Constructs a new ERROR-CODE attribute
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
decodeAttributeBody(byte[] attributeValue,
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 obj)
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()
Returns this error's error class.
|
char |
getErrorCode()
A convenience method that constructs an error code from this Attribute's
class and number.
|
byte |
getErrorNumber()
Returns this attribute's error number.
|
String |
getName()
Returns the human readable name of this attribute.
|
String |
getReasonPhrase()
Returns the reason phrase.
|
void |
setErrorClass(byte errorClass)
Sets this error's error class.
|
void |
setErrorCode(char errorCode)
A convenience method that sets error class and number according to the
specified errorCode.The class represents the hundreds digit of the error
code.
|
void |
setErrorNumber(byte errorNumber)
Sets this attribute's error number.
|
void |
setReasonPhrase(String reasonPhrase)
Set's a reason phrase.
|
getAttributeType, getLocationInMessage, setAttributeType, setLocationInMessage
public static final String NAME
public static final char TRY_ALTERNATE
public static final char BAD_REQUEST
public static final char UNAUTHORIZED
public static final char FORBIDDEN
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 ALLOCATION_MISMATCH
public static final char STALE_NONCE
public static final char ADDRESS_FAMILY_NOT_SUPPORTED
public static final char WRONG_CREDENTIALS
public static final char UNSUPPORTED_TRANSPORT_PROTOCOL
public static final char PEER_ADDRESS_FAMILY_MISMATCH
public static final char CONNECTION_ALREADY_EXISTS
public static final char CONNECTION_TIMEOUT_OR_FAILURE
public static final char ALLOCATION_QUOTA_REACHED
public static final char ROLE_CONFLICT
public static final char SERVER_ERROR
public static final char INSUFFICIENT_CAPACITY
public static final char GLOBAL_FAILURE
private byte errorClass
private byte errorNumber
private byte[] reasonPhrase
public void setErrorCode(char errorCode) throws IllegalArgumentException
errorCode
- the errorCode that this class encapsulates.IllegalArgumentException
- if errorCode is not a valid error code.public char getErrorCode()
public void setErrorNumber(byte errorNumber) throws IllegalArgumentException
errorNumber
- the error number to assign this attribute.IllegalArgumentException
- if errorNumber is not a valid error
number.public byte getErrorNumber()
public void setErrorClass(byte errorClass) throws IllegalArgumentException
errorClass
- this error's error class.IllegalArgumentException
- if errorClass is not a valid error
class.public byte getErrorClass()
public static String getDefaultReasonPhrase(char errorCode)
errorCode
- the code of the error that the reason phrase must
describe.public void setReasonPhrase(String reasonPhrase)
reasonPhrase
- a reason phrase that describes this error.public String getReasonPhrase()
public String getName()
public char getDataLength()
getDataLength
in class Attribute
public byte[] encode()
public boolean equals(Object obj)
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
decodeAttributeBody
in class Attribute
attributeValue
- 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.Copyright © 2018. All rights reserved.