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

gov.nist.javax.sip.header
Class MaxForwards

java.lang.Object
  extended bygov.nist.core.GenericObject
      extended bygov.nist.javax.sip.header.SIPObject
          extended bygov.nist.javax.sip.header.SIPHeader
              extended bygov.nist.javax.sip.header.MaxForwards
All Implemented Interfaces:
Cloneable, Header, MaxForwardsHeader, Serializable, SIPHeaderNames

public class MaxForwards
extends SIPHeader
implements MaxForwardsHeader

MaxForwards SIPHeader

Version:
1.2 $Revision: 1.6 $ $Date: 2006/07/13 09:01:14 $
Author:
M. Ranganathan
, Olivier Deruelle
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.sip.header.MaxForwardsHeader
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, 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
MaxForwards()
          Default constructor.
MaxForwards(int m)
           
 
Method Summary
 void decrementMaxForwards()
          decrement MaxForwards field one by one.
 String encodeBody()
          Encode into a string.
 boolean equals(Object other)
          Compare this MaxForwardsHeader for equality with another.
 int getMaxForwards()
          get the MaxForwards field.
 boolean hasReachedZero()
          Boolean function
 void setMaxForwards(int maxForwards)
          Set the maxForwards member
 
Methods inherited from class gov.nist.javax.sip.header.SIPHeader
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
clone, 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.Header
clone, getName, hashCode, toString
 

Constructor Detail

MaxForwards

public MaxForwards()
Default constructor.


MaxForwards

public MaxForwards(int m)
            throws InvalidArgumentException
Method Detail

getMaxForwards

public int getMaxForwards()
get the MaxForwards field.

Specified by:
getMaxForwards in interface MaxForwardsHeader
Returns:
the maxForwards member.

setMaxForwards

public void setMaxForwards(int maxForwards)
                    throws InvalidArgumentException
Set the maxForwards member

Specified by:
setMaxForwards in interface MaxForwardsHeader
Parameters:
maxForwards - maxForwards parameter to set
Throws:
InvalidArgumentException - if the maxForwards argument is less than 0 or greater than 255.

encodeBody

public String encodeBody()
Encode into a string.

Returns:
encoded string.

hasReachedZero

public boolean hasReachedZero()
Boolean function

Returns:
true if MaxForwards field reached zero.

decrementMaxForwards

public void decrementMaxForwards()
                          throws TooManyHopsException
decrement MaxForwards field one by one.

Specified by:
decrementMaxForwards in interface MaxForwardsHeader
Throws:
TooManyHopsException - if implementation cannot decrement max-fowards i.e. max-forwards has reached zero

equals

public boolean equals(Object other)
Description copied from interface: MaxForwardsHeader
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 MaxForwardsHeader
Overrides:
equals in class SIPObject
Parameters:
other - the other object to test against.

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.