Skip to content
Snippets Groups Projects
Commit 410cbe6d authored by yanmorin's avatar yanmorin
Browse files

FLEX/YACC parser rejected
guiserver.cpp and guiserver.h are temporary
parent d2fcdcd0
No related branches found
No related tags found
No related merge requests found
// $Header$
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
// by flex
// Copyright (c) 1993 The Regents of the University of California.
// All rights reserved.
//
// This code is derived from software contributed to Berkeley by
// Kent Williams and Tom Epperly.
//
// Redistribution and use in source and binary forms with or without
// modification are permitted provided that: (1) source distributions retain
// this entire copyright notice and comment, and (2) distributions including
// binaries display the following acknowledgement: ``This product includes
// software developed by the University of California, Berkeley and its
// contributors'' in the documentation or other materials provided with the
// distribution and in all advertising materials mentioning features or use
// of this software. Neither the name of the University nor the names of
// its contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// This file defines FlexLexer, an abstract class which specifies the
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
// which defines a particular lexer class.
//
// If you want to create multiple lexer classes, you use the -P flag
// to rename each yyFlexLexer to some other xxFlexLexer. You then
// include <FlexLexer.h> in your other sources once per lexer class:
//
// #undef yyFlexLexer
// #define yyFlexLexer xxFlexLexer
// #include <FlexLexer.h>
//
// #undef yyFlexLexer
// #define yyFlexLexer zzFlexLexer
// #include <FlexLexer.h>
// ...
#ifndef __FLEX_LEXER_H
// Never included before - need to define base class.
#define __FLEX_LEXER_H
#include <iostream>
extern "C++" {
struct yy_buffer_state;
typedef int yy_state_type;
class FlexLexer {
public:
virtual ~FlexLexer() { }
const char* YYText() { return yytext; }
int YYLeng() { return yyleng; }
virtual void
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
virtual struct yy_buffer_state*
yy_create_buffer( std::istream* s, int size ) = 0;
virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
virtual void yyrestart( std::istream* s ) = 0;
virtual int yylex(void *) = 0;
// Call yylex with new input/output sources.
int yylex( std::istream* new_in, std::ostream* new_out = 0, void *p=0)
{
switch_streams( new_in, new_out );
return yylex(p);
}
// Switch to new input/output streams. A nil stream pointer
// indicates "keep the current one".
virtual void switch_streams( std::istream* new_in = 0,
std::ostream* new_out = 0 ) = 0;
int lineno() const { return yylineno; }
int debug() const { return yy_flex_debug; }
void set_debug( int flag ) { yy_flex_debug = flag; }
protected:
char* yytext;
int yyleng;
int yylineno; // only maintained if you use %option yylineno
int yy_flex_debug; // only has effect with -d or "%option debug"
};
}
#endif
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
// Either this is the first time through (yyFlexLexerOnce not defined),
// or this is a repeated include to define a different flavor of
// yyFlexLexer, as discussed in the flex man page.
#define yyFlexLexerOnce
class yyFlexLexer : public FlexLexer {
public:
// arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex().
yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
virtual ~yyFlexLexer();
void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
struct yy_buffer_state* yy_create_buffer( std::istream* s, int size );
void yy_delete_buffer( struct yy_buffer_state* b );
void yyrestart( std::istream* s );
virtual int yylex(void *);
virtual void switch_streams( std::istream* new_in, std::ostream* new_out );
protected:
virtual int LexerInput( char* buf, int max_size );
virtual void LexerOutput( const char* buf, int size );
virtual void LexerError( const char* msg );
void yyunput( int c, char* buf_ptr );
int yyinput();
void yy_load_buffer_state();
void yy_init_buffer( struct yy_buffer_state* b, std::istream* s );
void yy_flush_buffer( struct yy_buffer_state* b );
int yy_start_stack_ptr;
int yy_start_stack_depth;
int* yy_start_stack;
void yy_push_state( int new_state );
void yy_pop_state();
int yy_top_state();
yy_state_type yy_get_previous_state();
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
std::istream* yyin; // input source for default LexerInput
std::ostream* yyout; // output sink for default LexerOutput
struct yy_buffer_state* yy_current_buffer;
// yy_hold_char holds the character lost when yytext is formed.
char yy_hold_char;
// Number of characters read into yy_ch_buf.
int yy_n_chars;
// Points to current character in buffer.
char* yy_c_buf_p;
int yy_init; // whether we need to initialize
int yy_start; // start state number
// Flag which is used to allow yywrap()'s to do buffer switches
// instead of setting up a fresh yyin. A bit of a hack ...
int yy_did_buffer_switch_on_eof;
// The following are not always needed, but may be depending
// on use of certain flex features (like REJECT or yymore()).
yy_state_type yy_last_accepting_state;
char* yy_last_accepting_cpos;
yy_state_type* yy_state_buf;
yy_state_type* yy_state_ptr;
char* yy_full_match;
int* yy_full_state;
int yy_full_lp;
int yy_lp;
int yy_looking_for_trail_begin;
int yy_more_flag;
int yy_more_len;
int yy_more_offset;
int yy_prev_more_offset;
};
#endif
noinst_LTLIBRARIES = libsflphoneguiserver.la
libsflphoneguiserver_la_SOURCES = \
$(BUILT_SOURCES) \
guiserver.cpp
libsflphoneguiserver_la_SOURCES = $(BUILT_SOURCES) guiserver.cpp \
responsemessage.cpp
libsflphoneguiserver_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
libsflphoneguiserver_la_LIBADD =
AM_CPPFLAGS = -I$(top_srcdir) $(libccext2_CFLAGS)
noinst_HEADERS = responsemessage.h
#include <cc++/socket.h>
#include "FlexLexer.h"
class yyFlexLexer;
class GUIServer;
class TCPStreamLexer : public ost::TCPStream {
public:
TCPStreamLexer(ost::TCPSocket &socket, GUIServer* gui) : ost::TCPStream(socket) {
_lexer = new yyFlexLexer(this, this);
_gui = gui;
}
~TCPStreamLexer() { delete _lexer; }
void parse();
void sip();
void callsip();
void newCommand();
yyFlexLexer *_lexer;
private:
GUIServer *_gui;
};
......@@ -40,26 +40,12 @@ TCPSessionWriter::run()
}
}
std::string
Request::message(const std::string &code, const std::string &message)
{
std::string returnMessage = code + " " + _sequenceId + " " + message;
return returnMessage;
}
std::string
RequestGlobal::execute(GUIServer* gui)
{
std::string returnOK = std::string("200 ") + _sequenceId + " OK";
return returnOK;
}
std::string
RequestCall::execute(GUIServer* gui)
ResponseMessage
RequestCall::execute(GUIServer& gui)
{
int serverCallId = gui->outgoingCall(_destination);
int serverCallId = gui.outgoingCall(_destination);
if (serverCallId) {
gui->pushResponseMessage(message("150", "Trying..."));
return message("200", "OK");
return message("150", "Trying...");
} else {
return message("500","Server Error");
}
......@@ -118,7 +104,7 @@ GUIServer::exec() {
output = "";
while(sessionIn->good() && sessionOut->good()) {
request = popRequest();
output = request->execute(this);
output = request->execute(*this);
pushResponseMessage(output);
delete request;
}
......@@ -156,12 +142,17 @@ GUIServer::popRequest()
}
void
GUIServer::pushResponseMessage(const std::string &response)
GUIServer::pushResponseMessage(const ResponseMessage &response)
{
std::cout << "pushResponseMessage" << std::endl;
_mutex.enterMutex();
_responses.push_back(response);
_responses.push_back(response.toString());
_mutex.leaveMutex();
// remove the request from the list
if (response.isFinal()) {
removeRequest(response.sequenceId());
}
}
std::string
......
......@@ -27,6 +27,7 @@
#include <cc++/socket.h>
#include <cc++/thread.h>
#include <map>
#include "responsemessage.h"
class GUIServer;
class Request
......@@ -34,8 +35,11 @@ class Request
public:
Request(const std::string &sequenceId, const std::string &arg) : _sequenceId(sequenceId), _arg(arg) {}
virtual ~Request() {}
virtual std::string execute(GUIServer* gui) { return ""; }
virtual std::string message(const std::string &code, const std::string &message);
virtual ResponseMessage execute(GUIServer& gui) = 0;
ResponseMessage message(const std::string &code, const std::string &message) {
ResponseMessage response(_sequenceId, code, message);
return response;
}
protected:
std::string _sequenceId;
......@@ -76,7 +80,7 @@ public:
_destination = _arg.substr(spacePos+1, _arg.size()-spacePos+1);
}
}
std::string execute(GUIServer *gui);
virtual ResponseMessage execute(GUIServer& gui);
private:
std::string _destination;
......@@ -110,8 +114,7 @@ class RequestGlobal : public Request
public:
RequestGlobal(const std::string &sequenceId, const std::string &arg) : Request(sequenceId,arg) {}
virtual ~RequestGlobal() {}
virtual std::string execute(GUIServer *gui);
virtual ResponseMessage execute(GUIServer& gui) { return message("200","OK"); }
};
class RequestMute : public RequestGlobal {
......@@ -134,7 +137,7 @@ class RequestSyntaxError : public Request
public:
RequestSyntaxError(const std::string &sequenceId, const std::string &arg) : Request(sequenceId, arg) {}
~RequestSyntaxError() {}
std::string execute(GUIServer *gui) {
ResponseMessage execute(GUIServer& gui) {
return message("501", "Syntax Error");
}
};
......@@ -272,8 +275,10 @@ public:
int exec(void);
void pushRequestMessage(const std::string& request);
Request *popRequest(void);
void pushResponseMessage(const std::string& response);
void pushResponseMessage(const ResponseMessage& response);
std::string popResponseMessage(void);
void removeRequest(const std::string& request);
// Reimplementation of virtual functions
virtual int incomingCall (short id);
......
This diff is collapsed.
This diff is collapsed.
/* A Bison parser, made by GNU Bison 1.875c. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
AROBASE = 258,
SIP_URL_PREFIX = 259,
COMMAND = 260,
CSEQ = 261,
CALLID = 262,
USERNAME = 263,
NUMBER = 264
};
#endif
#define AROBASE 258
#define SIP_URL_PREFIX 259
#define COMMAND 260
#define CSEQ 261
#define CALLID 262
#define USERNAME 263
#define NUMBER 264
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
#ifndef lint
static char const
yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
#endif
#include <stdlib.h>
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYLEX yylex()
#define YYEMPTY -1
#define yyclearin (yychar=(YYEMPTY))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING() (yyerrflag!=0)
static int yygrowstack();
#define YYPREFIX "yy"
#line 2 "protocol.y"
#include <stdio.h>
#include <string.h>
#include <iostream>
#line 7 "protocol.y"
typedef union {
int number;
char *username;
} YYSTYPE;
#line 13 "protocol.y"
#include "TCPStreamLexer.h"
#define YYPARSE_PARAM tsl
#define YYPARSE_PARAM_TYPE TCPStreamLexer*
int
yyerror(const char *str) {}
extern "C"
{
int yyparse(TCPStreamLexer *tsl);
}
int
yylex()
{
return lexer->yylex();
}
void
TCPStreamLexer::parse( )
{
yyparse(this);
}
void
TCPStreamLexer::sip(YYSTYPE &y)
{
*this << "(debug) saw url: " << y.username << std::endl;
}
void
TCPStreamLexer::callsip(YYSTYPE &y)
{
*this << "200 Calling " << y.username << std::endl;
}
#line 59 "y.tab.c"
#define YYERRCODE 256
#define AROBASE 257
#define SIP_URL_PREFIX 258
#define CMD_CALL 259
#define CMD_CONFIG 260
#define CMD_HANGUP 261
#define CMD_HOLD 262
#define CMD_TRANSFER 263
#define CMD_QUIT 264
#define TOKEN_VOICEMAIL 265
#define TOKEN_RECEPTION 266
#define TOKEN_ALL 267
#define TOKEN_GET 268
#define TOKEN_SET 269
#define NUMBER 270
#define USERNAME 271
const short yylhs[] = { -1,
0, 0, 1, 1, 1, 1, 1, 1, 8, 2,
2, 2, 3, 3, 3, 4, 4, 6, 5, 7,
};
const short yylen[] = { 2,
0, 2, 1, 1, 1, 1, 1, 1, 4, 2,
2, 2, 3, 3, 4, 2, 2, 2, 3, 1,
};
const short yydefred[] = { 1,
0, 0, 0, 0, 0, 0, 20, 2, 3, 4,
5, 6, 7, 8, 0, 11, 10, 12, 0, 0,
16, 17, 18, 0, 0, 13, 14, 0, 19, 0,
15, 9,
};
const short yydgoto[] = { 1,
8, 9, 10, 11, 12, 13, 14, 18,
};
const short yysindex[] = { 0,
-250, -258, -253, -264, -268, -252, 0, 0, 0, 0,
0, 0, 0, 0, -267, 0, 0, 0, -266, -254,
0, 0, 0, -239, -237, 0, 0, -249, 0, -248,
0, 0,
};
const short yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
const short yygindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, -3,
};
#define YYTABLESIZE 23
const short yytable[] = { 15,
26, 23, 21, 25, 27, 22, 16, 17, 2, 3,
4, 5, 6, 7, 19, 20, 28, 24, 15, 30,
29, 31, 32,
};
const short yycheck[] = { 258,
267, 270, 267, 271, 271, 270, 265, 266, 259, 260,
261, 262, 263, 264, 268, 269, 271, 270, 258, 257,
24, 271, 271,
};
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#if YYDEBUG
const char * const yyname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"AROBASE","SIP_URL_PREFIX",
"CMD_CALL","CMD_CONFIG","CMD_HANGUP","CMD_HOLD","CMD_TRANSFER","CMD_QUIT",
"TOKEN_VOICEMAIL","TOKEN_RECEPTION","TOKEN_ALL","TOKEN_GET","TOKEN_SET",
"NUMBER","USERNAME",
};
const char * const yyrule[] = {
"$accept : commands",
"commands :",
"commands : commands command",
"command : command_call",
"command : command_config",
"command : command_hangup",
"command : command_transfer",
"command : command_hold",
"command : command_quit",
"sip_url : SIP_URL_PREFIX USERNAME AROBASE USERNAME",
"command_call : CMD_CALL TOKEN_RECEPTION",
"command_call : CMD_CALL TOKEN_VOICEMAIL",
"command_call : CMD_CALL sip_url",
"command_config : CMD_CONFIG TOKEN_GET TOKEN_ALL",
"command_config : CMD_CONFIG TOKEN_GET USERNAME",
"command_config : CMD_CONFIG TOKEN_SET USERNAME USERNAME",
"command_hangup : CMD_HANGUP TOKEN_ALL",
"command_hangup : CMD_HANGUP NUMBER",
"command_hold : CMD_HOLD NUMBER",
"command_transfer : CMD_TRANSFER NUMBER sip_url",
"command_quit : CMD_QUIT",
};
#endif
#if YYDEBUG
#include <stdio.h>
#endif
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 10000
#define YYMAXDEPTH 10000
#endif
#endif
#define YYINITSTACKSIZE 200
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
short *yyss;
short *yysslim;
YYSTYPE *yyvs;
int yystacksize;
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack()
{
int newsize, i;
short *newss;
YYSTYPE *newvs;
if ((newsize = yystacksize) == 0)
newsize = YYINITSTACKSIZE;
else if (newsize >= YYMAXDEPTH)
return -1;
else if ((newsize *= 2) > YYMAXDEPTH)
newsize = YYMAXDEPTH;
i = yyssp - yyss;
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
(short *)malloc(newsize * sizeof *newss);
if (newss == NULL)
return -1;
yyss = newss;
yyssp = newss + i;
newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
(YYSTYPE *)malloc(newsize * sizeof *newvs);
if (newvs == NULL)
return -1;
yyvs = newvs;
yyvsp = newvs + i;
yystacksize = newsize;
yysslim = yyss + newsize - 1;
return 0;
}
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
#ifndef YYPARSE_PARAM
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG void
#define YYPARSE_PARAM_DECL
#else /* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* ANSI-C/C++ */
#else /* YYPARSE_PARAM */
#ifndef YYPARSE_PARAM_TYPE
#define YYPARSE_PARAM_TYPE void *
#endif
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
#endif /* ANSI-C/C++ */
#endif /* ! YYPARSE_PARAM */
int
yyparse (YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
{
register int yym, yyn, yystate;
#if YYDEBUG
register const char *yys;
if ((yys = getenv("YYDEBUG")))
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
yynerrs = 0;
yyerrflag = 0;
yychar = (-1);
if (yyss == NULL && yygrowstack()) goto yyoverflow;
yyssp = yyss;
yyvsp = yyvs;
*yyssp = yystate = 0;
yyloop:
if ((yyn = yydefred[yystate])) goto yyreduce;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
}
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
yychar = (-1);
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
yyn = yytable[yyn];
goto yyreduce;
}
if (yyerrflag) goto yyinrecovery;
#if defined(lint) || defined(__GNUC__)
goto yynewerror;
#endif
yynewerror:
yyerror("syntax error");
#if defined(lint) || defined(__GNUC__)
goto yyerrlab;
#endif
yyerrlab:
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
{
yyerrflag = 3;
for (;;)
{
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
goto yyloop;
}
else
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: error recovery discarding state %d\n",
YYPREFIX, *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
--yyvsp;
}
}
}
else
{
if (yychar == 0) goto yyabort;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
yychar = (-1);
goto yyloop;
}
yyreduce:
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
switch (yyn)
{
case 9:
#line 69 "protocol.y"
{
yyval=yyvsp[-2];
tsl->sip(yyvsp[-2]);
printf ("(debug) saw url: %s\n", yyval);
}
break;
case 10:
#line 78 "protocol.y"
{
printf ("200 Calling Receptionist\n");
}
break;
case 11:
#line 83 "protocol.y"
{
printf ("200 Calling VoiceMail\n");
}
break;
case 12:
#line 88 "protocol.y"
{
tsl->callsip(yyvsp[0]);
printf ("200 Calling \"%s\"\n", yyvsp[0]);
}
break;
case 13:
#line 96 "protocol.y"
{
printf ("200 Sending ALL config variables\n");
}
break;
case 14:
#line 100 "protocol.y"
{
printf ("200 Sending config variable \"%s\"\n", yyvsp[0]);
}
break;
case 15:
#line 104 "protocol.y"
{
printf ("200 Setting config variable \"%s\"=\"%s\"\n", yyvsp[-1],yyvsp[0]);
}
break;
case 16:
#line 111 "protocol.y"
{
printf ("200 Hangup all calls !!!\n");
}
break;
case 17:
#line 115 "protocol.y"
{
printf ("200 Hangup call %d\n", yyvsp[0]);
}
break;
case 18:
#line 122 "protocol.y"
{
printf ("200 Call %d on hold.\n", yyvsp[0]);
}
break;
case 19:
#line 129 "protocol.y"
{
printf ("200 Transferring call %d to \"%s\"\n", yyvsp[-1], yyvsp[0]);
}
break;
case 20:
#line 136 "protocol.y"
{
printf ("200 Quitting...Bye Bye\n");
}
break;
#line 457 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state 0 to\
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
*++yyvsp = yyval;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
if (yychar == 0) goto yyaccept;
goto yyloop;
}
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
*++yyssp = yystate;
*++yyvsp = yyval;
goto yyloop;
yyoverflow:
yyerror("yacc stack overflow");
yyabort:
return (1);
yyaccept:
return (0);
}
#ifndef YYERRCODE
#define YYERRCODE 256
#endif
#define AROBASE 257
#define SIP_URL_PREFIX 258
#define CMD_CALL 259
#define CMD_CONFIG 260
#define CMD_HANGUP 261
#define CMD_HOLD 262
#define CMD_TRANSFER 263
#define CMD_QUIT 264
#define TOKEN_VOICEMAIL 265
#define TOKEN_RECEPTION 266
#define TOKEN_ALL 267
#define TOKEN_GET 268
#define TOKEN_SET 269
#define NUMBER 270
#define USERNAME 271
typedef union {
int number;
char *username;
} YYSTYPE;
extern YYSTYPE yylval;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment