fm.liveswitch.stun.Attribute Class Referenceabstract

A STUN attribute. More...

Public Member Functions

int getLength ()
 Gets the length of the attribute, including header and padding. More...
 
int getPaddingLength (int valueLength)
 Gets the length of the padding. More...
 
abstract int getTypeValue ()
 Gets the type value. More...
 
void writeTo (fm.liveswitch.DataBuffer buffer, int offset)
 Writes the attribute to a data buffer. More...
 
void writeTo (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.IntegerHolder offsetPlus)
 Writes the attribute to a data buffer. More...
 

Static Public Member Functions

static int getAlternateServerType ()
 Gets the ALTERNATE-SERVER type. More...
 
static int getChannelNumberType ()
 Gets the CHANNEL-NUMBER type. More...
 
static int getConnectionIdType ()
 Gets the CONNECTION-ID type. More...
 
static int getControlledType ()
 Gets the CONTROLLED type. More...
 
static int getControllingType ()
 Gets the CONTROLLING type. More...
 
static int getDataType ()
 Gets the DATA type. More...
 
static int getDontFragmentType ()
 Gets the DONT-FRAGMENT type. More...
 
static int getErrorCodeType ()
 Gets the ERROR-CODE type. More...
 
static int getEvenPortType ()
 Gets the EVEN-PORT type. More...
 
static int getFingerprintType ()
 Gets the FINGERPRINT type. More...
 
static int getLifetimeType ()
 Gets the LIFETIME type. More...
 
static int getMappedAddressType ()
 Gets the MAPPED-ADDRESS type. More...
 
static int getMessageIntegrityType ()
 Gets the MESSAGE-INTEGRITY type. More...
 
static int getNonceType ()
 Gets the NONCE type. More...
 
static int getPriorityType ()
 Gets the PRIORITY type. More...
 
static int getRealmType ()
 Gets the REALM type. More...
 
static int getRequestedAddressFamilyType ()
 Gets the REQUESTED-ADDRESS-FAMILY type. More...
 
static int getRequestedTransportType ()
 Gets the REQUESTED-TRANSPORT type. More...
 
static int getReservationTokenType ()
 Gets the RESERVATION-TOKEN type. More...
 
static int getSoftwareType ()
 Gets the SOFTWARE type. More...
 
static int getTransactionTransmitCounterType ()
 Gets the comprehension-optional TRANSACTION_TRANSMIT_COUNTER type defined in RFC 7982. More...
 
static int getUnknownAttributesType ()
 Gets the UNKNOWN-ATTRIBUTES type. More...
 
static int getUseCandidateType ()
 Gets the USE-CANDIDATE type. More...
 
static int getUsernameType ()
 Gets the USERNAME type. More...
 
static int getXorMappedAddressType ()
 Gets the XOR-MAPPED-ADDRESS type. More...
 
static int getXorPeerAddressType ()
 Gets the XOR-PEER-ADDRESS type. More...
 
static int getXorRelayedAddressType ()
 Gets the XOR-RELAYED-ADDRESS type. More...
 
static int nextLength (fm.liveswitch.DataBuffer buffer, int offset)
 Reads the length of the next attribute from a data buffer, including header and padding. More...
 
static fm.liveswitch.stun.Attribute readFrom (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.IntegerHolder offsetPlus, fm.liveswitch.DataBuffer transactionId, fm.liveswitch.DataBuffer messageBuffer)
 Reads an fm.liveswitch.stun.Attribute from a data buffer. More...
 
static fm.liveswitch.stun.Attribute readFrom (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.DataBuffer transactionId, fm.liveswitch.DataBuffer messageBuffer)
 Reads an fm.liveswitch.stun.Attribute from a data buffer. More...
 

Protected Member Functions

 Attribute ()
 
abstract int getValueLength ()
 Gets the length of the attribute value. More...
 
void writeIPAddress (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.AddressType addressType, String ipAddress)
 Writes an IP address. More...
 
void writePort (fm.liveswitch.DataBuffer buffer, int offset, int port)
 Writes a port. More...
 
abstract void writeValueTo (fm.liveswitch.DataBuffer buffer, int offset)
 Writes the attribute value to a data buffer. More...
 
void writeXorIPAddress (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.AddressType addressType, String ipAddress, fm.liveswitch.DataBuffer transactionId)
 Writes an XOR'd IP address. More...
 
void writeXorPort (fm.liveswitch.DataBuffer buffer, int offset, int port, fm.liveswitch.DataBuffer transactionId)
 Writes an XOR'd port. More...
 

Static Protected Member Functions

static fm.liveswitch.AddressType readAddressType (fm.liveswitch.DataBuffer buffer, int offset)
 Reads an address type. More...
 
static String readIPAddress (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.AddressType addressType)
 Reads an IP address. More...
 
static int readPort (fm.liveswitch.DataBuffer buffer, int offset)
 Reads a port. More...
 
static String readXorIPAddress (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.AddressType addressType, fm.liveswitch.DataBuffer transactionId)
 Reads an XOR'd IP address. More...
 
static int readXorPort (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.DataBuffer transactionId)
 Reads an XOR'd port. More...
 
static void writeAddressType (fm.liveswitch.DataBuffer buffer, int offset, fm.liveswitch.AddressType addressType)
 Writes an address type. More...
 

Detailed Description

A STUN attribute.

Constructor & Destructor Documentation

◆ Attribute()

fm.liveswitch.stun.Attribute.Attribute ( )
protected

Member Function Documentation

◆ getAlternateServerType()

static int fm.liveswitch.stun.Attribute.getAlternateServerType ( )
static

Gets the ALTERNATE-SERVER type.

◆ getChannelNumberType()

static int fm.liveswitch.stun.Attribute.getChannelNumberType ( )
static

Gets the CHANNEL-NUMBER type.

◆ getConnectionIdType()

static int fm.liveswitch.stun.Attribute.getConnectionIdType ( )
static

Gets the CONNECTION-ID type.

◆ getControlledType()

static int fm.liveswitch.stun.Attribute.getControlledType ( )
static

Gets the CONTROLLED type.

◆ getControllingType()

static int fm.liveswitch.stun.Attribute.getControllingType ( )
static

Gets the CONTROLLING type.

◆ getDataType()

static int fm.liveswitch.stun.Attribute.getDataType ( )
static

Gets the DATA type.

◆ getDontFragmentType()

static int fm.liveswitch.stun.Attribute.getDontFragmentType ( )
static

Gets the DONT-FRAGMENT type.

◆ getErrorCodeType()

static int fm.liveswitch.stun.Attribute.getErrorCodeType ( )
static

Gets the ERROR-CODE type.

◆ getEvenPortType()

static int fm.liveswitch.stun.Attribute.getEvenPortType ( )
static

Gets the EVEN-PORT type.

◆ getFingerprintType()

static int fm.liveswitch.stun.Attribute.getFingerprintType ( )
static

Gets the FINGERPRINT type.

◆ getLength()

int fm.liveswitch.stun.Attribute.getLength ( )

Gets the length of the attribute, including header and padding.

◆ getLifetimeType()

static int fm.liveswitch.stun.Attribute.getLifetimeType ( )
static

Gets the LIFETIME type.

◆ getMappedAddressType()

static int fm.liveswitch.stun.Attribute.getMappedAddressType ( )
static

Gets the MAPPED-ADDRESS type.

◆ getMessageIntegrityType()

static int fm.liveswitch.stun.Attribute.getMessageIntegrityType ( )
static

Gets the MESSAGE-INTEGRITY type.

◆ getNonceType()

static int fm.liveswitch.stun.Attribute.getNonceType ( )
static

Gets the NONCE type.

◆ getPaddingLength()

int fm.liveswitch.stun.Attribute.getPaddingLength ( int  valueLength)

Gets the length of the padding.

◆ getPriorityType()

static int fm.liveswitch.stun.Attribute.getPriorityType ( )
static

Gets the PRIORITY type.

◆ getRealmType()

static int fm.liveswitch.stun.Attribute.getRealmType ( )
static

Gets the REALM type.

◆ getRequestedAddressFamilyType()

static int fm.liveswitch.stun.Attribute.getRequestedAddressFamilyType ( )
static

Gets the REQUESTED-ADDRESS-FAMILY type.

◆ getRequestedTransportType()

static int fm.liveswitch.stun.Attribute.getRequestedTransportType ( )
static

Gets the REQUESTED-TRANSPORT type.

◆ getReservationTokenType()

static int fm.liveswitch.stun.Attribute.getReservationTokenType ( )
static

Gets the RESERVATION-TOKEN type.

◆ getSoftwareType()

static int fm.liveswitch.stun.Attribute.getSoftwareType ( )
static

Gets the SOFTWARE type.

◆ getTransactionTransmitCounterType()

static int fm.liveswitch.stun.Attribute.getTransactionTransmitCounterType ( )
static

Gets the comprehension-optional TRANSACTION_TRANSMIT_COUNTER type defined in RFC 7982.

◆ getTypeValue()

◆ getUnknownAttributesType()

static int fm.liveswitch.stun.Attribute.getUnknownAttributesType ( )
static

Gets the UNKNOWN-ATTRIBUTES type.

◆ getUseCandidateType()

static int fm.liveswitch.stun.Attribute.getUseCandidateType ( )
static

Gets the USE-CANDIDATE type.

◆ getUsernameType()

static int fm.liveswitch.stun.Attribute.getUsernameType ( )
static

Gets the USERNAME type.

◆ getValueLength()

◆ getXorMappedAddressType()

static int fm.liveswitch.stun.Attribute.getXorMappedAddressType ( )
static

Gets the XOR-MAPPED-ADDRESS type.

◆ getXorPeerAddressType()

static int fm.liveswitch.stun.Attribute.getXorPeerAddressType ( )
static

Gets the XOR-PEER-ADDRESS type.

◆ getXorRelayedAddressType()

static int fm.liveswitch.stun.Attribute.getXorRelayedAddressType ( )
static

Gets the XOR-RELAYED-ADDRESS type.

◆ nextLength()

static int fm.liveswitch.stun.Attribute.nextLength ( fm.liveswitch.DataBuffer  buffer,
int  offset 
)
static

Reads the length of the next attribute from a data buffer, including header and padding.

Parameters
bufferThe buffer.
offsetThe offset.

◆ readAddressType()

static fm.liveswitch.AddressType fm.liveswitch.stun.Attribute.readAddressType ( fm.liveswitch.DataBuffer  buffer,
int  offset 
)
staticprotected

Reads an address type.

Parameters
bufferThe buffer.
offsetThe offset.

◆ readFrom() [1/2]

static fm.liveswitch.stun.Attribute fm.liveswitch.stun.Attribute.readFrom ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.DataBuffer  transactionId,
fm.liveswitch.DataBuffer  messageBuffer 
)
static

Reads an fm.liveswitch.stun.Attribute from a data buffer.

Parameters
bufferThe buffer.
offsetThe offset.
transactionIdThe STUN message transaction ID.
messageBufferThe STUN message thus far as a byte array.

◆ readFrom() [2/2]

static fm.liveswitch.stun.Attribute fm.liveswitch.stun.Attribute.readFrom ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.IntegerHolder  offsetPlus,
fm.liveswitch.DataBuffer  transactionId,
fm.liveswitch.DataBuffer  messageBuffer 
)
static

Reads an fm.liveswitch.stun.Attribute from a data buffer.

Parameters
bufferThe buffer.
offsetThe offset.
offsetPlusThe offset plus the attribute length.
transactionIdThe STUN message transaction ID.
messageBufferThe STUN message thus far as a byte array.

◆ readIPAddress()

static String fm.liveswitch.stun.Attribute.readIPAddress ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.AddressType  addressType 
)
staticprotected

Reads an IP address.

Parameters
bufferThe buffer.
offsetThe offset.
addressTypeThe address type.

◆ readPort()

static int fm.liveswitch.stun.Attribute.readPort ( fm.liveswitch.DataBuffer  buffer,
int  offset 
)
staticprotected

Reads a port.

Parameters
bufferThe buffer.
offsetThe offset.

◆ readXorIPAddress()

static String fm.liveswitch.stun.Attribute.readXorIPAddress ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.AddressType  addressType,
fm.liveswitch.DataBuffer  transactionId 
)
staticprotected

Reads an XOR'd IP address.

Parameters
bufferThe buffer.
offsetThe offset.
addressTypeThe address type.
transactionIdThe transaction identifier.

◆ readXorPort()

static int fm.liveswitch.stun.Attribute.readXorPort ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.DataBuffer  transactionId 
)
staticprotected

Reads an XOR'd port.

Parameters
bufferThe buffer.
offsetThe offset.
transactionIdThe transaction identifier.

◆ writeAddressType()

static void fm.liveswitch.stun.Attribute.writeAddressType ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.AddressType  addressType 
)
staticprotected

Writes an address type.

Parameters
bufferThe buffer.
offsetThe offset.
addressTypeThe address type.

◆ writeIPAddress()

void fm.liveswitch.stun.Attribute.writeIPAddress ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.AddressType  addressType,
String  ipAddress 
)
protected

Writes an IP address.

Parameters
bufferThe buffer.
offsetThe offset.
addressTypeThe address type.
ipAddressThe IP address.

◆ writePort()

void fm.liveswitch.stun.Attribute.writePort ( fm.liveswitch.DataBuffer  buffer,
int  offset,
int  port 
)
protected

Writes a port.

Parameters
bufferThe buffer.
offsetThe offset.
portThe port.

◆ writeTo() [1/2]

void fm.liveswitch.stun.Attribute.writeTo ( fm.liveswitch.DataBuffer  buffer,
int  offset 
)

Writes the attribute to a data buffer.

Parameters
bufferThe buffer.
offsetThe offset.

◆ writeTo() [2/2]

void fm.liveswitch.stun.Attribute.writeTo ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.IntegerHolder  offsetPlus 
)

Writes the attribute to a data buffer.

Parameters
bufferThe buffer.
offsetThe offset.
offsetPlusThe offset plus the value length.

◆ writeValueTo()

◆ writeXorIPAddress()

void fm.liveswitch.stun.Attribute.writeXorIPAddress ( fm.liveswitch.DataBuffer  buffer,
int  offset,
fm.liveswitch.AddressType  addressType,
String  ipAddress,
fm.liveswitch.DataBuffer  transactionId 
)
protected

Writes an XOR'd IP address.

Parameters
bufferThe buffer.
offsetThe offset.
addressTypeThe address type.
ipAddressThe IP address.
transactionIdThe transaction identifier.

◆ writeXorPort()

void fm.liveswitch.stun.Attribute.writeXorPort ( fm.liveswitch.DataBuffer  buffer,
int  offset,
int  port,
fm.liveswitch.DataBuffer  transactionId 
)
protected

Writes an XOR'd port.

Parameters
bufferThe buffer.
offsetThe offset.
portThe port.
transactionIdThe transaction identifier.