• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Conditions Of Use
3 *
4 * This software was developed by employees of the National Institute of
5 * Standards and Technology (NIST), an agency of the Federal Government.
6 * Pursuant to title 15 Untied States Code Section 105, works of NIST
7 * employees are not subject to copyright protection in the United States
8 * and are considered to be in the public domain.  As a result, a formal
9 * license is not needed to use the software.
10 *
11 * This software is provided by NIST as a service and is expressly
12 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15 * AND DATA ACCURACY.  NIST does not warrant or make any representations
16 * regarding the use of the software or the results thereof, including but
17 * not limited to the correctness, accuracy, reliability or usefulness of
18 * the software.
19 *
20 * Permission to use this software is contingent upon your acceptance
21 * of the terms of this agreement
22 *
23 * .
24 *
25 */
26 package gov.nist.javax.sip.header;
27 
28 import javax.sip.InvalidArgumentException;
29 
30 /**
31  *
32  * @version 1.2 $Revision: 1.7 $ $Date: 2009/10/18 13:46:35 $
33  *
34  * @author M. Ranganathan   <br/>
35  *
36  *
37  */
38 public class RSeq extends SIPHeader implements javax.sip.header.RSeqHeader {
39     /**
40      * Comment for <code>serialVersionUID</code>
41      */
42     private static final long serialVersionUID = 8765762413224043394L;
43     protected long sequenceNumber;
44 
45     /** Creates a new instance of RSeq */
RSeq()46     public RSeq() {
47         super(NAME);
48     }
49 
50     /** Gets the sequence number of this RSeqHeader.
51      * @deprecated
52      * @return the integer value of the Sequence number of the RSeqHeader
53      */
getSequenceNumber()54     public int getSequenceNumber() {
55         return (int)this.sequenceNumber;
56     }
57 
58 
59     /** Encode the body of this header (the stuff that follows headerName).
60      * A.K.A headerValue.
61      */
encodeBody()62     protected String encodeBody() {
63         return Long.toString(this.sequenceNumber);
64     }
65 
getSeqNumber()66     public long getSeqNumber() {
67         return this.sequenceNumber;
68     }
69 
setSeqNumber(long sequenceNumber)70     public void setSeqNumber(long sequenceNumber) throws InvalidArgumentException {
71 
72             if (sequenceNumber <= 0 ||sequenceNumber > ((long)1)<<32 - 1)
73                 throw new InvalidArgumentException(
74                     "Bad seq number " + sequenceNumber);
75             this.sequenceNumber = sequenceNumber;
76 
77     }
78 
79     /**
80      * @deprecated
81      * @see javax.sip.header.RSeqHeader#setSequenceNumber(int)
82      */
setSequenceNumber(int sequenceNumber)83     public void setSequenceNumber(int sequenceNumber) throws InvalidArgumentException {
84         this.setSeqNumber(sequenceNumber);
85 
86     }
87 
88 
89 
90 }
91