public class AttributeFactory extends Object
Constructor and Description |
---|
AttributeFactory() |
Modifier and Type | Method and Description |
---|---|
static ChangedAddressAttribute |
createChangedAddressAttribute(TransportAddress address)
Creates a changedAddressAttribute of the specified type and with the
specified address and port
|
static ChangeRequestAttribute |
createChangeRequestAttribute()
Creates a ChangeRequestAttribute with "false" values for the changeIP and
changePort flags.
|
static ChangeRequestAttribute |
createChangeRequestAttribute(boolean changeIP,
boolean changePort)
Creates a ChangeRequestAttribute with the specified flag values.
|
static ChannelNumberAttribute |
createChannelNumberAttribute(char channelNumber)
Create a ChannelNumberAttribute.
|
static ConnectionIdAttribute |
createConnectionIdAttribute()
Creates a new ConnectionIdAttribute.
|
static ConnectionIdAttribute |
createConnectionIdAttribute(int connectionIdValue)
Creates a new ConnectionIdAttribute of the specified connectionIdValue
|
static DataAttribute |
createDataAttribute(byte[] data)
Create a DataAtttribute.
|
static DataAttribute |
createDataAttributeWithoutPadding(byte[] data)
Create a DataAtttribute.
|
static DestinationAddressAttribute |
createDestinationAddressAttribute(TransportAddress address)
Creates a DestinationFromAddressAttribute of the specified type and with
the specified address and port
|
static ErrorCodeAttribute |
createErrorCodeAttribute(byte errorClass,
byte errorNumber)
Creates an ErrorCodeAttribute with the specified error class and number
and a default reason phrase.
|
static ErrorCodeAttribute |
createErrorCodeAttribute(byte errorClass,
byte errorNumber,
String reasonPhrase)
Creates an ErrorCodeAttribute with the specified error class, number and
reason phrase.
|
static ErrorCodeAttribute |
createErrorCodeAttribute(char errorCode)
Creates an ErrorCodeAttribute with the specified error code and a default
reason phrase.
|
static ErrorCodeAttribute |
createErrorCodeAttribute(char errorCode,
String reasonPhrase)
Creates an ErrorCodeAttribute with the specified error code and reason
phrase.
|
static EvenPortAttribute |
createEvenPortAttribute(boolean rFlag)
Create a EventAttribute.
|
static FingerprintAttribute |
createFingerprintAttribute()
Creates an empty FingerprintAttribute with a 0 check sum.
|
static IceControlledAttribute |
createIceControlledAttribute(long tieBreaker)
Creates an IceControlledAttribute object with the specified tie-breaker
value
|
static IceControllingAttribute |
createIceControllingAttribute(long tieBreaker)
Creates an IceControllingAttribute with the specified tie-breaker value
|
static LifetimeAttribute |
createLifetimeAttribute(int lifetime)
Create a LifetimeAttribute.
|
static MagicCookieAttribute |
createMagicCookieAttribute()
Creates a MagicCookieAttribute.
|
static MappedAddressAttribute |
createMappedAddressAttribute(TransportAddress address)
Creates a MappedAddressAttribute of the specified type and with the
specified address and port
|
static MessageIntegrityAttribute |
createMessageIntegrityAttribute(String username)
Creates an empty MessageIntegrityAttribute.
|
static NonceAttribute |
createNonceAttribute(byte[] nonce)
Create a NonceAttribute.
|
static PriorityAttribute |
createPriorityAttribute(long priority)
Creates a Priority attribute with the specified priority value
|
static RealmAttribute |
createRealmAttribute(byte[] realm)
Create a RealmAttribute.
|
static ReflectedFromAttribute |
createReflectedFromAttribute(TransportAddress address)
Creates a ReflectedFromAddressAttribute of the specified type and with
the specified address and port
|
static RequestedAddressFamilyAttribute |
createRequestedAddressFamilyAttribute(char family)
Creates a new RequestedAddressFamilyAttribute of the specified family
|
static RequestedTransportAttribute |
createRequestedTransportAttribute(byte protocol)
Create a RequestedTransportAttribute.
|
static ReservationTokenAttribute |
createReservationTokenAttribute(byte[] token)
Create a ReservationTokenAttribute.
|
static ResponseAddressAttribute |
createResponseAddressAttribute(TransportAddress address)
Creates a ResponseFromAddressAttribute of the specified type and with the
specified address and port
|
static SoftwareAttribute |
createSoftwareAttribute(byte[] software)
Create a SoftwareAttribute.
|
static SourceAddressAttribute |
createSourceAddressAttribute(TransportAddress address)
Creates a SourceFromAddressAttribute of the specified type and with the
specified address and port
|
static UnknownAttributesAttribute |
createUnknownAttributesAttribute()
Creates an empty UnknownAttributesAttribute.
|
static UseCandidateAttribute |
createUseCandidateAttribute()
Creates a UseCandidateAttribute
|
static UsernameAttribute |
createUsernameAttribute(byte[] username)
Create a UsernameAttribute.
|
static UsernameAttribute |
createUsernameAttribute(String username)
Creates a new UsernameAttribute instance.
|
static XorMappedAddressAttribute |
createXorMappedAddressAttribute(TransportAddress address,
byte[] tranID)
Creates a XorMappedAddressAttribute for the specified address.
|
static XorPeerAddressAttribute |
createXorPeerAddressAttribute(TransportAddress address,
byte[] tranID)
Creates a XorPeerAddressAttribute of the specified type and with the
specified address and port
|
static XorRelayedAddressAttribute |
createXorRelayedAddressAttribute(TransportAddress address,
byte[] tranID)
Creates a XorRelayedAddressAttribute of the specified type and with the
specified address and port.
|
public static ChangeRequestAttribute createChangeRequestAttribute()
public static ChangeRequestAttribute createChangeRequestAttribute(boolean changeIP, boolean changePort)
changeIP
- the value of the changeIP flag.changePort
- the value of the changePort flag.public static ChangedAddressAttribute createChangedAddressAttribute(TransportAddress address)
address
- the address value of the address attributepublic static ErrorCodeAttribute createErrorCodeAttribute(byte errorClass, byte errorNumber) throws StunException
errorClass
- a valid error class.errorNumber
- a valid error number.StunException
- if the error class or number have invalid values
according to rfc3489.public static ErrorCodeAttribute createErrorCodeAttribute(byte errorClass, byte errorNumber, String reasonPhrase) throws StunException
errorClass
- a valid error class.errorNumber
- a valid error number.reasonPhrase
- a human readable reason phrase. A null reason phrase
would be replaced (if possible) by a default one as defined byte the
rfc3489.StunException
- if the error class or number have invalid values
according to rfc3489.public static ErrorCodeAttribute createErrorCodeAttribute(char errorCode) throws StunException
errorCode
- a valid error code.StunException
- if errorCode is not a valid error code as defined
by rfc3489public static ErrorCodeAttribute createErrorCodeAttribute(char errorCode, String reasonPhrase) throws IllegalArgumentException
errorCode
- a valid error code.reasonPhrase
- a human readable reason phrase. A null reason phrase
would be replaced (if possible) by a default one as defined byte the
rfc3489.IllegalArgumentException
- if errorCode is not a valid error code
as defined by rfc3489public static MappedAddressAttribute createMappedAddressAttribute(TransportAddress address)
address
- the address value of the address attributepublic static ReflectedFromAttribute createReflectedFromAttribute(TransportAddress address)
address
- the address value of the address attributepublic static ResponseAddressAttribute createResponseAddressAttribute(TransportAddress address)
address
- the address value of the address attributepublic static SourceAddressAttribute createSourceAddressAttribute(TransportAddress address)
address
- the address value of the address attributepublic static UnknownAttributesAttribute createUnknownAttributesAttribute()
public static XorRelayedAddressAttribute createXorRelayedAddressAttribute(TransportAddress address, byte[] tranID)
address
- the address value of the address attributetranID
- the ID of the transaction that we will be using for the XOR
mask.public static XorPeerAddressAttribute createXorPeerAddressAttribute(TransportAddress address, byte[] tranID)
address
- the address value of the address attributetranID
- the ID of the transaction that we will be using for the XOR
mask.public static XorMappedAddressAttribute createXorMappedAddressAttribute(TransportAddress address, byte[] tranID)
address
- the address value of the address attributetranID
- the ID of the transaction that we will be using for the XOR
mask.public static UsernameAttribute createUsernameAttribute(byte[] username)
username
- username valuepublic static UsernameAttribute createUsernameAttribute(String username)
username
- the String value of the usernamepublic static MessageIntegrityAttribute createMessageIntegrityAttribute(String username)
username
- the username that we should use to obtain an encryption
key (password) that the Attribute.encode()
method should use when
creating the content of this message.public static FingerprintAttribute createFingerprintAttribute()
public static ChannelNumberAttribute createChannelNumberAttribute(char channelNumber)
channelNumber
- channel numberpublic static RealmAttribute createRealmAttribute(byte[] realm)
realm
- realm valuepublic static NonceAttribute createNonceAttribute(byte[] nonce)
nonce
- nonce valuepublic static SoftwareAttribute createSoftwareAttribute(byte[] software)
software
- software valuepublic static EvenPortAttribute createEvenPortAttribute(boolean rFlag)
rFlag
- R flagpublic static LifetimeAttribute createLifetimeAttribute(int lifetime)
lifetime
- lifetime valuepublic static RequestedTransportAttribute createRequestedTransportAttribute(byte protocol)
protocol
- transport protocol requestedpublic static ReservationTokenAttribute createReservationTokenAttribute(byte[] token)
token
- the tokenpublic static DataAttribute createDataAttribute(byte[] data)
data
- the datapublic static DataAttribute createDataAttributeWithoutPadding(byte[] data)
data
- the datapublic static IceControlledAttribute createIceControlledAttribute(long tieBreaker)
tieBreaker
- the tie-breaker value to be usedpublic static PriorityAttribute createPriorityAttribute(long priority) throws IllegalArgumentException
priority
- the priority valueIllegalArgumentException
- if priority < 0 or priority >
(2^31 - 1)public static UseCandidateAttribute createUseCandidateAttribute()
public static IceControllingAttribute createIceControllingAttribute(long tieBreaker)
tieBreaker
- the tie-breaker value to be usedpublic static MagicCookieAttribute createMagicCookieAttribute()
public static DestinationAddressAttribute createDestinationAddressAttribute(TransportAddress address)
address
- the address value of the address attributepublic static RequestedAddressFamilyAttribute createRequestedAddressFamilyAttribute(char family)
family
- address family value as specified in the RFCpublic static ConnectionIdAttribute createConnectionIdAttribute(int connectionIdValue)
connectionIdValue
- the connection ID value.public static ConnectionIdAttribute createConnectionIdAttribute()
Copyright © 2018. All rights reserved.