public abstract class StunAttribute extends Object
| Modifier and Type | Field and Description |
|---|---|
static char |
ALTERNATE_SERVER
Alternate server attribute.
|
protected char |
attributeType
The type of the attribute.
|
static char |
CHANGE_REQUEST
Change request attribute.
|
static char |
CHANGED_ADDRESS
Changed address attribute.
|
static char |
CHANNEL_NUMBER
Channel number attribute.
|
static char |
DATA
Data attribute.
|
static char |
DESTINATION_ADDRESS
Destination address attribute.
|
static char |
DONT_FRAGMENT
Don't fragment attribute.
|
static char |
ERROR_CODE
Error code attribute.
|
static char |
EVEN_PORT
Even port attribute.
|
static char |
FINGERPRINT
Fingerprint attribute.
|
static char |
HEADER_LENGTH
The size of an atribute header in bytes = len(TYPE) + len(LENGTH) = 4
|
static char |
ICE_CONTROLLED
ICE controlled attribute.
|
static char |
ICE_CONTROLLING
ICE controlling attribute.
|
static char |
LIFETIME
Lifetime attribute.
|
static char |
MAGIC_COOKIE
Magic cookie attribute.
|
static char |
MAPPED_ADDRESS
Mapped address attribute.
|
static char |
MESSAGE_INTEGRITY
Message integrity attribute.
|
static char |
NONCE
Nonce attribute.
|
static char |
PASSWORD
Password attribute.
|
static char |
PRIORITY
Priority attribute.
|
static char |
REALM
Realm attribute.
|
static char |
REFLECTED_FROM
Reflected from attribute.
|
static char |
REMOTE_ADDRESS
Destination address attribute.
|
static char |
REQUESTED_TRANSPORT
Requested transport attribute.
|
static char |
RESERVATION_TOKEN
Reservation token attribute.
|
static char |
RESPONSE_ADDRESS
Response address attribute.
|
static char |
SOFTWARE
Software attribute.
|
static char |
SOURCE_ADDRESS
Source address attribute.
|
static char |
UNKNOWN_ATTRIBUTES
Unknown attributes attribute.
|
static char |
UNKNOWN_OPTIONAL_ATTRIBUTE
Unknown optional attribute.
|
static char |
USE_CANDIDATE
Use candidate attribute.
|
static char |
USERNAME
Username attribute.
|
static char |
XOR_MAPPED_ADDRESS
XOR Mapped address attribute.
|
static char |
XOR_ONLY
XOR only attribute.
|
static char |
XOR_PEER_ADDRESS
XOR peer address attribute.
|
static char |
XOR_RELAYED_ADDRESS
XOR relayed address attribute.
|
| Modifier | Constructor and Description |
|---|---|
protected |
StunAttribute(char attributeType)
Creates an empty STUN message attribute.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
decodeAttributeBody(byte[] data,
char offset,
char length)
Sets this attribute's fields according to attributeValue array.
|
abstract byte[] |
encode()
Returns a binary representation of this attribute.
|
abstract boolean |
equals(Object other)
Compares two STUN Attributes.
|
char |
getAttributeType()
Returns the attribute's type.
|
abstract char |
getDataLength()
Returns the length of this attribute's body.
|
int |
getLocationInMessage()
For attributes that have arriving in incoming messages, this method
returns their original location in the binary array so that we could
later more easily verify attributes like MESSAGE-INTEGRITY.
|
abstract String |
getName()
Returns the human readable name of this attribute.
|
protected void |
setAttributeType(char type)
Sets the attribute's type.
|
void |
setLocationInMessage(int index)
For attributes that have arriving in incoming messages, this method
stores their original location in the binary array so that we could later
more easily verify attributes like MESSAGE-INTEGRITY.
|
public static final char MAPPED_ADDRESS
public static final char RESPONSE_ADDRESS
public static final char CHANGE_REQUEST
public static final char SOURCE_ADDRESS
public static final char CHANGED_ADDRESS
public static final char USERNAME
public static final char PASSWORD
public static final char MESSAGE_INTEGRITY
public static final char ERROR_CODE
public static final char UNKNOWN_ATTRIBUTES
public static final char REFLECTED_FROM
public static final char REALM
public static final char NONCE
public static final char XOR_MAPPED_ADDRESS
public static final char XOR_ONLY
public static final char SOFTWARE
public static final char ALTERNATE_SERVER
public static final char FINGERPRINT
public static final char UNKNOWN_OPTIONAL_ATTRIBUTE
public static final char CHANNEL_NUMBER
public static final char LIFETIME
public static final char XOR_PEER_ADDRESS
public static final char DATA
public static final char XOR_RELAYED_ADDRESS
public static final char EVEN_PORT
public static final char REQUESTED_TRANSPORT
public static final char DONT_FRAGMENT
public static final char RESERVATION_TOKEN
public static final char MAGIC_COOKIE
public static final char DESTINATION_ADDRESS
public static final char REMOTE_ADDRESS
public static final char PRIORITY
public static final char USE_CANDIDATE
public static final char ICE_CONTROLLED
public static final char ICE_CONTROLLING
protected char attributeType
public static final char HEADER_LENGTH
protected StunAttribute(char attributeType)
attributeType - the type of the attribute.public abstract char getDataLength()
public abstract String getName()
public char getAttributeType()
protected void setAttributeType(char type)
type - the new type of this attributepublic abstract boolean equals(Object other)
public abstract byte[] encode()
public void setLocationInMessage(int index)
index - the original location of this attribute in the datagram we got
off the wirepublic int getLocationInMessage()
StunAttributeprotected abstract void decodeAttributeBody(byte[] data,
char offset,
char length)
throws StunException
data - 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.