• 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 /****************************************************************************
27  * PRODUCT OF PT INOVACAO - EST DEPARTMENT and Aveiro University (Portugal) *
28  ****************************************************************************/
29 
30 package gov.nist.javax.sip.parser.ims;
31 
32 import java.text.ParseException;
33 
34 import gov.nist.javax.sip.header.ims.PCalledPartyID;
35 import gov.nist.javax.sip.header.SIPHeader;
36 import gov.nist.javax.sip.parser.Lexer;
37 import gov.nist.javax.sip.parser.TokenTypes;
38 import gov.nist.javax.sip.parser.AddressParametersParser;
39 
40 /**
41  * P-Called-Party-ID header parser
42  *
43  * @author Miguel Freitas (IT) PT-Inovacao
44  */
45 
46 public class PCalledPartyIDParser
47     extends AddressParametersParser
48 {
49 
50 
51     /**
52      * Constructor
53      * @param calledPartyID content to set
54      */
PCalledPartyIDParser(String calledPartyID)55     public PCalledPartyIDParser(String calledPartyID)
56     {
57         super(calledPartyID);
58     }
59 
PCalledPartyIDParser(Lexer lexer)60     protected PCalledPartyIDParser(Lexer lexer)
61     {
62         super(lexer);
63     }
64 
65 
parse()66     public SIPHeader parse() throws ParseException
67     {
68 
69         if (debug)
70             dbg_enter("PCalledPartyIDParser.parse");
71 
72         try {
73             this.lexer.match(TokenTypes.P_CALLED_PARTY_ID);
74             this.lexer.SPorHT();
75             this.lexer.match(':');
76             this.lexer.SPorHT();
77 
78             PCalledPartyID calledPartyID = new PCalledPartyID();
79             super.parse(calledPartyID);
80 
81             return calledPartyID;
82 
83         } finally {
84             if (debug)
85                 dbg_leave("PCalledPartyIDParser.parse");
86         }
87 
88     }
89 
90 
91 
92 
93     /** Test program
94     public static void main(String args[]) throws ParseException
95     {
96         String rou[] = {
97                     "P-Associated-URI: <sip:testes1@ptinovacao.pt>,  " +
98                                     "<sip:testes2@ptinovacao.pt> \n"
99                     };
100 
101         for (int i = 0; i < rou.length; i++ ) {
102             RecordRouteParser rp =
103               new RecordRouteParser(rou[i]);
104             RecordRouteList recordRouteList = (RecordRouteList) rp.parse();
105             System.out.println("encoded = " +recordRouteList.encode());
106         }
107     }
108     */
109 
110 
111 }
112