diff --git a/src/gui/server/FlexLexer.h b/src/gui/server/FlexLexer.h index aa3cbb15a07ed56db1841a63f9bbca909e7dfb26..29cebc35cbf03f900b09f5106ca86e83095a5237 100644 --- a/src/gui/server/FlexLexer.h +++ b/src/gui/server/FlexLexer.h @@ -65,13 +65,13 @@ public: virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; virtual void yyrestart( std::istream* s ) = 0; - virtual int yylex() = 0; + virtual int yylex(void *) = 0; // Call yylex with new input/output sources. - int yylex( std::istream* new_in, std::ostream* new_out = 0 ) + int yylex( std::istream* new_in, std::ostream* new_out = 0, void *p=0) { switch_streams( new_in, new_out ); - return yylex(); + return yylex(p); } // Switch to new input/output streams. A nil stream pointer @@ -113,7 +113,7 @@ public: void yy_delete_buffer( struct yy_buffer_state* b ); void yyrestart( std::istream* s ); - virtual int yylex(); + virtual int yylex(void *); virtual void switch_streams( std::istream* new_in, std::ostream* new_out ); protected: diff --git a/src/gui/server/Makefile.am b/src/gui/server/Makefile.am index ea6e1c49576fd1bc839349cb568fe87a3f92c1eb..afaa0ee7ec862069a51851d92300e9842bf82ed4 100644 --- a/src/gui/server/Makefile.am +++ b/src/gui/server/Makefile.am @@ -4,7 +4,7 @@ libsflphoneguiserver_la_SOURCES = \ $(BUILT_SOURCES) \ guiserver.cpp \ lex.yy.cc \ - y.tab.cc + protocol.tab.cc libsflphoneguiserver_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" libsflphoneguiserver_la_LIBADD = diff --git a/src/gui/server/TCPStreamLexer.h b/src/gui/server/TCPStreamLexer.h index 3290da014aae31d8f55ad1f1bd656af224b8e4bf..12ec616088e368919e3d74c7380009ca22e7aee5 100644 --- a/src/gui/server/TCPStreamLexer.h +++ b/src/gui/server/TCPStreamLexer.h @@ -1,24 +1,21 @@ -#ifndef __TCPSTREAMLEXER_H__ -#define __TCPSTREAMLEXER_H__ #include <cc++/socket.h> -//#include "y.tab.h" #include "FlexLexer.h" -static FlexLexer* lexer; +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; - lexer = new yyFlexLexer(this, this); } - ~TCPStreamLexer() { delete lexer; } + ~TCPStreamLexer() { } void parse(void); - void sip(YYSTYPE &y); - void callsip(YYSTYPE &y); + void sip(); + void callsip(); + yyFlexLexer *_lexer; private: GUIServer *_gui; }; -#endif // __TCPSTREAMLEXER_H__ diff --git a/src/gui/server/guiserver.cpp b/src/gui/server/guiserver.cpp index 0ebe1f0c0181e67ca6046691ab409b18c6be6c5a..4f40407a8df3cb6f88efcdc4f73b03cdd5019f66 100644 --- a/src/gui/server/guiserver.cpp +++ b/src/gui/server/guiserver.cpp @@ -20,9 +20,10 @@ #include "guiserver.h" #include <string> #include <iostream> -#include "y.tab.h" // need by TCPStreamLexer.h but can't put in it +#include "protocol.tab.h" // need by TCPStreamLexer.h but can't put in it #include "TCPStreamLexer.h" + // default constructor GUIServer::GUIServer() { @@ -45,6 +46,7 @@ GUIServer::exec() { int callid; std::string status; + while (std::cin.good()) { // waiting for a new connection @@ -59,7 +61,6 @@ GUIServer::exec() { std::string output; *aServerStream << "Welcome to this serveur2" << std::endl; - lexer = new yyFlexLexer(aServerStream, aServerStream); while(aServerStream->good() && output!="quit") { // lire //std::getline(*aServerStream, output); @@ -67,7 +68,10 @@ GUIServer::exec() { // analyser //std::cout << output << ":" << output.length() << std::endl; + aServerStream->parse(); + + /* if ( output.find("call ") == 0 ) { callid = outgoingCall(output.substr(5,output.size()-5)); if ( callid ) { @@ -85,11 +89,11 @@ GUIServer::exec() { status += " Hangup."; displayStatus(status); } - + */ // repondre //*aServerStream << output.length() << std::endl; } - delete lexer; + delete aServerStream; std::cout << "end of connection\n"; } diff --git a/src/gui/server/lex.yy.cc b/src/gui/server/lex.yy.cc index 5507d14f203b9ee1c9cdf60bd9ba40227cf26d58..c1387392b28cfb39b65702dc3d064cb2388be93f 100644 --- a/src/gui/server/lex.yy.cc +++ b/src/gui/server/lex.yy.cc @@ -235,7 +235,7 @@ typedef unsigned char YY_CHAR; #define yytext_ptr yytext #define YY_INTERACTIVE -#include <FlexLexer.h> +#include "FlexLexer.h" /* Done after the current pattern has been matched and before the @@ -370,11 +370,19 @@ static yyconst short int yy_chk[111] = #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "y.tab.h" +#include "protocol.tab.h" extern YYSTYPE yylval; #define YY_FATAL_ERROR +#define YY_DECL int yyFlexLexer::yylex( void * ) +#define YY_MAIN 0 -#line 378 "lex.yy.cc" +struct parser_control +{ + int nastiness; + int randomness; +}; + +#line 386 "lex.yy.cc" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -501,9 +509,9 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 12 "protocol.l" +#line 20 "protocol.l" -#line 507 "lex.yy.cc" +#line 515 "lex.yy.cc" if ( yy_init ) { @@ -588,95 +596,95 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 13 "protocol.l" +#line 21 "protocol.l" return AROBASE; YY_BREAK case 2: YY_RULE_SETUP -#line 14 "protocol.l" -yylval.number=atoi(yytext); return NUMBER; +#line 22 "protocol.l" +return NUMBER; YY_BREAK case 3: YY_RULE_SETUP -#line 15 "protocol.l" +#line 23 "protocol.l" return SIP_URL_PREFIX; YY_BREAK case 4: YY_RULE_SETUP -#line 16 "protocol.l" +#line 24 "protocol.l" return TOKEN_VOICEMAIL; YY_BREAK case 5: YY_RULE_SETUP -#line 17 "protocol.l" +#line 25 "protocol.l" return TOKEN_RECEPTION; YY_BREAK case 6: YY_RULE_SETUP -#line 18 "protocol.l" +#line 26 "protocol.l" return TOKEN_ALL; YY_BREAK case 7: YY_RULE_SETUP -#line 19 "protocol.l" +#line 27 "protocol.l" return TOKEN_GET; YY_BREAK case 8: YY_RULE_SETUP -#line 20 "protocol.l" +#line 28 "protocol.l" return TOKEN_SET; YY_BREAK case 9: YY_RULE_SETUP -#line 21 "protocol.l" +#line 29 "protocol.l" return CMD_CALL; YY_BREAK case 10: YY_RULE_SETUP -#line 22 "protocol.l" +#line 30 "protocol.l" return CMD_HANGUP; YY_BREAK case 11: YY_RULE_SETUP -#line 23 "protocol.l" +#line 31 "protocol.l" return CMD_HOLD; YY_BREAK case 12: YY_RULE_SETUP -#line 24 "protocol.l" +#line 32 "protocol.l" return CMD_TRANSFER; YY_BREAK case 13: YY_RULE_SETUP -#line 25 "protocol.l" +#line 33 "protocol.l" return CMD_QUIT; YY_BREAK case 14: YY_RULE_SETUP -#line 26 "protocol.l" +#line 34 "protocol.l" return CMD_CONFIG; YY_BREAK case 15: YY_RULE_SETUP -#line 27 "protocol.l" -yylval.username=strdup(yytext); return USERNAME; +#line 35 "protocol.l" +return USERNAME; YY_BREAK case 16: YY_RULE_SETUP -#line 28 "protocol.l" +#line 36 "protocol.l" /* ignore */ YY_BREAK case 17: YY_RULE_SETUP -#line 29 "protocol.l" +#line 37 "protocol.l" /* ignore blanks */ YY_BREAK case 18: YY_RULE_SETUP -#line 30 "protocol.l" +#line 38 "protocol.l" ECHO; YY_BREAK -#line 680 "lex.yy.cc" +#line 688 "lex.yy.cc" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1481,5 +1489,5 @@ int main() return 0; } #endif -#line 30 "protocol.l" +#line 38 "protocol.l" diff --git a/src/zeroconf/DNSService.h b/src/zeroconf/DNSService.h index 8e602c16f5c5f3277bc66088058ec185cd27f886..f832eb849160928cdafb371b495bf04eb8fdec97 100644 --- a/src/zeroconf/DNSService.h +++ b/src/zeroconf/DNSService.h @@ -63,7 +63,6 @@ private: std::list<std::string> _regtypeList; }; - void DNSServiceAddServicesCallback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex,