NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sip.header
Class Via

java.lang.Object
  extended by gov.nist.core.GenericObject
      extended by gov.nist.javax.sip.header.SIPObject
          extended by gov.nist.javax.sip.header.SIPHeader
              extended by gov.nist.javax.sip.header.ParametersHeader
                  extended by gov.nist.javax.sip.header.Via
All Implemented Interfaces:
HeaderExt, SIPHeaderNames, ViaHeaderExt, Serializable, Cloneable, Header, Parameters, ViaHeader

public class Via
extends ParametersHeader
implements ViaHeader, ViaHeaderExt

Via SIPHeader (these are strung together in a ViaList).

Version:
1.2 $Revision: 1.16 $ $Date: 2009/07/17 18:57:40 $
Author:
M. Ranganathan
See Also:
ViaList, Serialized Form

Field Summary
static String BRANCH
          The branch parameter is included by every forking proxy.
static String MADDR
          The "maddr" paramter is designating the multicast address.
static String RECEIVED
          The "received" parameter is added only for receiver-added Via Fields.
static String RPORT
          The RPORT parameter.
static String TTL
          The "TTL" parameter is designating the time-to-live value.
 
Fields inherited from interface javax.sip.header.ViaHeader
NAME
 
Fields inherited from interface gov.nist.javax.sip.header.SIPHeaderNames
ACCEPT, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ALERT_INFO, ALLOW, ALLOW_EVENTS, AUTHENTICATION_INFO, AUTHORIZATION, CALL_ID, CALL_INFO, CONTACT, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_TYPE, CSEQ, DATE, ERROR_INFO, EVENT, EXPIRES, FROM, IN_REPLY_TO, JOIN, MAX_FORWARDS, MIME_VERSION, MIN_EXPIRES, MIN_SE, ORGANIZATION, PRIORITY, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, PROXY_REQUIRE, RACK, REASON, RECORD_ROUTE, REFERRED_BY, REPLACES, REPLY_TO, REQUIRE, RETRY_AFTER, ROUTE, RSEQ, SERVER, SESSION_EXPIRES, SIP_ETAG, SIP_IF_MATCH, SUBJECT, SUBSCRIPTION_STATE, SUPPORTED, TIMESTAMP, TO, UNSUPPORTED, USER_AGENT, VIA, WARNING, WWW_AUTHENTICATE
 
Constructor Summary
Via()
          Default constructor
 
Method Summary
 Object clone()
          Clones this object.
 boolean equals(Object other)
          An introspection based equality predicate for SIPObjects.
 String getBranch()
          Gets the branch paramater of the ViaHeader.
 String getComment()
          Deprecated. RFC 2543 support feature.
 Hop getHop()
          Get the host, port and transport as a Hop.
 String getHost()
          Returns the host part of this ViaHeader.
 String getMAddr()
          Returns the value of the maddr parameter, or null if this is not set.
 int getPort()
          Returns the port part of this ViaHeader.
 String getProtocol()
          Returns the value of the protocol used.
 String getProtocolVersion()
          get the Protocol Version
 String getReceived()
          Gets the received paramater of the ViaHeader.
 int getRPort()
          Return the rport parameter.
 gov.nist.core.HostPort getSentBy()
          Accessor for the sentBy field
 String getSentByField()
          Returns hostname:port as a string equivalent to the "sent-by" field
 Protocol getSentProtocol()
          Accessor for the sentProtocol field.
 String getSentProtocolField()
          Returns transport to the "sent-protocol" field
 String getTransport()
          Returns the value of the transport parameter.
 int getTTL()
          Returns the value of the ttl parameter, or -1 if this is not set.
 gov.nist.core.NameValueList getViaParms()
          Accessor for the parameters field
 boolean hasComment()
          comment of the Via Header.
 boolean hasPort()
          port of the Via Header.
 void removeComment()
          remove the comment field.
 void removePort()
          remove the port.
 void setBranch(String branch)
          Sets the branch parameter of the ViaHeader to the newly supplied branch value.
 void setComment(String c)
          Deprecated. This is an RFC 2543 feature.
 void setHost(gov.nist.core.Host host)
          set the Host of the Via Header
 void setHost(String host)
          Set the host part of this ViaHeader to the newly supplied host parameter.
 void setMAddr(String mAddr)
          Sets the value of the maddr parameter of this ViaHeader.
 void setPort(int port)
          Set the port part of this ViaHeader to the newly supplied port parameter.
 void setProtocol(String protocol)
          Sets the value of the protocol parameter.
 void setProtocolVersion(String protocolVersion)
          set the Protocol Version
 void setReceived(String received)
          Sets the received parameter of ViaHeader.
 void setRPort()
          Set the RPort flag parameter
 void setSentBy(gov.nist.core.HostPort s)
          Set the sentBy member
 void setSentProtocol(Protocol s)
          Set the sentProtocol member
 void setTransport(String transport)
          Sets the value of the transport.
 void setTTL(int ttl)
          Sets the value of the ttl parameter.
 
Methods inherited from class gov.nist.javax.sip.header.ParametersHeader
getNameValue, getParameter, getParameterNames, getParameters, getParameterValue, hasParameter, hasParameters, removeParameter, removeParameters, setParameter, setParameter, setParameters, setQuotedParameter
 
Methods inherited from class gov.nist.javax.sip.header.SIPHeader
encode, encode, getHeaderName, getHeaderValue, getName, getValue, hashCode, isHeaderList, setHeaderName, toString
 
Methods inherited from class gov.nist.javax.sip.header.SIPObject
dbgPrint, debugDump, debugDump, match
 
Methods inherited from class gov.nist.core.GenericObject
getClassFromName, getMatcher, isMySubclass, makeClone, merge, setMatcher
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sip.header.Parameters
getParameter, getParameterNames, removeParameter, setParameter
 
Methods inherited from interface javax.sip.header.Header
getName, hashCode, toString
 

Field Detail

BRANCH

public static final String BRANCH
The branch parameter is included by every forking proxy.

See Also:
Constant Field Values

RECEIVED

public static final String RECEIVED
The "received" parameter is added only for receiver-added Via Fields.

See Also:
Constant Field Values

MADDR

public static final String MADDR
The "maddr" paramter is designating the multicast address.

See Also:
Constant Field Values

TTL

public static final String TTL
The "TTL" parameter is designating the time-to-live value.

See Also:
Constant Field Values

RPORT

public static final String RPORT
The RPORT parameter.

See Also:
Constant Field Values
Constructor Detail

Via

public Via()
Default constructor

Method Detail

equals

public boolean equals(Object other)
Description copied from class: SIPObject
An introspection based equality predicate for SIPObjects.

Specified by:
equals in interface Header
Specified by:
equals in interface ViaHeader
Overrides:
equals in class SIPObject
Parameters:
other - the other object to test against.
Returns:
true if the objects are euqal and false otherwise

getProtocolVersion

public String getProtocolVersion()
get the Protocol Version

Returns:
String

getSentProtocol

public Protocol getSentProtocol()
Accessor for the sentProtocol field.

Returns:
Protocol field

getSentBy

public gov.nist.core.HostPort getSentBy()
Accessor for the sentBy field

Returns:
SentBy field

getHop

public Hop getHop()
Get the host, port and transport as a Hop. This is useful for the stack to avoid duplication of code.


getViaParms

public gov.nist.core.NameValueList getViaParms()
Accessor for the parameters field

Returns:
parameters field

getComment

public String getComment()
Deprecated. RFC 2543 support feature.

Accessor for the comment field.

Returns:
comment field.

hasPort

public boolean hasPort()
port of the Via Header.

Returns:
true if Port exists.

hasComment

public boolean hasComment()
comment of the Via Header.

Returns:
false if comment does not exist and true otherwise.

removePort

public void removePort()
remove the port.


removeComment

public void removeComment()
remove the comment field.


setProtocolVersion

public void setProtocolVersion(String protocolVersion)
set the Protocol Version

Parameters:
protocolVersion - String to set

setHost

public void setHost(gov.nist.core.Host host)
set the Host of the Via Header

Parameters:
host - String to set

setSentProtocol

public void setSentProtocol(Protocol s)
Set the sentProtocol member

Parameters:
s - Protocol to set.

setSentBy

public void setSentBy(gov.nist.core.HostPort s)
Set the sentBy member

Parameters:
s - HostPort to set.

setComment

public void setComment(String c)
Deprecated. This is an RFC 2543 feature.

Set the comment member

Parameters:
c - String to set.

setHost

public void setHost(String host)
             throws ParseException
Set the host part of this ViaHeader to the newly supplied host parameter.

Specified by:
setHost in interface ViaHeader
Parameters:
host - - the new value of the host of this ViaHeader
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the host value.

getHost

public String getHost()
Returns the host part of this ViaHeader.

Specified by:
getHost in interface ViaHeader
Returns:
the string value of the host

setPort

public void setPort(int port)
             throws InvalidArgumentException
Set the port part of this ViaHeader to the newly supplied port parameter.

Specified by:
setPort in interface ViaHeader
Parameters:
port - - the new integer value of the port of this ViaHeader
Throws:
InvalidArgumentException - when the port value is not -1 and <1 or >65535

setRPort

public void setRPort()
Set the RPort flag parameter

Specified by:
setRPort in interface ViaHeader

getPort

public int getPort()
Returns the port part of this ViaHeader.

Specified by:
getPort in interface ViaHeader
Returns:
the integer value of the port

getRPort

public int getRPort()
Return the rport parameter.

Specified by:
getRPort in interface ViaHeader
Returns:
the rport parameter or -1.

getTransport

public String getTransport()
Returns the value of the transport parameter.

Specified by:
getTransport in interface ViaHeader
Returns:
the string value of the transport paramter of the ViaHeader

setTransport

public void setTransport(String transport)
                  throws ParseException
Sets the value of the transport. This parameter specifies which transport protocol to use for sending requests and responses to this entity. The following values are defined: "udp", "tcp", "sctp", "tls", but other values may be used also.

Specified by:
setTransport in interface ViaHeader
Parameters:
transport - - new value for the transport parameter
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the transport value.

getProtocol

public String getProtocol()
Returns the value of the protocol used.

Specified by:
getProtocol in interface ViaHeader
Returns:
the string value of the protocol paramter of the ViaHeader

setProtocol

public void setProtocol(String protocol)
                 throws ParseException
Sets the value of the protocol parameter. This parameter specifies which protocol is used, for example "SIP/2.0".

Specified by:
setProtocol in interface ViaHeader
Parameters:
protocol - - new value for the protocol parameter
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the protocol value.

getTTL

public int getTTL()
Returns the value of the ttl parameter, or -1 if this is not set.

Specified by:
getTTL in interface ViaHeader
Returns:
the integer value of the ttl parameter

setTTL

public void setTTL(int ttl)
            throws InvalidArgumentException
Sets the value of the ttl parameter. The ttl parameter specifies the time-to-live value when packets are sent using UDP multicast.

Specified by:
setTTL in interface ViaHeader
Parameters:
ttl - - new value of the ttl parameter
Throws:
InvalidArgumentException - if supplied value is less than zero or greater than 255, excluding -1 the default not set value.

getMAddr

public String getMAddr()
Returns the value of the maddr parameter, or null if this is not set.

Specified by:
getMAddr in interface ViaHeader
Returns:
the string value of the maddr parameter

setMAddr

public void setMAddr(String mAddr)
              throws ParseException
Sets the value of the maddr parameter of this ViaHeader. The maddr parameter indicates the server address to be contacted for this user, overriding any address derived from the host field.

Specified by:
setMAddr in interface ViaHeader
Parameters:
mAddr - new value of the maddr parameter
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the mAddr value.

getReceived

public String getReceived()
Gets the received paramater of the ViaHeader. Returns null if received does not exist.

Specified by:
getReceived in interface ViaHeader
Returns:
the string received value of ViaHeader

setReceived

public void setReceived(String received)
                 throws ParseException
Sets the received parameter of ViaHeader.

Specified by:
setReceived in interface ViaHeader
Parameters:
received - - the newly supplied received parameter.
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the received value.

getBranch

public String getBranch()
Gets the branch paramater of the ViaHeader. Returns null if branch does not exist.

Specified by:
getBranch in interface ViaHeader
Returns:
the string branch value of ViaHeader

setBranch

public void setBranch(String branch)
               throws ParseException
Sets the branch parameter of the ViaHeader to the newly supplied branch value.

Specified by:
setBranch in interface ViaHeader
Parameters:
branch - - the new string branch parmameter of the ViaHeader.
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the branch value.

clone

public Object clone()
Description copied from class: gov.nist.core.GenericObject
Clones this object.

Specified by:
clone in interface Header
Overrides:
clone in class ParametersHeader
Returns:
a deep copy of Header

getSentByField

public String getSentByField()
Description copied from interface: ViaHeaderExt
Returns hostname:port as a string equivalent to the "sent-by" field

Specified by:
getSentByField in interface ViaHeaderExt
Returns:
"sent-by" field

getSentProtocolField

public String getSentProtocolField()
Description copied from interface: ViaHeaderExt
Returns transport to the "sent-protocol" field

Specified by:
getSentProtocolField in interface ViaHeaderExt
Returns:
"sent-protocol" field

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.