Package gov.nist.core

Examples of gov.nist.core.Token


  protected String sipVersion() throws ParseException {
    if (debug)
      dbg_enter("sipVersion");
    try {
      Token tok = lexer.match(SIP);
      if (!tok.getTokenValue().equalsIgnoreCase("SIP"))
        createParseException("Expecting SIP");
      lexer.match('/');
      tok = lexer.match(ID);
      if (!tok.getTokenValue().equals("2.0"))
        createParseException("Expecting SIP/2.0");

      return "SIP/2.0";
    } finally {
      if (debug)
View Full Code Here


  protected String method() throws ParseException {
    try {
      if (debug)
        dbg_enter("method");
      Token[] tokens = this.lexer.peekNextToken(1);
      Token token = (Token) tokens[0];
      if (token.getTokenType() == INVITE
        || token.getTokenType() == ACK
        || token.getTokenType() == OPTIONS
        || token.getTokenType() == BYE
        || token.getTokenType() == REGISTER
        || token.getTokenType() == CANCEL
        || token.getTokenType() == SUBSCRIBE
        || token.getTokenType() == NOTIFY
        || token.getTokenType() == PUBLISH
        || token.getTokenType() == MESSAGE
        || token.getTokenType() == ID) {
        lexer.consume();
        return token.getTokenValue();
      } else {
        throw createParseException("Invalid Method");
      }
    } finally {
      if (Debug.debug)
View Full Code Here

  public GenericURI uriReference() throws ParseException {
    if (debug)
      dbg_enter("uriReference");
    GenericURI retval = null;
    Token[] tokens = lexer.peekNextToken(2);
    Token t1 = (Token) tokens[0];
    Token t2 = (Token) tokens[1];
    try {

      if (t1.getTokenType() == TokenTypes.SIP ||
          t1.getTokenType() == TokenTypes.SIPS  ) {
        if (t2.getTokenType() == ':')
          retval = sipURL();
        else
          throw createParseException("Expecting \':\'");
      } else if (t1.getTokenType() == TokenTypes.TEL) {
        if (t2.getTokenType() == ':') {
          retval = telURL();
        } else
          throw createParseException("Expecting \':\'");
      } else {
        String urlString = uricString();
View Full Code Here

    String b = null;
    try {
      b = local_number();
      tn.setPhoneNumber(b);
      if (lexer.hasMoreChars()) {
        Token tok = this.lexer.peekNextToken();
        switch (tok.getTokenType()) {
          case SEMICOLON :
            {
              this.lexer.consume(1);
              nv = tel_parameters();
              tn.setParameters(nv);
View Full Code Here

    Object value;
    if (la=='+') {  // global-number-digits
      lexer.consume(1)// skip '+'
      value = "+" + base_phone_number();
    } else if ( Lexer.isAlphaDigit(la) ) {
      Token t = lexer.match( Lexer.ID )// more broad than allowed
      value = t.getTokenValue();
    } else {
      throw new ParseException( "Invalid phone-context:" + la , -1 );
    }
    return new NameValue( "phone-context", value, false );
  }
View Full Code Here

  public SipUri sipURL() throws ParseException {
    if (debug)
      dbg_enter("sipURL");
    SipUri retval = new SipUri();
    // pmusgrave - handle sips case
    Token nextToken = lexer.peekNextToken();
    int sipOrSips = TokenTypes.SIP;
    String scheme = TokenNames.SIP;
    if ( nextToken.getTokenType() == TokenTypes.SIPS)
    {
      sipOrSips = TokenTypes.SIPS;
      scheme = TokenNames.SIPS;
    }
View Full Code Here

  protected void parseToken(PVisitedNetworkID visitedNetworkID) throws ParseException
  {
    // issued by Miguel Freitas
   
    lexer.match(TokenTypes.ID);
    Token token = lexer.getNextToken();
    //String value = token.getTokenValue();
    visitedNetworkID.setVisitedNetworkID(token);
    super.parse(visitedNetworkID);
             
  }
View Full Code Here

      mediaAuthorization.setHeaderName(SIPHeaderNamesIms.P_MEDIA_AUTHORIZATION);
     
      while (lexer.lookAhead(0) != '\n')
      {
        this.lexer.match(TokenTypes.ID);
        Token token = lexer.getNextToken();
        try {
          mediaAuthorization.setMediaAuthorizationToken(token.getTokenValue());
        } catch (InvalidArgumentException e) {
          throw createParseException(e.getMessage());
        }
        mediaAuthorizationList.add(mediaAuthorization);
       
View Full Code Here

   
     
    // the security-mechanism:
    this.lexer.SPorHT();
    lexer.match(TokenTypes.ID);
    Token type = lexer.getNextToken();
    header.setSecurityMechanism(type.getTokenValue());
    this.lexer.SPorHT();

    char la = lexer.lookAhead(0);
    if (la == '\n')
    {
      list.add(header);
      return list;
    }
    else if (la == ';')
      this.lexer.match(';');
   
    this.lexer.SPorHT();
   
    // The parameters:
    try {
      while (lexer.lookAhead(0) != '\n') {
       
        this.parseParameter(header);
        this.lexer.SPorHT();
        char laInLoop = lexer.lookAhead(0);
        if (laInLoop == '\n' || laInLoop == '\0')
          break;
        else if (laInLoop == ',')
        {
          list.add(header);
          if (header.getClass().isInstance(new SecurityClient())) {
            header = new SecurityClient();
          } else if (header.getClass().isInstance(new SecurityServer())) {
            header = new SecurityServer();
          } else if (header.getClass().isInstance(new SecurityVerify())) {
            header = new SecurityVerify();
          }

          this.lexer.match(',');
          // the security-mechanism:
          this.lexer.SPorHT();
          lexer.match(TokenTypes.ID);
          type = lexer.getNextToken();
          header.setSecurityMechanism(type.getTokenValue());

        }
        this.lexer.SPorHT();
       
        if (lexer.lookAhead(0) == ';')
View Full Code Here

      PAccessNetworkInfo accessNetworkInfo = new PAccessNetworkInfo();
      accessNetworkInfo.setHeaderName(SIPHeaderNamesIms.P_ACCESS_NETWORK_INFO);
     
      this.lexer.SPorHT();
      lexer.match(TokenTypes.ID);
      Token token = lexer.getNextToken();
      accessNetworkInfo.setAccessType(token.getTokenValue());

      this.lexer.SPorHT();
      while (lexer.lookAhead(0) == ';') {
        this.lexer.match(';');
        this.lexer.SPorHT();
View Full Code Here

TOP

Related Classes of gov.nist.core.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.