-
- All Implemented Interfaces:
public abstract class AttributeAfter the header are 0 or more attributes. Each attribute is TLV encoded, with a 16 bit type, 16 bit length, and variable value:
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value .... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The following types are defined: STUN attributes: 0x0001: MAPPED-ADDRESS 0x0002: RESPONSE-ADDRESS 0x0003: CHANGE-REQUEST 0x0004: SOURCE-ADDRESS 0x0005: CHANGED-ADDRESS 0x0006: USERNAME 0x0007: PASSWORD 0x0008: MESSAGE-INTEGRITY 0x0009: ERROR-CODE 0x000a: UNKNOWN-ATTRIBUTES 0x000b: REFLECTED-FROM 0x0014: REALM 0x0015: NONCE 0x0020: XOR-MAPPED-ADDRESS 0x8022: SOFTWARE 0x8023: ALTERNATE-SERVER 0x8028: FINGERPRINT TURN attributes: 0x000C: CHANNEL-NUMBER 0x000D: LIFETIME 0x0012: XOR-PEER-ADDRESS 0x0013: DATA 0x0016: XOR-RELAYED-ADDRESS 0x0018: EVEN-PORT 0x0019: REQUESTED-TRANSPORT 0x001A: DONT-FRAGMENT 0x0022: RESERVATION-TOKEN ICE attributes: 0x0024: PRIORITY 0x0025: USE-CANDIDATE 0x8029: ICE-CONTROLLED 0x802A: ICE-CONTROLLING
-
-
Field Summary
Fields Modifier and Type Field Description public final static charMAPPED_ADDRESSpublic final static charRESPONSE_ADDRESSpublic final static charCHANGE_REQUESTpublic final static charSOURCE_ADDRESSpublic final static charCHANGED_ADDRESSpublic final static charUSERNAMEpublic final static charPASSWORDpublic final static charMESSAGE_INTEGRITYpublic final static charERROR_CODEpublic final static charUNKNOWN_ATTRIBUTESpublic final static charREFLECTED_FROMpublic final static charREALMpublic final static charNONCEpublic final static charXOR_MAPPED_ADDRESSpublic final static charXOR_ONLYpublic final static charSOFTWAREpublic final static charALTERNATE_SERVERpublic final static charFINGERPRINTpublic final static charUNKNOWN_OPTIONAL_ATTRIBUTEpublic final static charCHANNEL_NUMBERpublic final static charLIFETIMEpublic final static charXOR_PEER_ADDRESSpublic final static charDATApublic final static charXOR_RELAYED_ADDRESSpublic final static charREQUESTED_ADDRESS_FAMILYpublic final static charEVEN_PORTpublic final static charREQUESTED_TRANSPORTpublic final static charDONT_FRAGMENTpublic final static charRESERVATION_TOKENpublic final static charCONNECTION_IDpublic final static charMAGIC_COOKIEpublic final static charDESTINATION_ADDRESSpublic final static charREMOTE_ADDRESSpublic final static charPRIORITYpublic final static charUSE_CANDIDATEpublic final static charICE_CONTROLLEDpublic final static charICE_CONTROLLINGprotected charattributeTypepublic final static charHEADER_LENGTHprivate intlocationInMessage
-
Method Summary
Modifier and Type Method Description chargetAttributeType()Returns the attribute's type. voidsetAttributeType(char type)Sets the attribute's type. intgetLocationInMessage()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. voidsetLocationInMessage(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. abstract chargetDataLength()Returns the length of this attribute's body. abstract StringgetName()Returns the human readable name of this attribute. abstract booleanequals(Object obj)Compares two STUN Attributes. abstract Array<byte>encode()Returns a binary representation of this attribute. -
-
Method Detail
-
getAttributeType
char getAttributeType()
Returns the attribute's type.
-
setAttributeType
void setAttributeType(char type)
Sets the attribute's type.
- Parameters:
type- the new type of this attribute
-
getLocationInMessage
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.
-
setLocationInMessage
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.
- Parameters:
index- the original location of this attribute in the datagram we got off the wire
-
getDataLength
abstract char getDataLength()
Returns the length of this attribute's body.
-
getName
abstract String getName()
Returns the human readable name of this attribute. Attribute names do not really matter from the protocol point of view. They are only used for debugging and readability.
-
equals
abstract boolean equals(Object obj)
Compares two STUN Attributes. Two attributes are considered equal when they have the same type length and value.
- Parameters:
obj- the object to compare this attribute with.
-
-
-
-