Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
7055c0d1
Commit
7055c0d1
authored
19 years ago
by
yanmorin
Browse files
Options
Downloads
Patches
Plain Diff
New GuiServer.cpp than handle request Don't compile yet...
parent
ff6ef65f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/gui/server/Makefile.am
+1
-3
1 addition, 3 deletions
src/gui/server/Makefile.am
src/gui/server/guiserver.cpp
+13
-12
13 additions, 12 deletions
src/gui/server/guiserver.cpp
src/gui/server/guiserver.h
+50
-12
50 additions, 12 deletions
src/gui/server/guiserver.h
with
64 additions
and
27 deletions
src/gui/server/Makefile.am
+
1
−
3
View file @
7055c0d1
...
...
@@ -2,9 +2,7 @@ noinst_LTLIBRARIES = libsflphoneguiserver.la
libsflphoneguiserver_la_SOURCES
=
\
$(
BUILT_SOURCES
)
\
guiserver.cpp
\
lex.yy.cc
\
protocol.tab.cc
guiserver.cpp
libsflphoneguiserver_la_CXXFLAGS
=
-DPREFIX
=
\"
$(
prefix
)
\"
-DPROGSHAREDIR
=
\"
${
datadir
}
/sflphone
\"
libsflphoneguiserver_la_LIBADD
=
...
...
This diff is collapsed.
Click to expand it.
src/gui/server/guiserver.cpp
+
13
−
12
View file @
7055c0d1
...
...
@@ -20,9 +20,6 @@
#include
"guiserver.h"
#include
<string>
#include
<iostream>
#include
"protocol.tab.h"
// need by TCPStreamLexer.h but can't put in it
#include
"TCPStreamLexer.h"
// default constructor
GUIServer
::
GUIServer
()
...
...
@@ -41,12 +38,12 @@ GUIServer::exec() {
//Creating a listening socket.
ost
::
TCPSocket
aServer
(
addr
,
3999
);
RequestFactory
factory
;
Request
*
request
;
std
::
cout
<<
"listening on "
<<
aServer
.
getLocal
()
<<
":"
<<
3999
<<
std
::
endl
;
int
callid
;
std
::
string
status
;
std
::
string
output
;
while
(
std
::
cin
.
good
())
{
// waiting for a new connection
...
...
@@ -54,22 +51,26 @@ GUIServer::exec() {
//I'm accepting an incomming connection
aServerStream
=
new
TCPStream
Lexer
(
aServer
,
this
);
aServerStream
=
new
ost
::
TCPStream
(
aServer
);
// wait for the first message
std
::
cout
<<
"accepting connection..."
<<
std
::
endl
;
std
::
string
output
;
*
aServerStream
<<
"Welcome to this serveur2"
<<
std
::
endl
;
output
=
""
;
while
(
aServerStream
->
good
()
&&
output
!=
"quit"
)
{
// lire
//std::getline(*aServerStream, output);
std
::
getline
(
*
aServerStream
,
output
);
//_eventList.push_back(Event(output));
// analyser
//std::cout << output << ":" << output.length() << std::endl;
std
::
cout
<<
output
<<
":"
<<
output
.
length
()
<<
std
::
endl
;
request
=
factory
.
createNewRequest
(
output
);
request
->
execute
();
delete
request
;
aServerStream
->
parse
();
//
aServerStream->parse();
/*
if ( output.find("call ") == 0 ) {
...
...
@@ -91,7 +92,7 @@ GUIServer::exec() {
}
*/
// repondre
//
*aServerStream << output.length() << std::endl;
*
aServerStream
<<
output
.
length
()
<<
std
::
endl
;
}
delete
aServerStream
;
...
...
This diff is collapsed.
Click to expand it.
src/gui/server/guiserver.h
+
50
−
12
View file @
7055c0d1
...
...
@@ -23,22 +23,61 @@
#include
<string>
#include
<list>
#include
<cc++/socket.h>
#include
<map>
class
Event
{
class
Request
{
public:
Event
();
Event
(
const
std
::
string
&
event
)
{
_message
=
event
;
Request
(
const
std
::
string
&
cseq
)
{
_cseq
=
cseq
;
}
virtual
~
Request
(){}
virtual
std
::
string
execute
();
std
::
string
error
(
const
std
::
string
&
code
,
const
std
::
string
&
error
)
{
std
::
string
returnError
=
code
+
" "
+
_cseq
+
" "
+
error
;
return
returnError
;
}
~
Event
()
{}
private
:
std
::
string
_cseq
;
std
::
string
_callid
;
std
::
string
_message
;
};
typedef
std
::
list
<
Event
>
EventList
;
class
TCPStreamLexer
;
class
RequestCall
:
public
Request
{
public:
RequestCall
(
const
std
::
string
&
cseq
)
:
Request
(
cseq
)
{}
~
RequestCall
()
{}
std
::
string
execute
()
{
return
""
;
}
};
class
RequestSyntaxError
:
public
Request
{
public:
RequestSyntaxError
(
const
std
::
string
&
cseq
=
"seq0"
)
:
Request
(
cseq
)
{}
~
RequestSyntaxError
()
{}
std
::
string
execute
()
{
return
error
(
"501"
,
"Syntax Error"
);
}
};
class
RequestFactory
{
public:
RequestFactory
(){
}
~
RequestFactory
(){
}
Request
*
createNewRequest
(
const
std
::
string
&
requestLine
)
{
int
spacePos
=
requestLine
.
find
(
' '
);
// we find a spacePos
if
(
spacePos
!=
-
1
)
{
return
new
RequestSyntaxError
();
}
}
};
class
GUIServer
:
public
GuiFramework
{
public:
// GUIServer constructor
...
...
@@ -49,7 +88,6 @@ public:
// exec loop
int
exec
(
void
);
// Reimplementation of virtual functions
virtual
int
incomingCall
(
short
id
);
virtual
void
peerAnsweredCall
(
short
id
);
...
...
@@ -68,8 +106,8 @@ public:
virtual
void
stopVoiceMessageNotification
(
void
);
private:
EventList
_eventList
;
TCPStreamLexer
*
aServerStream
;
ost
::
TCPStream
*
aServerStream
;
std
::
map
<
std
::
string
,
Request
*>
_requestMap
;
};
#endif // __GUI_SERVER_H__
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment