JSIP API v1.2
November 2006

javax.sip.header
Interface MaxForwardsHeader

All Superinterfaces:
java.lang.Cloneable, Header, java.io.Serializable

public interface MaxForwardsHeader
extends Header

The Max-Forwards header field must be used with any SIP method to limit the number of proxies or gateways that can forward the request to the next downstream server. This can also be useful when the client is attempting to trace a request chain that appears to be failing or looping in mid-chain.

The Max-Forwards value is an integer in the range 0-255 indicating the remaining number of times this request message is allowed to be forwarded. This count is decremented by each server that forwards the request. The recommended initial value is 70.

This header field should be inserted by elements that can not otherwise guarantee loop detection. For example, a B2BUA should insert a Max-Forwards header field.

For Example:
Max-Forwards: 6

Author:
BEA Systems, NIST

Field Summary
static java.lang.String NAME
          Name of MaxForwardsHeader
 
Method Summary
 void decrementMaxForwards()
          This convenience function decrements the number of max-forwards by one.
 boolean equals(java.lang.Object obj)
          Compare this MaxForwardsHeader for equality with another.
 int getMaxForwards()
          Gets the maximum number of forwards value of this MaxForwardsHeader.
 void setMaxForwards(int maxForwards)
          Sets the max-forwards argument of this MaxForwardsHeader to the supplied maxForwards value.
 
Methods inherited from interface javax.sip.header.Header
clone, getName, hashCode, toString
 

Field Detail

NAME

static final java.lang.String NAME
Name of MaxForwardsHeader

See Also:
Constant Field Values
Method Detail

decrementMaxForwards

void decrementMaxForwards()
                          throws TooManyHopsException
This convenience function decrements the number of max-forwards by one. This utility is useful for proxy functionality.

Throws:
TooManyHopsException - if implementation cannot decrement max-fowards i.e. max-forwards has reached zero

getMaxForwards

int getMaxForwards()
Gets the maximum number of forwards value of this MaxForwardsHeader.

Returns:
the maximum number of forwards of this MaxForwardsHeader

setMaxForwards

void setMaxForwards(int maxForwards)
                    throws InvalidArgumentException
Sets the max-forwards argument of this MaxForwardsHeader to the supplied maxForwards value.

Parameters:
maxForwards - - the number of max-forwards
Throws:
InvalidArgumentException - if the maxForwards argument is less than 0 or greater than 255.

equals

boolean equals(java.lang.Object obj)
Compare this MaxForwardsHeader for equality with another. This method overrides the equals method in javax.sip.Header. This method specifies object equality as outlined by RFC3261. Two MaxForwards header fields are equivalent if their max forwards integer match.

Specified by:
equals in interface Header
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this MaxForwardsHeader with.
Returns:
true if obj is an instance of this class representing the same MaxForwardsHeader as this, false otherwise.
Since:
v1.2

JSIP API v1.2
November 2006

If you have any comments, please mail them to JAIN-SIP-INTEREST@java.sun.com after subscribing at http://archives.java.sun.com
Copyright - 2006 BEA Systems and Sun Microsystems