• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package gov.nist.javax.sip.parser.ims;
2 
3 /*
4 * Conditions Of Use
5 *
6 * This software was developed by employees of the National Institute of
7 * Standards and Technology (NIST), an agency of the Federal Government.
8 * Pursuant to title 15 Untied States Code Section 105, works of NIST
9 * employees are not subject to copyright protection in the United States
10 * and are considered to be in the public domain.  As a result, a formal
11 * license is not needed to use the software.
12 *
13 * This software is provided by NIST as a service and is expressly
14 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
15 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
17 * AND DATA ACCURACY.  NIST does not warrant or make any representations
18 * regarding the use of the software or the results thereof, including but
19 * not limited to the correctness, accuracy, reliability or usefulness of
20 * the software.
21 *
22 * Permission to use this software is contingent upon your acceptance
23 * of the terms of this agreement
24 *
25 * .
26 *
27 */
28 
29 import java.text.ParseException;
30 import gov.nist.javax.sip.address.AddressFactoryImpl;
31 import gov.nist.javax.sip.header.SIPHeader;
32 import gov.nist.javax.sip.header.ims.PServedUser;
33 import gov.nist.javax.sip.parser.Lexer;
34 import gov.nist.javax.sip.parser.ParametersParser;
35 import gov.nist.javax.sip.parser.TokenTypes;
36 
37 /**
38  *
39  * @author aayush.bhatnagar
40  *
41  */
42 public class PServedUserParser extends ParametersParser implements TokenTypes{
43 
PServedUserParser(Lexer lexer)44     protected PServedUserParser(Lexer lexer) {
45         super(lexer);
46     }
47 
PServedUserParser(String servedUser)48     public PServedUserParser(String servedUser){
49         super(servedUser);
50     }
51 
parse()52     public SIPHeader parse() throws ParseException {
53 
54         if (debug)
55             dbg_enter("PServedUser.parse");
56 
57         try{
58 
59             this.lexer.match(TokenTypes.P_SERVED_USER);
60             this.lexer.SPorHT();
61             this.lexer.match(':');
62             this.lexer.SPorHT();
63             PServedUser servedUser = new PServedUser();
64             this.lexer.SPorHT();
65             String servedUsername = lexer.byteStringNoSemicolon();
66             servedUser.setAddress(new AddressFactoryImpl().createAddress(servedUsername));
67             super.parse(servedUser);
68 
69             return servedUser;
70 
71         }
72         finally {
73             if (debug)
74                 dbg_leave("PServedUser.parse");
75             }
76     }
77 
78     }
79