Home | History | Annotate | Download | only in parser
      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.parser;
     27 
     28 import gov.nist.javax.sip.header.*;
     29 import java.text.*;
     30 
     31 /** Parser for CALL ID header.
     32  *
     33  * @version 1.2 $Revision: 1.8 $ $Date: 2009/07/17 18:57:58 $
     34  *
     35  * @author M. Ranganathan
     36  * @author  Olivier Deruelle
     37  *
     38  */
     39 public class CallIDParser extends HeaderParser {
     40 
     41     /**
     42      * Creates new CallIDParser
     43      * @param callID message to parse
     44      */
     45     public CallIDParser(String callID) {
     46         super(callID);
     47     }
     48 
     49     /**
     50      * Constructor
     51      * @param lexer Lexer to set
     52      */
     53     protected CallIDParser(Lexer lexer) {
     54         super(lexer);
     55     }
     56 
     57     /**
     58      * parse the String message
     59      * @return SIPHeader (CallID object)
     60      * @throws ParseException if the message does not respect the spec.
     61      */
     62     public SIPHeader parse() throws ParseException {
     63         if (debug)
     64             dbg_enter("parse");
     65         try {
     66             this.lexer.match(TokenTypes.CALL_ID);
     67             this.lexer.SPorHT();
     68             this.lexer.match(':');
     69             this.lexer.SPorHT();
     70 
     71             CallID callID = new CallID();
     72 
     73             this.lexer.SPorHT();
     74             String rest = lexer.getRest();
     75             callID.setCallId(rest.trim());
     76             return callID;
     77         } finally {
     78             if (debug)
     79                 dbg_leave("parse");
     80         }
     81     }
     82 
     83     /*
     84 
     85 
     86         }
     87     */
     88 }
     89 /*
     90  * $Log: CallIDParser.java,v $
     91  * Revision 1.8  2009/07/17 18:57:58  emcho
     92  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
     93  *
     94  * Revision 1.7  2006/07/13 09:02:17  mranga
     95  * Issue number:
     96  * Obtained from:
     97  * Submitted by:  jeroen van bemmel
     98  * Reviewed by:   mranga
     99  * Moved some changes from jain-sip-1.2 to java.net
    100  *
    101  * CVS: ----------------------------------------------------------------------
    102  * CVS: Issue number:
    103  * CVS:   If this change addresses one or more issues,
    104  * CVS:   then enter the issue number(s) here.
    105  * CVS: Obtained from:
    106  * CVS:   If this change has been taken from another system,
    107  * CVS:   then name the system in this line, otherwise delete it.
    108  * CVS: Submitted by:
    109  * CVS:   If this code has been contributed to the project by someone else; i.e.,
    110  * CVS:   they sent us a patch or a set of diffs, then include their name/email
    111  * CVS:   address here. If this is your work then delete this line.
    112  * CVS: Reviewed by:
    113  * CVS:   If we are doing pre-commit code reviews and someone else has
    114  * CVS:   reviewed your changes, include their name(s) here.
    115  * CVS:   If you have not had it reviewed then delete this line.
    116  *
    117  * Revision 1.3  2006/06/19 06:47:27  mranga
    118  * javadoc fixups
    119  *
    120  * Revision 1.2  2006/06/16 15:26:28  mranga
    121  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
    122  *
    123  * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
    124  *
    125  * Import
    126  *
    127  *
    128  * Revision 1.5  2004/07/28 14:13:54  mranga
    129  * Submitted by:  mranga
    130  *
    131  * Move out the test code to a separate test/unit class.
    132  * Fixed some encode methods.
    133  *
    134  * Revision 1.4  2004/01/22 13:26:31  sverker
    135  * Issue number:
    136  * Obtained from:
    137  * Submitted by:  sverker
    138  * Reviewed by:   mranga
    139  *
    140  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
    141  *
    142  * CVS: ----------------------------------------------------------------------
    143  * CVS: Issue number:
    144  * CVS:   If this change addresses one or more issues,
    145  * CVS:   then enter the issue number(s) here.
    146  * CVS: Obtained from:
    147  * CVS:   If this change has been taken from another system,
    148  * CVS:   then name the system in this line, otherwise delete it.
    149  * CVS: Submitted by:
    150  * CVS:   If this code has been contributed to the project by someone else; i.e.,
    151  * CVS:   they sent us a patch or a set of diffs, then include their name/email
    152  * CVS:   address here. If this is your work then delete this line.
    153  * CVS: Reviewed by:
    154  * CVS:   If we are doing pre-commit code reviews and someone else has
    155  * CVS:   reviewed your changes, include their name(s) here.
    156  * CVS:   If you have not had it reviewed then delete this line.
    157  *
    158  */
    159