-
- All Implemented Interfaces:
public class ChangeRequestAttribute extends Attribute
This class represents the STUN CHANGE-REQUEST attribute. The CHANGE-REQUEST attribute is used by the client to request that the server use a different address and/or port when sending the response. The attribute is 32 bits long, although only two bits (A and B) are used:
The meaning of the flags is: A: This is the "change IP" flag. If true, it requests the server to send the Binding Response with a different IP address than the one the Binding Request was received on. B: This is the "change port" flag. If true, it requests the server to send the Binding Response with a different port than the one the Binding Request was received on.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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A B 0| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringNAMEprivate booleanchangeIpFlagprivate booleanchangePortFlagpublic final static charDATA_LENGTH
-
Method Summary
Modifier and Type Method Description booleangetChangeIpFlag()Returns the value of the changeIpFlag. voidsetChangeIpFlag(boolean changeIP)Sets the value of the changeIpFlag. booleangetChangePortFlag()Returns the value of the changePortFlag. voidsetChangePortFlag(boolean changePort)Sets the value of the changePortFlag. StringgetName()Returns the human readable name of this attribute. booleanequals(Object obj)Compares two STUN Attributes. chargetDataLength()Returns the length of this attribute's body. Array<byte>encode()Returns a binary representation of this attribute. -
-
Method Detail
-
getChangeIpFlag
boolean getChangeIpFlag()
Returns the value of the changeIpFlag. The "change IP" flag, if true, requests the server to send the Binding Response with a different IP address than the one the Binding Request was received on.
-
setChangeIpFlag
void setChangeIpFlag(boolean changeIP)
Sets the value of the changeIpFlag. The "change IP" flag, if true, requests the server to send the Binding Response with a different IP address than the one the Binding Request was received on.
- Parameters:
changeIP- the new value of the changeIpFlag.
-
getChangePortFlag
boolean getChangePortFlag()
Returns the value of the changePortFlag. The "change port" flag. If true, requests the server to send the Binding Response with a different port than the one the Binding Request was received on.
-
setChangePortFlag
void setChangePortFlag(boolean changePort)
Sets the value of the changePortFlag. The "change port" flag. If true, requests the server to send the Binding Response with a different port than the one the Binding Request was received on.
- Parameters:
changePort- the new value of the changePort flag.
-
getName
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
boolean equals(Object obj)
Compares two STUN Attributes. Attributes are considered equal when their type, length, and all data are the same.
- Parameters:
obj- the object to compare this attribute with.
-
getDataLength
char getDataLength()
Returns the length of this attribute's body.
-
-
-
-