NIST SIP Parser and Stack (v1.2) API

javax.sip.header
Interface MaxForwardsHeader

All Superinterfaces:
Cloneable, Header, Serializable
All Known Implementing Classes:
MaxForwards

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

Version:
1.1
Author:
Sun Microsystems

Field Summary
static String NAME
          Name of MaxForwardsHeader
 
Method Summary
 void decrementMaxForwards()
          This convenience function decrements the number of max-forwards by one.
 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, equals, getName, toString
 

Field Detail

NAME

public static final String NAME
Name of MaxForwardsHeader

See Also:
Constant Field Values
Method Detail

decrementMaxForwards

public 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

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

Returns:
the maximum number of forwards of this MaxForwardsHeader

setMaxForwards

public 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.

NIST SIP Parser and Stack (v1.2) API

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