jain.protocol.ip.sip.header
Class MaxForwardsHeader

java.lang.Object
  |
  +--jain.protocol.ip.sip.header.Header
        |
        +--jain.protocol.ip.sip.header.RequestHeader
              |
              +--jain.protocol.ip.sip.header.MaxForwardsHeader

public final class MaxForwardsHeader
extends RequestHeader

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

The MaxForwards value is an integer indicating the remaining number of times this RequestMessage is allowed to be forwarded. Each proxy or gateway recipient of a RequestMessage containing a MaxForwardsHeader must check and update its value prior to forwarding the request. If the received value is zero (0), the recipient must not forward the RequestMessage. Instead, for OptionsMessages and RegisterMessagess, it must respond as the final recipient. For all other methods, the server returns a TOO_MANY_HOPS ResponseMessage.

If the received MaxForwards value is greater than zero, then the forwarded RequestMessage must contain an updated MaxForwardsHeader with a value decremented by one (1).

Version:
0.6

Field Summary
static java.lang.String token
          Token of MaxForwardsHeader
 
Fields inherited from class jain.protocol.ip.sip.header.Header
ENTITY_HEADER, GENERAL_HEADER, REQUEST_HEADER, RESPONSE_HEADER
 
Constructor Summary
MaxForwardsHeader(int maxForwards)
          Creates a MaxForwardsHeader based on given number of max-forwards
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of MaxForwardsHeader
 void decrementMaxForwards()
          Decrements the number of max-forwards by one
 boolean equals(MaxForwardsHeader maxForwardsHeader)
          Indicates whether some other MaxForwardsHeader is "equal to" this one
 int getMaxForwards()
          Gets max-forwards of MaxForwardsHeader
 java.lang.String getValue()
          Gets value of MaxForwardsHeader
 void setMaxForwards(int maxForwards)
          Sets max-forwards of MaxForwardsHeader
 
Methods inherited from class jain.protocol.ip.sip.header.Header
equals, getHeaderType, getToken, setValue, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

token

public static final java.lang.String token
Token of MaxForwardsHeader
Constructor Detail

MaxForwardsHeader

public MaxForwardsHeader(int maxForwards)
Creates a MaxForwardsHeader based on given number of max-forwards
Parameters:
maxForwards - number of max-forwards
Throws:
java.lang.IllegalArgumentException - if maxForwards is negative
Method Detail

setMaxForwards

public void setMaxForwards(int maxForwards)
                    throws java.lang.IllegalArgumentException
Sets max-forwards of MaxForwardsHeader
Parameters:
maxForwards - number of max-forwards
Throws:
java.lang.IllegalArgumentException - if maxForwards is negative

decrementMaxForwards

public void decrementMaxForwards()
Decrements the number of max-forwards by one

getMaxForwards

public int getMaxForwards()
Gets max-forwards of MaxForwardsHeader
Returns:
max-forwards of MaxForwardsHeader

getValue

public java.lang.String getValue()
Gets value of MaxForwardsHeader
Overrides:
getValue in class Header
Returns:
value of MaxForwardsHeader

clone

public java.lang.Object clone()
Creates and returns a copy of MaxForwardsHeader
Overrides:
clone in class Header

equals

public boolean equals(MaxForwardsHeader maxForwardsHeader)
Indicates whether some other MaxForwardsHeader is "equal to" this one
Parameters:
maxForwardsHeader - the MaxForwardsHeader with which to compare


If you have any comments or queries, please mail them to JAIN-SIP-interest@sun.com


Copyright - 2000 Sun Microsystems