org.littleshoot.stun.stack.message
Class AbstractStunMessage

java.lang.Object
  extended by org.littleshoot.stun.stack.message.AbstractStunMessage
All Implemented Interfaces:
StunMessage, VisitableStunMessage
Direct Known Subclasses:
AbstractStunDataMessage, AllocateErrorResponse, AllocateRequest, AllocateSuccessResponse, BindingErrorResponse, BindingRequest, BindingSuccessResponse, ConnectionStatusIndication, ConnectRequest

public abstract class AbstractStunMessage
extends Object
implements StunMessage

Abstracts out common methods and data of STUN messages.


Constructor Summary
AbstractStunMessage(StunMessageType messageType)
          Creates a new STUN message.
AbstractStunMessage(StunMessageType messageType, Map<StunAttributeType,StunAttribute> attributes)
          Creates a new STUN message.
AbstractStunMessage(org.apache.commons.id.uuid.UUID transactionId, StunMessageType messageType)
          Creates a new STUN message.
AbstractStunMessage(org.apache.commons.id.uuid.UUID transactionId, StunMessageType messageType, Map<StunAttributeType,StunAttribute> attributes)
          Creates a new STUN message.
 
Method Summary
protected static Map<StunAttributeType,StunAttribute> createAttributes(StunAttribute... attributes)
           
protected static Map<StunAttributeType,StunAttribute> createRemoteAddress(InetSocketAddress remoteAddress)
           
 Map<StunAttributeType,StunAttribute> getAttributes()
          Accessor for the message attributes.
 int getBodyLength()
          Accessor for the length of the message body.
 int getTotalLength()
          Accessor for the total length of the message, including headers.
 org.apache.commons.id.uuid.UUID getTransactionId()
          Accessor for the ID of the message's transaction.
 StunMessageType getType()
          Accessor for the type of the message.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.littleshoot.stun.stack.message.VisitableStunMessage
accept
 

Constructor Detail

AbstractStunMessage

public AbstractStunMessage(StunMessageType messageType)
Creates a new STUN message.

Parameters:
messageType - The type of message.

AbstractStunMessage

public AbstractStunMessage(StunMessageType messageType,
                           Map<StunAttributeType,StunAttribute> attributes)
Creates a new STUN message.

Parameters:
attributes - The message attributes.
messageType - The type of the message.

AbstractStunMessage

public AbstractStunMessage(org.apache.commons.id.uuid.UUID transactionId,
                           StunMessageType messageType)
Creates a new STUN message.

Parameters:
transactionId - The transaction ID.
messageType - The type of message.

AbstractStunMessage

public AbstractStunMessage(org.apache.commons.id.uuid.UUID transactionId,
                           StunMessageType messageType,
                           Map<StunAttributeType,StunAttribute> attributes)
Creates a new STUN message.

Parameters:
transactionId - The transaction ID.
attributes - The message attributes.
messageType - The type of the message.
Method Detail

createAttributes

protected static Map<StunAttributeType,StunAttribute> createAttributes(StunAttribute... attributes)

createRemoteAddress

protected static Map<StunAttributeType,StunAttribute> createRemoteAddress(InetSocketAddress remoteAddress)

getTransactionId

public org.apache.commons.id.uuid.UUID getTransactionId()
Description copied from interface: StunMessage
Accessor for the ID of the message's transaction.

Specified by:
getTransactionId in interface StunMessage
Returns:
The transaction ID.

getTotalLength

public int getTotalLength()
Description copied from interface: StunMessage
Accessor for the total length of the message, including headers.

Specified by:
getTotalLength in interface StunMessage
Returns:
The total length of the message.

getAttributes

public Map<StunAttributeType,StunAttribute> getAttributes()
Description copied from interface: StunMessage
Accessor for the message attributes.

Specified by:
getAttributes in interface StunMessage
Returns:
The message attributes Map.

getBodyLength

public int getBodyLength()
Description copied from interface: StunMessage
Accessor for the length of the message body.

Specified by:
getBodyLength in interface StunMessage
Returns:
The length of the message body.

getType

public StunMessageType getType()
Description copied from interface: StunMessage
Accessor for the type of the message.

Specified by:
getType in interface StunMessage
Returns:
The type of the message.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 LittleShoot. All Rights Reserved.