From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../src/net/?hideattic=0&sortby=author/index.html | 302 ++++ .../src/net/?hideattic=0&sortby=date/index.html | 302 ++++ .../nel/src/net/?hideattic=0&sortby=rev/index.html | 302 ++++ .../code/nel/src/net/?sortby=date/index.html | 219 +++ .../code/nel/src/net/?sortby=log/index.html | 219 +++ .../code/nel/src/net/?sortby=rev/index.html | 219 +++ .../code/nel/src/net/CVS/?sortby=date/index.html | 75 + .../code/nel/src/net/Makefile.am?sortby=date | 333 +++++ .../code/nel/src/net/buf_client.cpp?sortby=date | 296 ++++ .../x-cvsweb-markup&sortby=date/index.html | 1083 ++++++++++++++ .../code/nel/src/net/buf_server.cpp?sortby=date | 456 ++++++ .../code/nel/src/net/buf_sock.cpp?sortby=date | 406 ++++++ .../nel/src/net/callback_client.cpp?sortby=date | 379 +++++ .../x-cvsweb-markup&sortby=date/index.html | 556 ++++++++ .../nel/src/net/callback_net_base.cpp?sortby=date | 469 +++++++ .../nel/src/net/callback_server.cpp?sortby=date | 359 +++++ .../x-cvsweb-markup&sortby=date/index.html | 452 ++++++ .../code/nel/src/net/inet_address.cpp?sortby=date | 533 +++++++ .../code/nel/src/net/listen_sock.cpp?sortby=date | 196 +++ .../code/nel/src/net/login_client.cpp?sortby=date | 276 ++++ .../code/nel/src/net/login_cookie.cpp?sortby=date | 166 +++ .../x-cvsweb-markup&sortby=date/index.html | 506 +++++++ .../code/nel/src/net/login_server.cpp?sortby=date | 296 ++++ .../x-cvsweb-markup&sortby=date/index.html | 343 +++++ .../nel/src/net/message_recorder.cpp?sortby=date | 196 +++ .../x-cvsweb-markup&sortby=date/index.html | 569 ++++++++ .../code/nel/src/net/net_manager.cpp?sortby=date | 356 +++++ .../x-cvsweb-markup&sortby=date/index.html | 1475 ++++++++++++++++++++ .../x-cvsweb-markup&sortby=date/index.html | 15 + .../code/nel/src/net/tcp_sock.cpp?sortby=date | 206 +++ .../x-cvsweb-markup&sortby=date/index.html | 414 ++++++ .../nel/src/net/transport_class.cpp?sortby=date | 251 ++++ .../x-cvsweb-markup&sortby=date/index.html | 220 +++ .../code/nel/src/net/udp_sock.cpp?sortby=date | 246 ++++ .../nel/src/net/unified_network.cpp?sortby=date | 570 ++++++++ .../x-cvsweb-markup&sortby=date/index.html | 397 ++++++ .../code/nel/src/net/unitime.cpp?sortby=date | 461 ++++++ 37 files changed, 14119 insertions(+) create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=author/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=rev/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/?sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/?sortby=log/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/?sortby=rev/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/CVS/?sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/Makefile.am?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/buf_client.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?rev=1.32&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/buf_sock.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/callback_client.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?rev=1.33&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/callback_server.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?rev=1.38&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/listen_sock.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/login_client.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/login_cookie.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?rev=1.16&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/message.cpp?rev=1.21&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/message_recorder.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/naming_client.cpp?rev=1.48&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/net_manager.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/service.cpp?rev=1.136&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/stdnet.cpp?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/tcp_sock.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?rev=1.12&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?rev=1.11&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/unified_network.cpp?sortby=date create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?rev=1.31&content-type=text/x-cvsweb-markup&sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?sortby=date (limited to 'cvs/cvsweb.cgi/code/nel/src/net') diff --git a/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=author/index.html b/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=author/index.html new file mode 100644 index 00000000..44f1a3b1 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=author/index.html @@ -0,0 +1,302 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + CVS/ +    
[TXT] + Makefile.am + 1.18  2 months cado  Removed stream_client and stream_server +
[TXT] + udp_sock.cpp + 1.11  3 months cado  BUGFIX: wrong address +
[TXT] + Jamfile + 1.1  5 months lecroart  ADDED: Jam compile system +
[TXT] + base_socket.cpp + (in the Attic) [Hide] 1.49  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + buf_client.cpp + 1.16  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_net_base.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + buf_server.cpp + 1.32  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_sock.cpp + 1.27  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + callback_client.cpp + 1.24  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_net_base.cpp + 1.33  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_server.cpp + 1.22  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + cubic_entity_interpolator.cpp + (in the Attic) [Hide] 1.11  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + datagram_socket.cpp + (in the Attic) [Hide] 1.7  21 months cado  Layer1 = CBaseSocket, +Layer2 = CSocket, +Layer 3 = CMsgSocket ; +Removed CDatagram...
[TXT] + dummy_tcp_sock.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + inet_address.cpp + 1.38  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + linear_entity_interpolator.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + listen_sock.cpp + 1.6  4 months lecroart  CHANGED: removed some debug info +
[TXT] + local_area.cpp + (in the Attic) [Hide] 1.40  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + local_entity.cpp + (in the Attic) [Hide] 1.26  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + login_client.cpp + 1.14  5 months lecroart  CHANGED: remove nlsleep(0) and set to 10 +
[TXT] + login_cookie.cpp + 1.3  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + login_server.cpp + 1.16  4 months lecroart  CHANGED: unified the command format +
[TXT] + message.cpp + 1.21  2 weeks lecroart  REMOVE: a warning +
[TXT] + message_recorder.cpp + 1.6  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + moving_entity.cpp + (in the Attic) [Hide] 1.14  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + msg_client.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_net_base.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_server.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_socket.cpp + (in the Attic) [Hide] 1.59  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + naming_client.cpp + 1.48  10 days lecroart  ADDED: quit if the NS ask it +
[TXT] + net_displayer.cpp + 1.21  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_log.cpp + 1.12  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_manager.cpp + 1.22  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + network.dsp + (in the Attic) [Hide] 1.2  22 months cado  Changed some .dsp names +
[TXT] + new_message.cpp + (in the Attic) [Hide] 1.2  16 months lecroart  no message +
[TXT] + new_service.cpp + (in the Attic) [Hide] 1.12  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + pt_callback_item.cpp + (in the Attic) [Hide] 1.4  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + remote_entity.cpp + (in the Attic) [Hide] 1.17  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + replica.cpp + (in the Attic) [Hide] 1.6  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + service.cpp + 1.137  3 days lecroart  ADDED: lot of debug info to know why a service quit +
[TXT] + service_5.cpp + (in the Attic) [Hide] 1.24  4 months lecroart  ADDED: merge service_5 and add args management +
[TXT] + sock.cpp + 1.21  6 weeks lecroart  ADDED: quicker +
[TXT] + socket.cpp + (in the Attic) [Hide] 1.44  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + stdnet.cpp + 1.1  6 months lecroart  ADDED: pch +
[TXT] + stdnet.h + 1.3  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + stream_client.cpp + (in the Attic) [Hide] 1.8  2 months lecroart  REMOVED: not useful +
[TXT] + stream_server.cpp + (in the Attic) [Hide] 1.8  2 months lecroart  REMOVED: not useful +
[TXT] + tcp_sock.cpp + 1.7  4 months lecroart  CHANGED: removed some debug info +
[TXT] + unified_network.cpp + 1.44  2 days lecroart  ADDED: stop check if the fucking assert occurs +
[TXT] + unitime.cpp + 1.31  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + transport_class.cpp + 1.12  3 weeks miller  bug fix by Vianney +

+ + +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=date/index.html new file mode 100644 index 00000000..5ba22406 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=date/index.html @@ -0,0 +1,302 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + CVS/ +    
[TXT] + base_socket.cpp + (in the Attic) [Hide] 1.49  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + cubic_entity_interpolator.cpp + (in the Attic) [Hide] 1.11  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + datagram_socket.cpp + (in the Attic) [Hide] 1.7  21 months cado  Layer1 = CBaseSocket, +Layer2 = CSocket, +Layer 3 = CMsgSocket ; +Removed CDatagram...
[TXT] + unified_network.cpp + 1.44  2 days lecroart  ADDED: stop check if the fucking assert occurs +
[TXT] + service.cpp + 1.137  3 days lecroart  ADDED: lot of debug info to know why a service quit +
[TXT] + naming_client.cpp + 1.48  10 days lecroart  ADDED: quit if the NS ask it +
[TXT] + message.cpp + 1.21  2 weeks lecroart  REMOVE: a warning +
[TXT] + transport_class.cpp + 1.12  3 weeks miller  bug fix by Vianney +
[TXT] + buf_client.cpp + 1.16  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_server.cpp + 1.32  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_sock.cpp + 1.27  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + sock.cpp + 1.21  6 weeks lecroart  ADDED: quicker +
[TXT] + callback_client.cpp + 1.24  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_net_base.cpp + 1.33  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_server.cpp + 1.22  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + net_manager.cpp + 1.22  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + Makefile.am + 1.18  2 months cado  Removed stream_client and stream_server +
[TXT] + message_recorder.cpp + 1.6  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + stdnet.h + 1.3  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + udp_sock.cpp + 1.11  3 months cado  BUGFIX: wrong address +
[TXT] + login_server.cpp + 1.16  4 months lecroart  CHANGED: unified the command format +
[TXT] + listen_sock.cpp + 1.6  4 months lecroart  CHANGED: removed some debug info +
[TXT] + tcp_sock.cpp + 1.7  4 months lecroart  CHANGED: removed some debug info +
[TXT] + Jamfile + 1.1  5 months lecroart  ADDED: Jam compile system +
[TXT] + login_client.cpp + 1.14  5 months lecroart  CHANGED: remove nlsleep(0) and set to 10 +
[TXT] + stdnet.cpp + 1.1  6 months lecroart  ADDED: pch +
[TXT] + dummy_tcp_sock.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + inet_address.cpp + 1.38  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + linear_entity_interpolator.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + local_entity.cpp + (in the Attic) [Hide] 1.26  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + login_cookie.cpp + 1.3  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + buf_net_base.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + local_area.cpp + (in the Attic) [Hide] 1.40  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + moving_entity.cpp + (in the Attic) [Hide] 1.14  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + msg_client.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_net_base.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_server.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_socket.cpp + (in the Attic) [Hide] 1.59  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + net_displayer.cpp + 1.21  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_log.cpp + 1.12  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + network.dsp + (in the Attic) [Hide] 1.2  22 months cado  Changed some .dsp names +
[TXT] + new_message.cpp + (in the Attic) [Hide] 1.2  16 months lecroart  no message +
[TXT] + new_service.cpp + (in the Attic) [Hide] 1.12  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + pt_callback_item.cpp + (in the Attic) [Hide] 1.4  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + remote_entity.cpp + (in the Attic) [Hide] 1.17  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + replica.cpp + (in the Attic) [Hide] 1.6  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + service_5.cpp + (in the Attic) [Hide] 1.24  4 months lecroart  ADDED: merge service_5 and add args management +
[TXT] + socket.cpp + (in the Attic) [Hide] 1.44  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + stream_client.cpp + (in the Attic) [Hide] 1.8  2 months lecroart  REMOVED: not useful +
[TXT] + stream_server.cpp + (in the Attic) [Hide] 1.8  2 months lecroart  REMOVED: not useful +
[TXT] + unitime.cpp + 1.31  6 months lecroart  ADDED: support of precompilated header on visual +

+ + +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=rev/index.html b/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=rev/index.html new file mode 100644 index 00000000..7d7bb140 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/?hideattic=0&sortby=rev/index.html @@ -0,0 +1,302 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + CVS/ +    
[TXT] + base_socket.cpp + (in the Attic) [Hide] 1.49  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + cubic_entity_interpolator.cpp + (in the Attic) [Hide] 1.11  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + datagram_socket.cpp + (in the Attic) [Hide] 1.7  21 months cado  Layer1 = CBaseSocket, +Layer2 = CSocket, +Layer 3 = CMsgSocket ; +Removed CDatagram...
[TXT] + inet_address.cpp + 1.38  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + callback_net_base.cpp + 1.33  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + buf_server.cpp + 1.32  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_sock.cpp + 1.27  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + callback_client.cpp + 1.24  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_server.cpp + 1.22  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + linear_entity_interpolator.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + local_area.cpp + (in the Attic) [Hide] 1.40  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + local_entity.cpp + (in the Attic) [Hide] 1.26  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + message.cpp + 1.21  2 weeks lecroart  REMOVE: a warning +
[TXT] + moving_entity.cpp + (in the Attic) [Hide] 1.14  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + msg_client.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_net_base.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_server.cpp + (in the Attic) [Hide] 1.2  14 months lecroart  REMOVED: these files are out of date +
[TXT] + msg_socket.cpp + (in the Attic) [Hide] 1.59  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + naming_client.cpp + 1.48  10 days lecroart  ADDED: quit if the NS ask it +
[TXT] + net_manager.cpp + 1.22  6 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + net_displayer.cpp + 1.21  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + network.dsp + (in the Attic) [Hide] 1.2  22 months cado  Changed some .dsp names +
[TXT] + new_message.cpp + (in the Attic) [Hide] 1.2  16 months lecroart  no message +
[TXT] + new_service.cpp + (in the Attic) [Hide] 1.12  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + pt_callback_item.cpp + (in the Attic) [Hide] 1.4  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + remote_entity.cpp + (in the Attic) [Hide] 1.17  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + replica.cpp + (in the Attic) [Hide] 1.6  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + service.cpp + 1.137  3 days lecroart  ADDED: lot of debug info to know why a service quit +
[TXT] + service_5.cpp + (in the Attic) [Hide] 1.24  4 months lecroart  ADDED: merge service_5 and add args management +
[TXT] + unified_network.cpp + 1.44  2 days lecroart  ADDED: stop check if the fucking assert occurs +
[TXT] + unitime.cpp + 1.31  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + sock.cpp + 1.21  6 weeks lecroart  ADDED: quicker +
[TXT] + Makefile.am + 1.18  2 months cado  Removed stream_client and stream_server +
[TXT] + buf_client.cpp + 1.16  3 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + login_server.cpp + 1.16  4 months lecroart  CHANGED: unified the command format +
[TXT] + login_client.cpp + 1.14  5 months lecroart  CHANGED: remove nlsleep(0) and set to 10 +
[TXT] + net_log.cpp + 1.12  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + transport_class.cpp + 1.12  3 weeks miller  bug fix by Vianney +
[TXT] + udp_sock.cpp + 1.11  3 months cado  BUGFIX: wrong address +
[TXT] + tcp_sock.cpp + 1.7  4 months lecroart  CHANGED: removed some debug info +
[TXT] + listen_sock.cpp + 1.6  4 months lecroart  CHANGED: removed some debug info +
[TXT] + message_recorder.cpp + 1.6  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + buf_net_base.cpp + 1.5  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + dummy_tcp_sock.cpp + 1.5  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + login_cookie.cpp + 1.3  7 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + Jamfile + 1.1  5 months lecroart  ADDED: Jam compile system +
[TXT] + socket.cpp + (in the Attic) [Hide] 1.44  14 months lecroart  ADD: new version of the network system (in NeL and NeLns) +
[TXT] + stdnet.h + 1.3  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + stdnet.cpp + 1.1  6 months lecroart  ADDED: pch +
[TXT] + stream_client.cpp + (in the Attic) [Hide] 1.8  2 months lecroart  REMOVED: not useful +
[TXT] + stream_server.cpp + (in the Attic) [Hide] 1.8  2 months lecroart  REMOVED: not useful +

+ + +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/?sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/?sortby=date/index.html new file mode 100644 index 00000000..4c203e20 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/?sortby=date/index.html @@ -0,0 +1,219 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + Attic/[Don't hide]    
[DIR] + CVS/ +    
[TXT] + service.cpp + 1.136  3 days lecroart  ADDED: exit and freeze +
[TXT] + naming_client.cpp + 1.48  3 days lecroart  ADDED: quit if the NS ask it +
[TXT] + message.cpp + 1.21  11 days lecroart  REMOVE: a warning +
[TXT] + transport_class.cpp + 1.12  2 weeks miller  bug fix by Vianney +
[TXT] + buf_client.cpp + 1.16  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_server.cpp + 1.32  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_sock.cpp + 1.27  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + unified_network.cpp + 1.42  2 weeks legros  FIXED: unicallback not called on not shard service relogging +
[TXT] + sock.cpp + 1.21  5 weeks lecroart  ADDED: quicker +
[TXT] + callback_client.cpp + 1.24  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_net_base.cpp + 1.33  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_server.cpp + 1.22  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + net_manager.cpp + 1.22  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + Makefile.am + 1.18  2 months cado  Removed stream_client and stream_server +
[TXT] + message_recorder.cpp + 1.6  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + stdnet.h + 1.3  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + udp_sock.cpp + 1.11  3 months cado  BUGFIX: wrong address +
[TXT] + login_server.cpp + 1.16  3 months lecroart  CHANGED: unified the command format +
[TXT] + listen_sock.cpp + 1.6  4 months lecroart  CHANGED: removed some debug info +
[TXT] + tcp_sock.cpp + 1.7  4 months lecroart  CHANGED: removed some debug info +
[TXT] + Jamfile + 1.1  5 months lecroart  ADDED: Jam compile system +
[TXT] + login_client.cpp + 1.14  5 months lecroart  CHANGED: remove nlsleep(0) and set to 10 +
[TXT] + stdnet.cpp + 1.1  6 months lecroart  ADDED: pch +
[TXT] + dummy_tcp_sock.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + inet_address.cpp + 1.38  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + login_cookie.cpp + 1.3  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_displayer.cpp + 1.21  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_log.cpp + 1.12  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + unitime.cpp + 1.31  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + buf_net_base.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +

+ +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/?sortby=log/index.html b/cvs/cvsweb.cgi/code/nel/src/net/?sortby=log/index.html new file mode 100644 index 00000000..89d94c45 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/?sortby=log/index.html @@ -0,0 +1,219 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + Attic/[Don't hide]    
[DIR] + CVS/ +    
[TXT] + Jamfile + 1.1  5 months lecroart  ADDED: Jam compile system +
[TXT] + callback_client.cpp + 1.24  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_net_base.cpp + 1.33  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_server.cpp + 1.22  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + net_manager.cpp + 1.22  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + service.cpp + 1.136  3 days lecroart  ADDED: exit and freeze +
[TXT] + stdnet.cpp + 1.1  6 months lecroart  ADDED: pch +
[TXT] + sock.cpp + 1.21  5 weeks lecroart  ADDED: quicker +
[TXT] + naming_client.cpp + 1.48  3 days lecroart  ADDED: quit if the NS ask it +
[TXT] + buf_net_base.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + dummy_tcp_sock.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + inet_address.cpp + 1.38  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + login_cookie.cpp + 1.3  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_displayer.cpp + 1.21  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + net_log.cpp + 1.12  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + unitime.cpp + 1.31  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + udp_sock.cpp + 1.11  3 months cado  BUGFIX: wrong address +
[TXT] + buf_client.cpp + 1.16  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_server.cpp + 1.32  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + buf_sock.cpp + 1.27  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + login_client.cpp + 1.14  5 months lecroart  CHANGED: remove nlsleep(0) and set to 10 +
[TXT] + listen_sock.cpp + 1.6  4 months lecroart  CHANGED: removed some debug info +
[TXT] + tcp_sock.cpp + 1.7  4 months lecroart  CHANGED: removed some debug info +
[TXT] + message_recorder.cpp + 1.6  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + stdnet.h + 1.3  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + login_server.cpp + 1.16  3 months lecroart  CHANGED: unified the command format +
[TXT] + unified_network.cpp + 1.42  2 weeks legros  FIXED: unicallback not called on not shard service relogging +
[TXT] + message.cpp + 1.21  11 days lecroart  REMOVE: a warning +
[TXT] + Makefile.am + 1.18  2 months cado  Removed stream_client and stream_server +
[TXT] + transport_class.cpp + 1.12  2 weeks miller  bug fix by Vianney +

+ +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/?sortby=rev/index.html b/cvs/cvsweb.cgi/code/nel/src/net/?sortby=rev/index.html new file mode 100644 index 00000000..dafecf73 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/?sortby=rev/index.html @@ -0,0 +1,219 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + Attic/[Don't hide]    
[DIR] + CVS/ +    
[TXT] + service.cpp + 1.136  3 days lecroart  ADDED: exit and freeze +
[TXT] + naming_client.cpp + 1.48  3 days lecroart  ADDED: quit if the NS ask it +
[TXT] + unified_network.cpp + 1.42  2 weeks legros  FIXED: unicallback not called on not shard service relogging +
[TXT] + inet_address.cpp + 1.38  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + callback_net_base.cpp + 1.33  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + buf_server.cpp + 1.32  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + unitime.cpp + 1.31  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + buf_sock.cpp + 1.27  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + callback_client.cpp + 1.24  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + callback_server.cpp + 1.22  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + net_manager.cpp + 1.22  5 weeks lecroart  ADDED: changed NULL into InvalidSockId +
[TXT] + message.cpp + 1.21  11 days lecroart  REMOVE: a warning +
[TXT] + net_displayer.cpp + 1.21  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + sock.cpp + 1.21  5 weeks lecroart  ADDED: quicker +
[TXT] + Makefile.am + 1.18  2 months cado  Removed stream_client and stream_server +
[TXT] + buf_client.cpp + 1.16  2 weeks lecroart  CHANGED: commented some nldebug for performance +
[TXT] + login_server.cpp + 1.16  3 months lecroart  CHANGED: unified the command format +
[TXT] + login_client.cpp + 1.14  5 months lecroart  CHANGED: remove nlsleep(0) and set to 10 +
[TXT] + net_log.cpp + 1.12  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + transport_class.cpp + 1.12  2 weeks miller  bug fix by Vianney +
[TXT] + udp_sock.cpp + 1.11  3 months cado  BUGFIX: wrong address +
[TXT] + tcp_sock.cpp + 1.7  4 months lecroart  CHANGED: removed some debug info +
[TXT] + listen_sock.cpp + 1.6  4 months lecroart  CHANGED: removed some debug info +
[TXT] + message_recorder.cpp + 1.6  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + buf_net_base.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + dummy_tcp_sock.cpp + 1.5  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + login_cookie.cpp + 1.3  6 months lecroart  ADDED: support of precompilated header on visual +
[TXT] + stdnet.h + 1.3  2 months lecroart  CHANGED: serial/send/receive 3 time faster +
[TXT] + Jamfile + 1.1  5 months lecroart  ADDED: Jam compile system +
[TXT] + stdnet.cpp + 1.1  6 months lecroart  ADDED: pch +

+ +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/CVS/?sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/CVS/?sortby=date/index.html new file mode 100644 index 00000000..c06c2144 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/CVS/?sortby=date/index.html @@ -0,0 +1,75 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / src / net / CVS
+ + + + + +
File
[BACK] + Previous Directory +
+ +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/Makefile.am?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/Makefile.am?sortby=date new file mode 100644 index 00000000..8411717a --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/Makefile.am?sortby=date @@ -0,0 +1,333 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / Makefile.am
+ + + + + +
Makefile.am
+

+

Default branch: MAIN
+


+ Revision 1.18 / (download) - annotate - [select for diffs] +, Wed May 22 09:59:16 2002 UTC (2 months, 1 week ago) by cado +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.17: +1 -3 + lines
Diff to previous 1.17 +

+Removed stream_client and stream_server
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Mon Mar 25 10:39:55 2002 UTC (4 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.16: +1 -2 + lines
Diff to previous 1.16 +

+CHANGED: don't need service5.cpp
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Mar 19 17:42:48 2002 UTC (4 months, 1 week ago) by valignat +
Branch: MAIN + +
Changes since 1.15: +3 -1 + lines
Diff to previous 1.15 +

+Applied patches which help to have a clen install on GNU/Linux and to make a Debian package (changes on the management of config and log files, bugfixes, etc ...)
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Fri Feb 15 14:40:21 2002 UTC (5 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +3 -2 + lines
Diff to previous 1.14 +

+ADDED: transport class
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Tue Oct 16 12:20:05 2001 UTC (9 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.13: +4 -2 + lines
Diff to previous 1.13 +

+ADDING: layer5 files in makefile
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Tue Aug 28 13:00:20 2001 UTC (11 months ago) by valignat +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.12: +2 -2 + lines
Diff to previous 1.12 +

+ADDED a missing -lpthread to NeLs liking arguments.
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Fri Jul 27 17:25:40 2001 UTC (12 months ago) by valignat +
Branch: MAIN + +
Changes since 1.11: +3 -1 + lines
Diff to previous 1.11 +

+FIXED a NeL compilation problem, know the compilation works with AND without VPATH.
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Wed Jun 27 18:15:06 2001 UTC (13 months ago) by valignat +
Branch: MAIN + +
Changes since 1.10: +27 -9 + lines
Diff to previous 1.10 +

+# FIXED: add some forgotten source files in the list of files to compile.
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Thu May 10 13:00:50 2001 UTC (14 months, 2 weeks ago) by valignat +
Branch: MAIN + +
Changes since 1.9: +5 -5 + lines
Diff to previous 1.9 +

+REMOVED msg_client.cpp msg_net_base.cpp msg_server.cpp from NeL's network Makefile.am
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.8: +9 -9 + lines
Diff to previous 1.8 +

+ADD: new version of the network system (in NeL and NeLns)
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Mon Mar 5 09:32:58 2001 UTC (16 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: net_0_1 +
Changes since 1.7: +2 -2 + lines
Diff to previous 1.7 +

+remove the new_mesasge from the makefile
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Fri Feb 23 12:52:22 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.6: +3 -2 + lines
Diff to previous 1.6 +

+ADD: callback* new_service.cpp
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Wed Jan 24 14:09:53 2001 UTC (18 months ago) by valignat +
Branch: MAIN + +
CVS Tags: proto_0_2, +nel_0_3 +
Changes since 1.5: +3 -1 + lines
Diff to previous 1.5 +

+Add Libtool's version info flag for the Library.
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu Dec 7 15:38:10 2000 UTC (19 months, 2 weeks ago) by valignat +
Branch: MAIN + +
CVS Tags: proto_0_1, +nel_0_2 +
Changes since 1.4: +2 -2 + lines
Diff to previous 1.4 +

+Add net_log.cpp to the source file list.
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Thu Nov 30 09:31:20 2000 UTC (19 months, 4 weeks ago) by valignat +
Branch: MAIN + +
Changes since 1.3: +1 -5 + lines
Diff to previous 1.3 +

+Remove some forgoten personal hook.
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri Nov 24 17:17:23 2000 UTC (20 months ago) by valignat +
Branch: MAIN + +
Changes since 1.2: +7 -1 + lines
Diff to previous 1.2 +

+Add a hook to copy the library file in the $(top_srcdir)/lib directory at
+the end of the all target
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu Nov 23 11:51:35 2000 UTC (20 months ago) by valignat +
Branch: MAIN + +
Changes since 1.1: +14 -7 + lines
Diff to previous 1.1 +

+Add a more complete compilation system, only the generation of Makefiles and
+the compilation works but not the installation and co ...
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Fri Oct 6 14:17:35 2000 UTC (21 months, 3 weeks ago) by valignat +
Branch: MAIN + +
Diff

+Initial revision
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/buf_client.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/buf_client.cpp?sortby=date new file mode 100644 index 00000000..ca29683e --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/buf_client.cpp?sortby=date @@ -0,0 +1,296 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / buf_client.cpp
+ + + + + +
buf_client.cpp
+

+

Default branch: MAIN
+


+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Jul 2 15:56:58 2002 UTC (3 weeks, 5 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.15: +3 -3 + lines
Diff to previous 1.15 +

+CHANGED: commented some nldebug for performance
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Mon Jun 10 10:11:32 2002 UTC (6 weeks, 6 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +6 -1 + lines
Diff to previous 1.14 +

+ADDED: use of htimer
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Tue May 21 16:37:38 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.13: +25 -20 + lines
Diff to previous 1.13 +

+CHANGED: serial/send/receive 3 time faster
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.12: +3 -5 + lines
Diff to previous 1.12 +

+CHANGED: removed some debug info
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:20 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +3 -2 + lines
Diff to previous 1.11 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.10: +12 -12 + lines
Diff to previous 1.10 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:03:17 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.9: +17 -5 + lines
Diff to previous 1.9 +

+Added Layer 1 support for message recorder
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:57:09 2001 UTC (13 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.8: +2 -2 + lines
Diff to previous 1.8 +

+#Fixed a semicolon that was missing after a nlassert, so it did not compile in release mode
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:38:06 2001 UTC (13 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.7: +17 -9 + lines
Diff to previous 1.7 +

+Added support for 32-bit message length
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Thu May 24 14:17:51 2001 UTC (14 months ago) by cado +
Branch: MAIN + +
Changes since 1.6: +23 -11 + lines
Diff to previous 1.6 +

+Miscellaneous bug and doc fixes
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Mon May 21 17:02:45 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.5: +15 -1 + lines
Diff to previous 1.5 +

+Improved the receive thread termination
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu May 17 15:37:05 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.4: +3 -1 + lines
Diff to previous 1.4 +

+Added asserts on length of buffer sent
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Fri May 11 09:29:19 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.3: +3 -8 + lines
Diff to previous 1.3 +

+#Fixed the previous changes
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Thu May 10 08:49:12 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.2: +5 -11 + lines
Diff to previous 1.2 +

+Changed the way of sending : needs to be logically connected (at user level)
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu May 10 08:17:41 2001 UTC (14 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +2 -2 + lines
Diff to previous 1.1 +

+BUGFIX: disconnection callback was called with bad parameters
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?rev=1.32&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?rev=1.32&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..1fd0056b --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?rev=1.32&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,1083 @@ + + + +code/nel/src/net/buf_server.cpp - view - 1.32 + +
[BACK] Return to buf_server.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / buf_server.cpp (download)
+Revision 1.32, Tue Jul 2 15:56:58 2002 UTC (3 weeks, 5 days ago) by lecroart +
Branch: MAIN +
CVS Tags: HEAD
Changes since 1.31: +2 -2 + lines
+CHANGED: commented some nldebug for performance
+
+

/** \file buf_server.cpp
+ * Network engine, layer 1, server
+ *
+ * $Id: buf_server.cpp,v 1.32 2002/07/02 15:56:58 lecroart Exp $
+ */
+
+/* Copyright, 2001 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/misc/hierarchical_timer.h"
+
+#include "nel/net/buf_server.h"
+
+#ifdef NL_OS_WINDOWS
+#include <winsock2.h>
+//typedef sint socklen_t;
+
+#elif defined NL_OS_UNIX
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#endif
+
+
+using namespace NLMISC;
+using namespace std;
+
+namespace NLNET {
+
+
+/***************************************************************************************************
+ * User main thread (initialization)
+ **************************************************************************************************/
+
+
+/*
+ * Constructor
+ */
+CBufServer::CBufServer( TThreadStategy strategy,
+        uint16 max_threads, uint16 max_sockets_per_thread, bool nodelay, bool replaymode ) :
+        CBufNetBase(),
+        _ThreadStrategy( strategy ),
+        _NoDelay( nodelay ),
+        _MaxThreads( max_threads ),
+        _MaxSocketsPerThread( max_sockets_per_thread ),
+        _ConnectionCallback( NULL ),
+        _ConnectionCbArg( NULL ),
+        _BytesPushedOut( 0 ),
+        _BytesPoppedIn( 0 ),
+        _PrevBytesPoppedIn( 0 ),
+        _PrevBytesPushedOut( 0 ),
+        _ReplayMode( replaymode ),
+        _ListenTask( NULL ),
+        _ListenThread( NULL ),
+        _NbConnections (0),
+        _ThreadPool("CBufServer::_ThreadPool")
+{
+        nlnettrace( "CBufServer::CBufServer" );
+        if ( ! _ReplayMode )
+        {
+                _ListenTask = new CListenTask( this );
+                _ListenThread = IThread::create( _ListenTask );
+        }
+        /*{
+                CSynchronized<uint32>::CAccessor syncbpi ( &_BytesPushedIn );
+                syncbpi.value() = 0;
+        }*/
+}
+
+
+/*
+ * Listens on the specified port
+ */
+void CBufServer::init( uint16 port )
+{
+        nlnettrace( "CBufServer::init" );
+        if ( ! _ReplayMode )
+        {
+                _ListenTask->init( port );
+                _ListenThread->start();
+        }
+        else
+        {
+                nldebug( "LNETL0: Binding listen socket to any address, port %hu", port );
+        }
+}
+
+
+/*
+ * Begins to listen on the specified port (call before running thread)
+ */
+void CListenTask::init( uint16 port )
+{
+        nlnettrace( "CListenTask::init" );
+        _ListenSock.init( port );
+}
+
+
+/***************************************************************************************************
+ * User main thread (running)
+ **************************************************************************************************/
+
+
+/*
+ * Constructor
+ */
+CServerTask::CServerTask() : _ExitRequired(false)
+{
+#ifdef NL_OS_UNIX
+        pipe( _WakeUpPipeHandle );
+#endif
+}
+
+
+
+#ifdef NL_OS_UNIX
+/*
+ * Wake the thread up, when blocked in select (Unix only)
+ */
+void CServerTask::wakeUp()
+{
+        uint8 b;
+        if ( write( _WakeUpPipeHandle[PipeWrite], &b, 1 ) == -1 )
+        {
+                nldebug( "LNETL1: In CServerTask::wakeUp(): write() failed" );
+        }
+}
+#endif
+
+
+/*
+ * Destructor
+ */
+CServerTask::~CServerTask()
+{
+#ifdef NL_OS_UNIX
+        close( _WakeUpPipeHandle[PipeRead] );
+        close( _WakeUpPipeHandle[PipeWrite] );
+#endif
+}
+
+
+/*
+ * Destructor
+ */
+CBufServer::~CBufServer()
+{
+        nlnettrace( "CBufServer::~CBufServer" );
+
+        // Clean listen thread exit
+        if ( ! _ReplayMode )
+        {
+                ((CListenTask*)(_ListenThread->getRunnable()))->requireExit();
+                ((CListenTask*)(_ListenThread->getRunnable()))->close();
+#ifdef NL_OS_UNIX
+                _ListenTask->wakeUp();
+#endif
+                _ListenThread->wait();
+                delete _ListenThread;
+                delete _ListenTask;
+
+                // Clean receive thread exits
+                CThreadPool::iterator ipt;
+                {
+                        nldebug( "LNETL1: Waiting for end of threads..." );
+                        CSynchronized<CThreadPool>::CAccessor poolsync( &_ThreadPool );
+                        for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                        {
+                                // Tell the threads to exit and wake them up
+                                CServerReceiveTask *task = receiveTask(ipt);
+                                nlnettrace( "Requiring exit" );
+                                task->requireExit();
+
+                                // Wake the threads up
+        #ifdef NL_OS_UNIX
+                                task->wakeUp();
+        #else
+                                CConnections::iterator ipb;
+                                nlnettrace( "Closing sockets (Win32)" );
+                                {
+                                        CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                        {
+                                                (*ipb)->Sock->close();
+                                        }
+                                }
+        #endif
+
+                        }
+                        
+                        nlnettrace( "Waiting" );
+                        for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                        {
+                                // Wait until the threads have exited
+                                (*ipt)->wait();
+                        }
+
+                        nldebug( "LNETL1: Deleting sockets, tasks and threads..." );
+                        for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                        {
+                                // Delete the socket objects
+                                CServerReceiveTask *task = receiveTask(ipt);
+                                CConnections::iterator ipb;
+                                {
+                                        CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                        {
+                                                delete (*ipb);
+                                        }
+                                }
+
+        #ifdef NL_OS_UNIX
+                                // Under Unix, close the sockets now
+                                nlnettrace( "Closing sockets (Unix)" );
+                                {
+                                        CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                        {
+                                                (*ipb)->Sock->close();
+                                        }
+                                }
+        #endif
+                                
+                                // Delete the task objects
+                                delete task;
+
+                                // Delete the thread objects
+                                delete (*ipt);
+                        }
+                }
+        }
+
+        nlnettrace( "Exiting CBufServer::~CBufServer" );
+}
+
+
+/*
+ * Disconnect the specified host
+ * Set hostid to NULL to disconnect all connections.
+ * If hostid is not null and the socket is not connected, the method does nothing.
+ * If quick is true, any pending data will not be sent before disconnecting.
+ */
+void CBufServer::disconnect( TSockId hostid, bool quick )
+{
+        nlnettrace( "CBufServer::disconnect" );
+        if ( hostid != InvalidSockId )
+        {
+                // Disconnect only if physically connected
+                if ( hostid->Sock->connected() )
+                {
+                        if ( ! quick )
+                        {
+                                hostid->flush();
+                        }
+                        hostid->Sock->disconnect(); // the connection will be removed by the next call of update()
+                }
+        }
+        else
+        {
+                // Disconnect all
+                CThreadPool::iterator ipt;
+                {
+                        CSynchronized<CThreadPool>::CAccessor poolsync( &_ThreadPool );
+                        for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                        {
+                                CServerReceiveTask *task = receiveTask(ipt);
+                                CConnections::iterator ipb;
+                                {
+                                        CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                        {
+                                                if ( (*ipb)->Sock->connected() )
+                                                {
+                                                        if ( ! quick )
+                                                        {
+                                                                (*ipb)->flush();
+                                                        }
+                                                        (*ipb)->Sock->disconnect();
+                                                }
+                                        }
+                                }
+                        }
+                }
+        }
+}
+
+
+/*
+ * Send a message to the specified host
+ */
+void CBufServer::send( const CMemStream& buffer, TSockId hostid )
+{
+        nlnettrace( "CBufServer::send" );
+        nlassert( buffer.length() > 0);
+        nlassert( buffer.length() <= maxSentBlockSize() );
+
+        H_AUTO (CBufServer_send);
+
+        if ( hostid != InvalidSockId )
+        {
+                // debug features, we number all packet to be sure that they are all sent and received
+                // \todo remove this debug feature when ok
+//              nldebug ("send message number %u", hostid->SendNextValue);
+#ifdef NL_BIG_ENDIAN
+                uint32 val = NLMISC_BSWAP32(hostid->SendNextValue);
+#else
+                uint32 val = hostid->SendNextValue;
+#endif
+
+                *(uint32*)buffer.buffer() = val;
+                hostid->SendNextValue++;
+
+                pushBufferToHost( buffer, hostid );
+        }
+        else
+        {
+                // Push into all send queues
+                CThreadPool::iterator ipt;
+                {
+                        CSynchronized<CThreadPool>::CAccessor poolsync( &_ThreadPool );
+                        for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                        {
+                                CServerReceiveTask *task = receiveTask(ipt);
+                                CConnections::iterator ipb;
+                                {
+                                        CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                        {
+                                                // Send only if the socket is logically connected
+                                                if ( (*ipb)->connectedState() ) 
+                                                {
+                                                        // debug features, we number all packet to be sure that they are all sent and received
+                                                        // \todo remove this debug feature when ok
+//                                                      nldebug ("send message number %u", (*ipb)->SendNextValue);
+#ifdef NL_BIG_ENDIAN
+                                                        uint32 val = NLMISC_BSWAP32((*ipb)->SendNextValue);
+#else
+                                                        uint32 val = (*ipb)->SendNextValue;
+#endif
+                                                        *(uint32*)buffer.buffer() = val;
+                                                        (*ipb)->SendNextValue++;
+
+                                                        pushBufferToHost( buffer, *ipb );
+                                                }
+                                        }
+                                }
+                        }
+                }
+        }
+}
+
+
+/*
+ * Checks if there are some data to receive
+ */
+bool CBufServer::dataAvailable()
+{
+        H_AUTO (CBufServer_dataAvailable);
+        {
+                CFifoAccessor recvfifo( &receiveQueue() );
+                do
+                {
+                        // Check if the receive queue is empty
+                        if ( recvfifo.value().empty() )
+                        {
+                                return false;
+                        }
+                        else
+                        {
+                          /*sint32 mbsize = recvfifo.value().size() / 1048576;
+                          if ( mbsize > 0 )
+                            {
+                              nlwarning( "The receive queue size exceeds %d MB", mbsize );
+                            }*/
+
+                                uint8 val = recvfifo.value().frontLast();
+                                
+                                /*vector<uint8> buffer;
+                                recvfifo.value().front( buffer );*/
+
+                                // Test if it the next block is a system event
+                                //switch ( buffer[buffer.size()-1] )
+                                switch ( val )
+                                {
+                                        
+                                // Normal message available
+                                case CBufNetBase::User:
+                                        return true; // return immediatly, do not extract the message
+
+                                // Process disconnection event
+                                case CBufNetBase::Disconnection:
+                                {
+                                        vector<uint8> buffer;
+                                        recvfifo.value().front( buffer );
+
+                                        TSockId sockid = *((TSockId*)(&*buffer.begin()));
+                                        nldebug( "LNETL1: Disconnection event for %p %s", sockid, sockid->asString().c_str());
+
+                                        sockid->setConnectedState( false );
+
+                                        // Call callback if needed
+                                        if ( disconnectionCallback() != NULL )
+                                        {
+                                                disconnectionCallback()( sockid, argOfDisconnectionCallback() );
+                                        }
+
+                                        // Add socket object into the synchronized remove list
+                                        nldebug( "LNETL1: Adding the connection to the remove list" );
+                                        nlassert( ((CServerBufSock*)sockid)->ownerTask() != NULL );
+                                        ((CServerBufSock*)sockid)->ownerTask()->addToRemoveSet( sockid );
+                                        break;
+                                }
+                                // Process connection event
+                                case CBufNetBase::Connection:
+                                {
+                                        vector<uint8> buffer;
+                                        recvfifo.value().front( buffer );
+
+                                        TSockId sockid = *((TSockId*)(&*buffer.begin()));
+                                        nldebug( "LNETL1: Connection event for %p %s", sockid, sockid->asString().c_str());
+
+                                        sockid->setConnectedState( true );
+                                        
+                                        // Call callback if needed
+                                        if ( connectionCallback() != NULL )
+                                        {
+                                                connectionCallback()( sockid, argOfConnectionCallback() );
+                                        }
+                                        break;
+                                }
+                                default:
+                                        vector<uint8> buffer;
+                                        recvfifo.value().front( buffer );
+
+                                        nlinfo( "LNETL1: Invalid block type: %hu (should be = to %hu", (uint16)(buffer[buffer.size()-1]), (uint16)(val) );
+                                        nlinfo( "LNETL1: Buffer (%d B): [%s]", buffer.size(), stringFromVector(buffer).c_str() );
+                                        nlinfo( "LNETL1: Receive queue:" );
+                                        recvfifo.value().display();
+                                        nlerror( "LNETL1: Invalid system event type in server receive queue" );
+
+                                }
+
+                                // Extract system event
+                                recvfifo.value().pop();
+                        }
+                }
+                while ( true );
+        }
+}
+
+ 
+/*
+ * Receives next block of data in the specified. The length and hostid are output arguments.
+ * Precond: dataAvailable() has returned true, phostid not null
+ */
+void CBufServer::receive( CMemStream& buffer, TSockId* phostid )
+{
+        nlnettrace( "CBufServer::receive" );
+        //nlassert( dataAvailable() );
+        nlassert( phostid != NULL );
+        {
+                CFifoAccessor recvfifo( &receiveQueue() );
+                nlassert( ! recvfifo.value().empty() );
+                recvfifo.value().front( buffer );
+                recvfifo.value().pop();
+        }
+
+        // Extract hostid (and event type)
+        *phostid = *((TSockId*)&(buffer.buffer()[buffer.length()-sizeof(TSockId)-1]));
+        nlassert( buffer.buffer()[buffer.length()-1] == CBufNetBase::User );
+
+        // debug features, we number all packet to be sure that they are all sent and received
+        // \todo remove this debug feature when ok
+#ifdef NL_BIG_ENDIAN
+        uint32 val = NLMISC_BSWAP32(*(uint32*)buffer.buffer());
+#else
+        uint32 val = *(uint32*)buffer.buffer();
+#endif
+
+        //        nldebug ("receive message number %u", val);
+        if ((*phostid)->ReceiveNextValue != val)
+        {
+                nlstopex (("LNETL1: !!!LOST A MESSAGE!!! I received the message number %u but I'm waiting the message number %u (cnx %s), warn lecroart@nevrax.com with the log now please", val, (*phostid)->ReceiveNextValue, (*phostid)->asString().c_str()));
+                // resync the message number
+                (*phostid)->ReceiveNextValue = val;
+        }
+
+        (*phostid)->ReceiveNextValue++;
+
+        buffer.resize( buffer.length()-sizeof(TSockId)-1 );
+
+        // TODO OPTIM remove the nldebug for speed
+        //commented for optimisation nldebug( "LNETL1: Read buffer (%d+%d B) from %s", buffer.length(), sizeof(TSockId)+1, /*stringFromVector(buffer).c_str(), */(*phostid)->asString().c_str() );
+
+        // Statistics
+        _BytesPoppedIn += buffer.length() + sizeof(TBlockSize);
+}
+
+
+/*
+ * Update the network (call this method evenly)
+ */
+void CBufServer::update()
+{
+        //nlnettrace( "CBufServer::update-BEGIN" );
+
+        _NbConnections = 0;
+
+        // For each thread
+        CThreadPool::iterator ipt;
+        {
+          //nldebug( "UPD: Acquiring the Thread Pool" );
+                CSynchronized<CThreadPool>::CAccessor poolsync( &_ThreadPool );
+                //nldebug( "UPD: Acquired." );
+                for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                {
+                        // For each thread of the pool
+                        CServerReceiveTask *task = receiveTask(ipt);
+                        CConnections::iterator ipb;
+                        {
+                                CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                {
+                                    // For each socket of the thread, update sending
+                                    if ( ! ((*ipb)->Sock->connected() && (*ipb)->update()) )
+                                    {
+                                                // Update did not work or the socket is not connected anymore
+                                        nldebug( "LNETL1: Socket %s is disconnected", (*ipb)->asString().c_str() );
+                                                // Disconnection event if disconnected (known either from flush (in update) or when receiving data)
+                                                (*ipb)->advertiseDisconnection( this, *ipb );
+                                        
+                                                /*if ( (*ipb)->advertiseDisconnection( this, *ipb ) )
+                                                {
+                                                        // Now the connection removal is in dataAvailable()
+                                                        // POLL6
+                                                }*/
+                                    }
+                                    else
+                                    {
+                                                _NbConnections++;
+                                    }
+                                }
+                        }
+                }
+        }
+
+        //nlnettrace( "CBufServer::update-END" );
+}
+
+uint32 CBufServer::getSendQueueSize( TSockId destid )
+{
+        if ( destid != InvalidSockId )
+        {
+                return destid->SendFifo.size();
+        }
+        else
+        {
+                // add all client buffers
+
+                uint32 total = 0;
+
+                // For each thread
+                CThreadPool::iterator ipt;
+                {
+                        CSynchronized<CThreadPool>::CAccessor poolsync( &_ThreadPool );
+                        for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                        {
+                                // For each thread of the pool
+                                CServerReceiveTask *task = receiveTask(ipt);
+                                CConnections::iterator ipb;
+                                {
+                                        CSynchronized<CConnections>::CAccessor connectionssync( &task->_Connections );
+                                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                                        {
+                                                // For each socket of the thread, update sending
+                                                total = (*ipb)->SendFifo.size ();
+                                        }
+                                }
+                        }
+                }
+                return total;
+        }
+}
+
+
+/*
+ * Returns the number of bytes received since the previous call to this method
+ */
+uint64 CBufServer::newBytesReceived()
+{
+        uint64 b = bytesReceived();
+        uint64 nbrecvd = b - _PrevBytesPoppedIn;
+        //nlinfo( "b: %"NL_I64"u   new: %"NL_I64"u", b, nbrecvd );
+        _PrevBytesPoppedIn = b;
+        return nbrecvd;
+}
+
+/*
+ * Returns the number of bytes sent since the previous call to this method
+ */
+uint64 CBufServer::newBytesSent()
+{
+        uint64 b = bytesSent();
+        uint64 nbsent = b - _PrevBytesPushedOut;
+        //nlinfo( "b: %"NL_I64"u   new: %"NL_I64"u", b, nbsent );
+        _PrevBytesPushedOut = b;
+        return nbsent;
+}
+
+
+/***************************************************************************************************
+ * Listen thread
+ **************************************************************************************************/
+
+
+/*
+ * Code of listening thread
+ */
+void CListenTask::run()
+{
+        nlnettrace( "CListenTask::run" );
+
+#ifdef NL_OS_UNIX
+        SOCKET descmax;
+        fd_set readers;
+        timeval tv;
+        descmax = _ListenSock.descriptor()>_WakeUpPipeHandle[PipeRead]?_ListenSock.descriptor():_WakeUpPipeHandle[PipeRead];
+#endif
+
+        // Accept connections
+        while ( ! exitRequired() )
+        {
+                try
+                {
+                        // Get and setup the new socket
+#ifdef NL_OS_UNIX
+                        FD_ZERO( &readers );
+                        FD_SET( _ListenSock.descriptor(), &readers );
+                        FD_SET( _WakeUpPipeHandle[PipeRead], &readers );
+                        tv.tv_sec = 60; /// \todo ace: we perhaps could put NULL to never wake up the select (look at the select man page)
+                        tv.tv_usec = 0;
+                        int res = ::select( descmax+1, &readers, NULL, NULL, &tv );
+
+                        switch ( res )
+                        {
+                        case  0 : continue; // time-out expired, no results
+                        case -1 :
+                                // we'll ignore message (Interrupted system call) caused by a CTRL-C
+                                if (CSock::getLastError() == 4)
+                                {
+                                        nldebug ("LNETL1: Select failed (in listen thread): %s (code %u) but IGNORED", CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError());
+                                        continue;
+                                }
+                                nlerror( "LNETL1: Select failed (in listen thread): %s (code %u)", CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError() );
+                        }
+
+                        if ( FD_ISSET( _WakeUpPipeHandle[PipeRead], &readers ) )
+                        {
+                                uint8 b;
+                                if ( read( _WakeUpPipeHandle[PipeRead], &b, 1 ) == -1 ) // we were woken-up by the wake-up pipe
+                                {
+                                        nldebug( "LNETL1: In CListenTask::run(): read() failed" );
+                                }
+                                nldebug( "LNETL1: listen thread select woken-up" );
+                                continue;
+                        }
+#endif
+                        nldebug( "LNETL1: Incoming connection..." );
+                        CServerBufSock *bufsock = new CServerBufSock( _ListenSock.accept() );
+                        nldebug( "New connection : %s", bufsock->asString().c_str() );
+                        bufsock->Sock->setNonBlockingMode( true );
+                        if ( _Server->noDelay() )
+                        {
+                                bufsock->Sock->setNoDelay( true );
+                        }
+
+                        // Notify the new connection
+                        bufsock->advertiseConnection( _Server );
+
+                        // Dispatch the socket into the thread pool
+                        _Server->dispatchNewSocket( bufsock );
+                }
+                catch ( ESocket& e )
+                {
+                        nlinfo( "Exception in listen thread: %s", e.what() ); // It can occur in normal behavior (e.g. when exiting)
+                        // It can also occur when too many sockets are open (e.g. 885 connections)
+                }
+        }
+
+        nlnettrace( "Exiting CListenTask::run" );
+}
+
+
+/*
+ * Binds a new socket and send buffer to an existing or a new thread
+ * Note: this method is called in the listening thread.
+ */
+void CBufServer::dispatchNewSocket( CServerBufSock *bufsock )
+{
+        nlnettrace( "CBufServer::dispatchNewSocket" );
+
+        CSynchronized<CThreadPool>::CAccessor poolsync( &_ThreadPool );
+        if ( _ThreadStrategy == SpreadSockets )        
+        {
+                // Find the thread with the smallest number of connections and check if all
+                // threads do not have the same number of connections
+                uint min = 0xFFFFFFFF;
+                uint max = 0;
+                CThreadPool::iterator ipt, iptmin, iptmax;
+                for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                {
+                        uint noc = receiveTask(ipt)->numberOfConnections();
+                        if ( noc < min )
+                        {
+                                min = noc;
+                                iptmin = ipt;
+                        }
+                        if ( noc > max )
+                        {
+                                max = noc;
+                                iptmax = ipt;
+                        }
+                }
+
+                // Check if we make the pool of threads grow (if we have not found vacant room
+                // and if it is allowed to)
+                if ( (poolsync.value().empty()) ||
+                         ((min == max) && (poolsync.value().size() < _MaxThreads)) )
+                {
+                        addNewThread( poolsync.value(), bufsock );
+                }
+                else
+                {
+                        // Dispatch socket to an existing thread of the pool
+                        CServerReceiveTask *task = receiveTask(iptmin);
+                        bufsock->setOwnerTask( task );
+                        task->addNewSocket( bufsock );
+#ifdef NL_OS_UNIX
+                        task->wakeUp();
+#endif                  
+                        
+                        if ( min >= (uint)_MaxSocketsPerThread )
+                        {
+                                nlwarning( "LNETL1: Exceeding the maximum number of sockets per thread" );
+                        }
+                        nldebug( "LNETL1: New socket dispatched to thread %d", iptmin-poolsync.value().begin() );
+                }
+
+        }
+        else // _ThreadStrategy == FillThreads
+        {
+                CThreadPool::iterator ipt;
+                for ( ipt=poolsync.value().begin(); ipt!=poolsync.value().end(); ++ipt )
+                {
+                        uint noc = receiveTask(ipt)->numberOfConnections();
+                        if ( noc < _MaxSocketsPerThread )
+                        {
+                                break;
+                        }
+                }
+
+                // Check if we have to make the thread pool grow (if we have not found vacant room)
+                if ( ipt == poolsync.value().end() )
+                {
+                        if ( poolsync.value().size() == _MaxThreads )
+                        {
+                                nlwarning( "LNETL1: Exceeding the maximum number of threads" );
+                        }
+                        addNewThread( poolsync.value(), bufsock );
+                }
+                else
+                {
+                        // Dispatch socket to an existing thread of the pool
+                        CServerReceiveTask *task = receiveTask(ipt);
+                        bufsock->setOwnerTask( task );
+                        task->addNewSocket( bufsock );
+#ifdef NL_OS_UNIX
+                        task->wakeUp();
+#endif                  
+                        nldebug( "LNETL1: New socket dispatched to thread %d", ipt-poolsync.value().begin() );
+                }
+        }
+}
+
+
+/*
+ * Creates a new task and run a new thread for it
+ * Precond: bufsock not null
+ */
+void CBufServer::addNewThread( CThreadPool& threadpool, CServerBufSock *bufsock )
+{
+        nlnettrace( "CBufServer::addNewThread" );
+        nlassert( bufsock != NULL );
+
+        // Create new task and dispatch the socket to it
+        CServerReceiveTask *task = new CServerReceiveTask( this );
+        bufsock->setOwnerTask( task );
+        task->addNewSocket( bufsock );
+
+        // Add a new thread to the pool, with this task
+        IThread *thr = IThread::create( task );
+        {
+                threadpool.push_back( thr );
+                thr->start();
+                nldebug( "LNETL1: Added a new thread; pool size is %d", threadpool.size() );
+                nldebug( "LNETL1: New socket dispatched to thread %d", threadpool.size()-1 );
+        }
+}
+
+
+/***************************************************************************************************
+ * Receive threads
+ **************************************************************************************************/
+
+
+/*
+ * Code of receiving threads for servers
+ */
+void CServerReceiveTask::run()
+{
+        nlnettrace( "CServerReceiveTask::run" );
+
+        SOCKET descmax;
+        fd_set readers;
+
+        // Time-out value for select (it can be long because we do not do any thing else in this thread)
+        timeval tv;
+#if defined NL_OS_UNIX
+        // POLL7
+        nice( 2 );
+#endif // NL_OS_UNIX
+        
+        // Copy of _Connections
+        vector<TSockId>        connections_copy;        
+
+        while ( ! exitRequired() )
+        {
+                // 1. Remove closed connections
+                clearClosedConnections();
+
+                // POLL8
+
+                // 2-SELECT-VERSION : select() on the sockets handled in the present thread
+
+                descmax = 0;
+                FD_ZERO( &readers );
+                bool skip;
+                bool alldisconnected = true;
+                CConnections::iterator ipb;
+                {
+                        // Lock _Connections
+                        CSynchronized<CConnections>::CAccessor connectionssync( &_Connections );
+
+                        // Prepare to avoid select if there is no connection
+                        skip = connectionssync.value().empty();
+
+                        // Fill the select array and copy _Connections
+                        connections_copy.clear();
+                        for ( ipb=connectionssync.value().begin(); ipb!=connectionssync.value().end(); ++ipb )
+                        {
+                                if ( (*ipb)->Sock->connected() ) // exclude disconnected sockets that are not deleted
+                                                                                                 // Note: there is a mutex in there !
+                                {
+                                        alldisconnected = false;
+                                        // Copy _Connections element
+                                        connections_copy.push_back( *ipb );
+
+                                        // Add socket descriptor to the select array
+                                        FD_SET( (*ipb)->Sock->descriptor(), &readers );
+
+                                        // Calculate descmax for select
+                                        if ( (*ipb)->Sock->descriptor() > descmax )
+                                        {
+                                                descmax = (*ipb)->Sock->descriptor();
+                                        }
+                                }
+                        }
+
+#ifdef NL_OS_UNIX
+                        // Add the wake-up pipe into the select array
+                        FD_SET( _WakeUpPipeHandle[PipeRead], &readers );
+                        if ( _WakeUpPipeHandle[PipeRead]>descmax )
+                        {
+                                descmax = _WakeUpPipeHandle[PipeRead];
+                        }
+#endif
+                        
+                        // Unlock _Connections, use connections_copy instead
+                }
+
+#ifndef NL_OS_UNIX
+                // Avoid select if there is no connection (Windows only)
+                if ( skip || alldisconnected )
+                {
+                        nlSleep( 1 ); // nice
+                        continue;
+                }
+#endif
+
+#ifdef NL_OS_WINDOWS
+                tv.tv_sec = 0; // short time because the newly added connections can't be added to the select fd_set
+                tv.tv_usec = 10000; // NEW: set to 500ms because otherwise new connections handling are too slow
+#elif defined NL_OS_UNIX
+                // POLL7
+                tv.tv_sec = 3600;                // 1 hour (=> 1 select every 3.6 second for 1000 connections)
+                tv.tv_usec = 0;
+#endif // NL_OS_WINDOWS
+
+                // Call select
+                int res = ::select( descmax+1, &readers, NULL, NULL, &tv );
+
+                // POLL9
+
+                // 3. Test the result
+                switch ( res )
+                {
+                        case  0 : continue; // time-out expired, no results
+
+                        /// \todo cado: the error code is not properly retrieved
+                        case -1 :
+                                // we'll ignore message (Interrupted system call) caused by a CTRL-C
+                                /*if (CSock::getLastError() == 4)
+                                {
+                                        nldebug ("LNETL1: Select failed (in receive thread): %s (code %u) but IGNORED", CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError());
+                                        continue;
+                                }*/
+                                //nlerror( "LNETL1: Select failed (in receive thread): %s (code %u)", CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError() );
+                                nldebug( "LNETL1: Select failed (in receive thread): %s (code %u)", CSock::errorString( CSock::getLastError() ).c_str(), CSock::getLastError() );
+                                return;
+                }
+
+                // 4. Get results
+
+                vector<TSockId>::iterator ic;
+                for ( ic=connections_copy.begin(); ic!=connections_copy.end(); ++ic )
+                {
+                        if ( FD_ISSET( (*ic)->Sock->descriptor(), &readers ) != 0 )
+                        {
+                                CServerBufSock *serverbufsock = static_cast<CServerBufSock*>(static_cast<CBufSock*>(*ic));
+                                try
+                                {
+                                        // 4. Receive data
+                                        if ( serverbufsock->receivePart() )
+                                        {
+                                                // Copy sockid
+                                                vector<uint8> hidvec;
+                                                hidvec.resize( sizeof(TSockId)+1 );
+                                                memcpy( &*hidvec.begin(), &(*ic), sizeof(TSockId) );
+
+                                                // Add event type to hidvec
+                                                hidvec[sizeof(TSockId)] = (uint8)CBufNetBase::User;
+
+                                                // Push message into receive queue
+                                                //uint32 bufsize;
+                                                //sint32 mbsize;
+                                                {
+                                                        //nldebug( "RCV: Acquiring the receive queue... ");
+                                                        CFifoAccessor recvfifo( &_Server->receiveQueue() );
+                                                        //nldebug( "RCV: Acquired, pushing the received buffer... ");
+                                                        recvfifo.value().push( serverbufsock->receivedBuffer(), hidvec );
+                                                        //nldebug( "RCV: Pushed, releasing the receive queue..." );
+                                                        //recvfifo.value().display();
+                                                        //bufsize = serverbufsock->receivedBuffer().size();
+                                                        //mbsize = recvfifo.value().size() / 1048576;
+                                                }
+                                                //nldebug( "RCV: Released." );
+                                                /*if ( mbsize > 1 )
+                                                {
+                                                        nlwarning( "The receive queue size exceeds %d MB", mbsize );
+                                                }*/
+                                                /*
+                                                // Statistics
+                                                {
+                                                        CSynchronized<uint32>::CAccessor syncbpi ( &_Server->syncBytesPushedIn() );
+                                                        syncbpi.value() += bufsize;
+                                                }
+                                                */
+                                        }
+                                }
+                                catch ( ESocketConnectionClosed& )
+                                {
+                                        nldebug( "LNETL1: Connection %s closed", serverbufsock->asString().c_str() );
+                                }
+                                catch ( ESocket& )
+                                {
+                                        nldebug( "LNETL1: Connection %s broken", serverbufsock->asString().c_str() );
+                                        (*ic)->Sock->disconnect();
+                                }
+/*
+#ifdef NL_OS_UNIX
+                                skip = true; // don't check _WakeUpPipeHandle (yes, check it to read any written byte)
+#endif
+
+*/
+                        }
+
+                }
+
+#ifdef NL_OS_UNIX
+                // Test wake-up pipe
+                if ( (!skip) && (FD_ISSET( _WakeUpPipeHandle[PipeRead], &readers )) )
+                {
+                        uint8 b;
+                        if ( read( _WakeUpPipeHandle[PipeRead], &b, 1 ) == -1 ) // we were woken-up by the wake-up pipe
+                        {
+                                nldebug( "LNETL1: In CServerReceiveTask::run(): read() failed" );
+                        }
+                        nldebug( "LNETL1: Receive thread select woken-up" );
+                }
+#endif
+                
+        }
+        nlnettrace( "Exiting CServerReceiveTask::run" );
+}
+
+
+/*
+ * Delete all connections referenced in the remove list (double-mutexed)
+ */
+
+void CServerReceiveTask::clearClosedConnections()
+{
+        CConnections::iterator ic;
+        {
+                NLMISC::CSynchronized<CConnections>::CAccessor removesetsync( &_RemoveSet );
+                {
+                        if ( ! removesetsync.value().empty() )
+                        {
+                                // Delete closed connections
+                                NLMISC::CSynchronized<CConnections>::CAccessor connectionssync( &_Connections );
+                                for ( ic=removesetsync.value().begin(); ic!=removesetsync.value().end(); ++ic )
+                                {
+                                        nldebug( "LNETL1: Removing a connection" );
+
+                                        TSockId sid = (*ic);
+
+                                        // Remove from the connection list
+                                        connectionssync.value().erase( *ic );
+
+                                        // Delete the socket object
+                                        delete sid;
+                                }
+                                // Clear remove list
+                                removesetsync.value().clear();
+                        }
+                }
+        }
+}
+
+
+} // NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?sortby=date new file mode 100644 index 00000000..8d7aedbd --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/buf_server.cpp?sortby=date @@ -0,0 +1,456 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / buf_server.cpp
+ + + + + +
buf_server.cpp
+

+

Default branch: MAIN
+


+ Revision 1.32 / (download) - annotate - [select for diffs] +, Tue Jul 2 15:56:58 2002 UTC (3 weeks, 5 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.31: +2 -2 + lines
Diff to previous 1.31 +

+CHANGED: commented some nldebug for performance
+
+

+ Revision 1.31 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.30: +6 -6 + lines
Diff to previous 1.30 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.30 / (download) - annotate - [select for diffs] +, Mon Jun 10 10:11:32 2002 UTC (6 weeks, 6 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.29: +6 -1 + lines
Diff to previous 1.29 +

+ADDED: use of htimer
+
+

+ Revision 1.29 / (download) - annotate - [select for diffs] +, Tue May 21 16:37:38 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.28: +32 -20 + lines
Diff to previous 1.28 +

+CHANGED: serial/send/receive 3 time faster
+
+

+ Revision 1.28 / (download) - annotate - [select for diffs] +, Thu Apr 18 16:53:10 2002 UTC (3 months, 1 week ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.27: +22 -4 + lines
Diff to previous 1.27 +

+FIXED: manage endianess for the message number
+
+

+ Revision 1.27 / (download) - annotate - [select for diffs] +, Tue Apr 9 12:23:52 2002 UTC (3 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.26: +5 -3 + lines
Diff to previous 1.26 +

+BUGFIX
+
+

+ Revision 1.26 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.25: +2 -3 + lines
Diff to previous 1.25 +

+CHANGED: removed some debug info
+
+

+ Revision 1.25 / (download) - annotate - [select for diffs] +, Wed Feb 6 17:29:03 2002 UTC (5 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.24: +2 -2 + lines
Diff to previous 1.24 +

+CHANGED back nlsleep to 1 to avoid slowing the PC
+
+

+ Revision 1.24 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:20 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.23: +3 -2 + lines
Diff to previous 1.23 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.22: +37 -37 + lines
Diff to previous 1.22 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Thu Nov 22 10:40:13 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.21: +2 -2 + lines
Diff to previous 1.21 +

+TRY: change nlSleep(10) into nlSleep(0)
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:24:41 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.20: +6 -4 + lines
Diff to previous 1.20 +

+FIXED: error code badly interpreted (?) (not yet fully fixed anyway)
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Wed Sep 12 16:55:23 2001 UTC (10 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.19: +4 -3 + lines
Diff to previous 1.19 +

+ADDED: stat in the mutex (with named mutex)
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Wed Sep 5 08:54:46 2001 UTC (10 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.18: +7 -1 + lines
Diff to previous 1.18 +

+BUGFIX: when we lost a message, resync message number to avoid text flood
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Fri Aug 24 11:36:47 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.17: +2 -2 + lines
Diff to previous 1.17 +

+CHANGED: the lost message error into a warning
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Fri Aug 24 08:23:52 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +4 -4 + lines
Diff to previous 1.16 +

+FIXED: change some message from info to debug
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Thu Aug 23 17:21:56 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +19 -1 + lines
Diff to previous 1.15 +

+ADDED: debug features to count message to see if some messages are lost
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Wed Jul 4 08:33:05 2001 UTC (12 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +1 -3 + lines
Diff to previous 1.14 +

+#REMOVED: debug info
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Fri Jun 29 08:48:07 2001 UTC (12 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.13: +16 -9 + lines
Diff to previous 1.13 +

+#DOCFIX
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Fri Jun 29 08:33:15 2001 UTC (12 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +24 -12 + lines
Diff to previous 1.12 +

+FIXED: after few minutes, services on linux consumed all the CPU. fixed now
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:29:16 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +39 -3 + lines
Diff to previous 1.11 +

+ADDED: stat information (queue size)
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:03:17 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.10: +115 -98 + lines
Diff to previous 1.10 +

+Added Layer 1 support for message recorder
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Tue Jun 12 15:40:43 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +4 -4 + lines
Diff to previous 1.9 +

+CHANGED: on windows, select timeout is now 500ms
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:57:09 2001 UTC (13 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.8: +2 -2 + lines
Diff to previous 1.8 +

+#Fixed a semicolon that was missing after a nlassert, so it did not compile in release mode
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:38:06 2001 UTC (13 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.7: +4 -3 + lines
Diff to previous 1.7 +

+Added support for 32-bit message length
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Wed May 30 08:53:50 2001 UTC (13 months, 4 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.6: +2 -1 + lines
Diff to previous 1.6 +

+Bugfix: initializations in constructors (nonblocking was bugging)
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Thu May 24 14:17:51 2001 UTC (14 months ago) by cado +
Branch: MAIN + +
Changes since 1.5: +17 -13 + lines
Diff to previous 1.5 +

+Miscellaneous bug and doc fixes
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Fri May 18 14:32:23 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.4: +34 -5 + lines
Diff to previous 1.4 +

+Added "disconnect all" feature
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Thu May 17 15:37:05 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.3: +3 -1 + lines
Diff to previous 1.3 +

+Added asserts on length of buffer sent
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri May 11 09:29:19 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.2: +17 -10 + lines
Diff to previous 1.2 +

+#Fixed the previous changes
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu May 10 08:49:12 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.1: +6 -2 + lines
Diff to previous 1.1 +

+Changed the way of sending : needs to be logically connected (at user level)
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/buf_sock.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/buf_sock.cpp?sortby=date new file mode 100644 index 00000000..f3140287 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/buf_sock.cpp?sortby=date @@ -0,0 +1,406 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / buf_sock.cpp
+ + + + + +
buf_sock.cpp
+

+

Default branch: MAIN
+


+ Revision 1.27 / (download) - annotate - [select for diffs] +, Tue Jul 2 15:56:58 2002 UTC (3 weeks, 5 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.26: +2 -2 + lines
Diff to previous 1.26 +

+CHANGED: commented some nldebug for performance
+
+

+ Revision 1.26 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.25: +2 -3 + lines
Diff to previous 1.25 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.25 / (download) - annotate - [select for diffs] +, Mon Jun 10 10:11:33 2002 UTC (6 weeks, 6 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.24: +3 -1 + lines
Diff to previous 1.24 +

+ADDED: use of htimer
+
+

+ Revision 1.24 / (download) - annotate - [select for diffs] +, Mon May 27 16:50:24 2002 UTC (2 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.23: +2 -2 + lines
Diff to previous 1.23 +

+no message
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Wed May 22 14:27:45 2002 UTC (2 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.22: +4 -3 + lines
Diff to previous 1.22 +

+FIXED: assert failed
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Tue May 21 16:37:38 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.21: +30 -15 + lines
Diff to previous 1.21 +

+CHANGED: serial/send/receive 3 time faster
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.20: +6 -7 + lines
Diff to previous 1.20 +

+CHANGED: removed some debug info
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Wed Feb 20 18:09:17 2002 UTC (5 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.19: +2 -2 + lines
Diff to previous 1.19 +

+#FIXED: doxygen warning
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:20 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.18: +3 -3 + lines
Diff to previous 1.18 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.17: +10 -10 + lines
Diff to previous 1.17 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Fri Sep 21 13:36:03 2001 UTC (10 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +2 -2 + lines
Diff to previous 1.16 +

+BUGFIX: when printing message, it occurs some time that the message contains a % and crash the printf
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Wed Sep 12 16:55:23 2001 UTC (10 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.15: +2 -2 + lines
Diff to previous 1.15 +

+ADDED: stat in the mutex (with named mutex)
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Thu Aug 30 17:07:36 2001 UTC (10 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +6 -1 + lines
Diff to previous 1.14 +

+CHANGED: update procedure and time sync
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Thu Aug 23 17:21:56 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.13: +4 -2 + lines
Diff to previous 1.13 +

+ADDED: debug features to count message to see if some messages are lost
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Wed Jul 11 15:15:10 2001 UTC (12 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.12: +2 -2 + lines
Diff to previous 1.12 +

+BUGFIX: stringFromVectorPart() with len=0 asserted in debug mode
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Thu Jun 21 12:33:00 2001 UTC (13 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +27 -4 + lines
Diff to previous 1.11 +

+ADDED: nlassert when sockid is invalid and destroy the structure on the dtor
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:03:17 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.10: +5 -4 + lines
Diff to previous 1.10 +

+Added Layer 1 support for message recorder
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Tue Jun 12 17:01:43 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +2 -2 + lines
Diff to previous 1.9 +

+BUGIFX: cast isprint from uint8 to int
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Fri Jun 1 16:25:25 2001 UTC (13 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.8: +2 -2 + lines
Diff to previous 1.8 +

+BUGFIX: error in assert condition in stringFromVectorPart()
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:38:06 2001 UTC (13 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.7: +20 -50 + lines
Diff to previous 1.7 +

+Added support for 32-bit message length
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Thu May 31 14:07:13 2001 UTC (13 months, 4 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.6: +57 -13 + lines
Diff to previous 1.6 +

+BUGFIX: non-blocking sending for big buffers in flush()
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Thu May 24 14:17:51 2001 UTC (14 months ago) by cado +
Branch: MAIN + +
Changes since 1.5: +18 -6 + lines
Diff to previous 1.5 +

+Miscellaneous bug and doc fixes
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Fri May 11 09:29:19 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.4: +4 -1 + lines
Diff to previous 1.4 +

+#Fixed the previous changes
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Thu May 10 15:41:53 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.3: +19 -21 + lines
Diff to previous 1.3 +

+Improved sending in flush()
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Thu May 10 08:49:12 2001 UTC (14 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.2: +25 -1 + lines
Diff to previous 1.2 +

+Changed the way of sending : needs to be logically connected (at user level)
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Fri May 4 09:52:56 2001 UTC (14 months, 3 weeks ago) by coutelas +
Branch: MAIN + +
Changes since 1.1: +13 -3 + lines
Diff to previous 1.1 +

+BUGFIX: set appid to 0 at ctor and dont access to sock when sock is NULL
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/callback_client.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/callback_client.cpp?sortby=date new file mode 100644 index 00000000..afdfd892 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/callback_client.cpp?sortby=date @@ -0,0 +1,379 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / callback_client.cpp
+ + + + + +
callback_client.cpp
+

+

Default branch: MAIN
+


+ Revision 1.24 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.23: +6 -7 + lines
Diff to previous 1.23 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Tue Jun 11 15:32:22 2002 UTC (6 weeks, 5 days ago) by legros +
Branch: MAIN + +
Changes since 1.22: +2 -2 + lines
Diff to previous 1.22 +

+FIXED: flush should not crash any longer on client callbacks
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Wed May 22 08:04:17 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.21: +1 -2 + lines
Diff to previous 1.21 +

+REMOVED: layer2 used
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Tue May 21 16:37:38 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.20: +9 -9 + lines
Diff to previous 1.20 +

+CHANGED: serial/send/receive 3 time faster
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Thu Apr 18 16:53:10 2002 UTC (3 months, 1 week ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.19: +13 -2 + lines
Diff to previous 1.19 +

+FIXED: manage endianess for the message number
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.18: +7 -3 + lines
Diff to previous 1.18 +

+CHANGED: removed some debug info
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.17: +3 -1 + lines
Diff to previous 1.17 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +7 -7 + lines
Diff to previous 1.16 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:12:48 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +2 -2 + lines
Diff to previous 1.15 +

+#english fix (sended->sent finnish->finish)
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:22:26 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.14: +2 -1 + lines
Diff to previous 1.14 +

+ADDED: default callback
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Thu Aug 30 17:07:36 2001 UTC (10 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.13: +5 -1 + lines
Diff to previous 1.13 +

+CHANGED: update procedure and time sync
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Fri Aug 24 08:23:52 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +3 -3 + lines
Diff to previous 1.12 +

+FIXED: change some message from info to debug
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Thu Aug 23 17:21:56 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +17 -2 + lines
Diff to previous 1.11 +

+ADDED: debug features to count message to see if some messages are lost
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:29:42 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.10: +4 -4 + lines
Diff to previous 1.10 +

+ADDED: stat information (queue size)
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Thu Jun 21 12:33:00 2001 UTC (13 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +5 -1 + lines
Diff to previous 1.9 +

+ADDED: nlassert when sockid is invalid and destroy the structure on the dtor
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:06:18 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.8: +299 -10 + lines
Diff to previous 1.8 +

+Added layer 3 support for message recorder
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Wed Jun 13 12:11:14 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.7: +1 -2 + lines
Diff to previous 1.7 +

+#BUGFIX: on threadid
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Wed Jun 13 10:22:26 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.6: +12 -2 + lines
Diff to previous 1.6 +

+FIXED: add assert and multithread check
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:42:30 2001 UTC (13 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +3 -2 + lines
Diff to previous 1.5 +

+MODIFIED: no size limit anymore
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Tue May 29 09:30:08 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +3 -3 + lines
Diff to previous 1.4 +

+MODIFIED: reformated the output message to be filtered easier
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.3: +47 -28 + lines
Diff to previous 1.3 +

+ADD: new version of the network system (in NeL and NeLns)
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri Feb 23 09:48:38 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
CVS Tags: net_0_1 +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+#DOCFIX
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu Feb 22 18:04:25 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.1: +10 -3 + lines
Diff to previous 1.1 +

+ADD: layer4 implemented by CMsgSocket
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Thu Feb 22 16:18:35 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Diff

+#ADD: network layer4 interface
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?rev=1.33&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?rev=1.33&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..b3f66b6e --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?rev=1.33&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,556 @@ + + + +code/nel/src/net/callback_net_base.cpp - view - 1.33 + +
[BACK] Return to callback_net_base.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / callback_net_base.cpp (download)
+Revision 1.33, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN +
CVS Tags: HEAD
Changes since 1.32: +4 -7 + lines
+ADDED: changed NULL into InvalidSockId
+
+

/** \file callback_net_base.cpp
+ * Network engine, layer 3, base
+ *
+ * $Id: callback_net_base.cpp,v 1.33 2002/06/12 10:16:34 lecroart Exp $
+ */
+
+/* Copyright, 2001 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/misc/string_id_array.h"
+#include "nel/misc/hierarchical_timer.h"
+
+#include "nel/net/buf_sock.h"
+#include "nel/net/callback_net_base.h"
+
+#ifdef USE_MESSAGE_RECORDER
+#pragma message ( "NeL Net layer 3: message recorder enabled" )
+#include "nel/net/message_recorder.h"
+#else
+#pragma message ( "NeL Net layer 3: message recorder disabled" )
+#endif
+
+
+using namespace std;
+using namespace NLMISC;
+
+namespace NLNET {
+
+
+/*
+ *
+ */
+void cbnbMessageRecvAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        // receive a new message association
+
+        CStringIdArray::TStringId size;
+        msgin.serial (size);
+
+        nldebug ("LNETL3NB_ASSOC: The other side gave me %d association strings", size);
+
+        for (CStringIdArray::TStringId i = 0; i < size; i++)
+        {
+                std::string name;
+                CStringIdArray::TStringId id;
+
+                msgin.serial (name);
+                msgin.serial (id);
+
+                // if id == -1, it means that there are no callback associated to this message
+                // it should not happen, it mean that one side send a message that the other side
+                // can't manage in his callbackarray.
+                // to resolve the problem, add the callback in the callbackarray in the other side
+                // and put NULL if you don't want to manage this message
+                nlassert (id != -1);
+
+                nldebug ("LNETL3NB_ASSOC:  association '%s' -> %d", name.c_str (), id);
+                netbase.getSIDA().addString (name, id);
+        }
+}
+
+
+/*
+ * the other side want to know some of my association, send them!
+ */
+void cbnbMessageAskAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        CMessage msgout (netbase.getSIDA(), "RA");
+        CStringIdArray::TStringId size;
+        msgin.serial (size);
+
+        nldebug ("LNETL3NB_ASSOC: The other side want %d string associations", size);
+
+        msgout.serial (size);
+
+        for (sint i = 0; i < size; i++)
+        {
+                string name;
+                msgin.serial (name);
+                nldebug ("LNETL3NB_ASSOC:  sending association '%s' -> %d", name.c_str (), netbase._OutputSIDA.getId(name));
+
+                // if this assert occurs, it means that the other side ask an unknown message
+                // or that there are different types of client (with differents callbackarray) and one of the client doesn't have this callback
+                nlassert(netbase._OutputSIDA.getId(name) != -1);
+
+                msgout.serial (name);
+
+                CStringIdArray::TStringId id = netbase._OutputSIDA.getId (name);
+                msgout.serial (id);
+        }
+        // send the message to the other side
+        netbase.send (msgout, from);
+}
+
+static TCallbackItem cbnbMessageAssociationArray[] =
+{
+        { "AA", cbnbMessageAskAssociations },
+        { "RA", cbnbMessageRecvAssociations },
+};
+
+
+/*
+ * Disconnection callback
+ */
+void cbnbNewDisconnection (TSockId from, void *data)
+{
+        nlassert (data != NULL);
+        CCallbackNetBase *base = (CCallbackNetBase *)data;
+
+        nldebug("LNETL3NB: cbnbNewDisconnection()");
+
+#ifdef USE_MESSAGE_RECORDER
+        // Record or replay disconnection
+        base->noticeDisconnection( from );
+#endif
+        
+        // Call the client callback if necessary
+        if (base->_DisconnectionCallback != NULL)
+                base->_DisconnectionCallback (from, base->_DisconnectionCbArg);
+}
+
+
+/*
+ * Constructor
+ */
+CCallbackNetBase::CCallbackNetBase(  TRecordingState rec, const string& recfilename, bool recordall ) :
+        _FirstUpdate (true), _DisconnectionCallback(NULL), _DisconnectionCbArg(NULL)
+#ifdef USE_MESSAGE_RECORDER
+        , _MR_RecordingState(rec), _MR_UpdateCounter(0)
+#endif
+{
+        _ThreadId = getThreadId ();
+        _NewDisconnectionCallback = cbnbNewDisconnection;
+
+        _BytesSent = 0;
+        _BytesReceived = 0;
+
+        createDebug(); // for addNegativeFilter to work even in release and releasedebug modes
+
+        // add the callback needed to associate messages with id
+        addCallbackArray (cbnbMessageAssociationArray, sizeof (cbnbMessageAssociationArray) / sizeof (cbnbMessageAssociationArray[0]));
+
+#ifdef USE_MESSAGE_RECORDER
+        switch ( _MR_RecordingState )
+        {
+        case Record :
+                _MR_Recorder.startRecord( recfilename, recordall );
+                break;
+        case Replay :
+                _MR_Recorder.startReplay( recfilename );
+                break;
+        default:;
+                // No recording
+        }
+#endif
+}
+
+
+/*
+ *      Append callback array with the specified array
+ */
+void CCallbackNetBase::addCallbackArray (const TCallbackItem *callbackarray, CStringIdArray::TStringId arraysize)
+{
+        checkThreadId ();
+
+        // be sure that the 2 array have the same size
+        nlassert (_CallbackArray.size () == (uint)_OutputSIDA.size ());
+
+        if (arraysize == 1 && callbackarray[0].Callback == NULL && string("") == callbackarray[0].Key)
+        {
+                // it's an empty array, ignore it
+                return;
+        }
+
+        // resize the array
+        sint oldsize = _CallbackArray.size();
+
+        _CallbackArray.resize (oldsize + arraysize);
+        _OutputSIDA.resize (oldsize + arraysize);
+
+//TOO MUCH MESSAGE      nldebug ("L3NB_CB: Adding %d callback to the array", arraysize);
+
+        for (sint i = 0; i < arraysize; i++)
+        {
+                CStringIdArray::TStringId ni = oldsize + i;
+//TOO MUCH MESSAGE              nldebug ("L3NB_CB: Adding callback to message '%s', id '%d'", callbackarray[i].Key, ni);
+                // copy callback value
+                
+                _CallbackArray[ni] = callbackarray[i];
+                // add the string to the string id array
+                _OutputSIDA.addString (callbackarray[i].Key, ni);
+
+        }
+//      nldebug ("LNETL3NB_CB: Added %d callback Now, there's %d callback associated with message type", arraysize, _CallbackArray.size ());
+}
+
+
+/*
+ * processOneMessage()
+ */
+void CCallbackNetBase::processOneMessage ()
+{
+        checkThreadId ();
+
+        H_AUTO (CCallbackNetBase_processOneMessage);
+
+        CMessage msgin (_OutputSIDA, "", true);
+        TSockId tsid;
+        receive (msgin, &tsid);
+
+        _BytesReceived += msgin.length ();
+
+        nldebug ("LNETL3NB: Received a message %s from %s", msgin.toString().c_str(), tsid->asString().c_str());
+        
+        // now, we have to call the good callback
+        NLMISC::CStringIdArray::TStringId pos = -1;
+        if (msgin.TypeHasAnId)
+        {
+                pos = msgin.getId ();
+        }
+        else
+        {
+                std::string name = msgin.getName ();
+                sint16 i;
+                for (i = 0; i < (sint16) _CallbackArray.size (); i++)
+                {
+                        if (name == _CallbackArray[i].Key)
+                        {
+                                pos = i;
+                                break;
+                        }
+                }
+        }
+
+        TMsgCallback        cb = NULL;
+        if (pos < 0 || pos >= (sint16) _CallbackArray.size ())
+        {
+                if (_DefaultCallback == NULL)
+                {
+                        nlwarning ("LNETL3NB_CB: Callback %s not found in _CallbackArray", msgin.toString().c_str());
+                }
+                else
+                {
+                        cb = _DefaultCallback;
+                }
+        }
+        else
+        {
+                cb = _CallbackArray[pos].Callback;
+        }
+
+        TSockId realid = getSockId (tsid);
+
+        if (!realid->AuthorizedCallback.empty() && msgin.getName() != realid->AuthorizedCallback)
+        {
+                nlwarning ("LNETL3NB_CB: %s try to call the callback %s but only %s is authorized. Disconnect him!", tsid->asString().c_str(), msgin.toString().c_str(), tsid->AuthorizedCallback.c_str());
+                disconnect (tsid);
+        }
+        else if (cb == NULL)
+        {
+                nlwarning ("LNETL3NB_CB: Callback %s is NULL, can't call it", msgin.toString().c_str());
+        }
+        else
+        {
+                nldebug ("LNETL3NB_CB: Calling callback (%s)%s", msgin.getName().c_str(), (cb==_DefaultCallback)?" DEFAULT_CB":"");
+                cb(msgin, realid, *this);
+        }
+        
+/*
+        if (pos < 0 || pos >= (sint16) _CallbackArray.size ())
+        {
+                if (_DefaultCallback == NULL)
+                        nlwarning ("LNETL3NB_CB: Callback %s not found in _CallbackArray", msgin.toString().c_str());
+                else
+                {
+                        // ...
+                }
+        }
+        else
+        {
+                TSockId realid = getSockId (tsid);
+
+                if (!realid->AuthorizedCallback.empty() && msgin.getName() != realid->AuthorizedCallback)
+                {
+                        nlwarning ("LNETL3NB_CB: %s try to call the callback %s but only %s is authorized. Disconnect him!", tsid->asString().c_str(), msgin.toString().c_str(), tsid->AuthorizedCallback.c_str());
+                        disconnect (tsid);
+                }
+                else if (_CallbackArray[pos].Callback == NULL)
+                {
+                        nlwarning ("LNETL3NB_CB: Callback %s is NULL, can't call it", msgin.toString().c_str());
+                }
+                else
+                {
+                        nldebug ("LNETL3NB_CB: Calling callback (%s)", _CallbackArray[pos].Key);
+                        _CallbackArray[pos].Callback (msgin, realid, *this);
+                }
+        }
+*/
+}
+
+
+
+/*
+ * baseUpdate
+ * Recorded : YES
+ * Replayed : YES
+ */
+void CCallbackNetBase::baseUpdate (sint32 timeout)
+{
+        checkThreadId ();
+
+        H_AUTO (CCallbackNetBase_baseUpdate);
+
+        nlassert( timeout >= -1 );
+        TTime t0 = CTime::getLocalTime();
+
+        //
+        // The first time, we init time counters
+        //
+        if (_FirstUpdate)
+        {
+//              nldebug("LNETL3NB: First update()");
+                _FirstUpdate = false;
+                _LastUpdateTime = t0;
+                _LastMovedStringArray = t0;
+        }
+
+        //
+        // Every 1 seconds if we have new unknown association, we ask them to the other side
+        //
+        if (t0 - _LastUpdateTime >  1000)
+        {
+//              nldebug("LNETL3NB: baseUpdate()");
+                _LastUpdateTime = t0;
+
+                const set<string> &sa = _InputSIDA.getNeedToAskedStringArray ();
+                if (!sa.empty ())
+                {
+                        CMessage msgout (_InputSIDA, "AA");
+                        //nlassert (sa.size () < 65536); // no size limit anymore
+                        CStringIdArray::TStringId size = sa.size ();
+                        nldebug ("LNETL3NB_ASSOC: I need %d string association, ask them to the other side", size);
+                        msgout.serial (size);
+                        for (set<string>::iterator it = sa.begin(); it != sa.end(); it++)
+                        {
+                                nldebug ("LNETL3NB_ASSOC:  what is the id of '%s'?", (*it).c_str ());
+                                string str(*it);
+                                msgout.serial (str);
+                        }
+                        // send the message to the other side
+                        send (msgout, 0);
+                        _InputSIDA.moveNeedToAskToAskedStringArray();
+                        _LastMovedStringArray = t0;
+                }
+        }
+
+        //
+        // Every 60 seconds if we have not answered association, we ask again to get them!
+        //
+        if (!_InputSIDA.getAskedStringArray().empty() && t0 - _LastMovedStringArray > 60000)
+        {
+                // we didn't have an answer for the association, resend them
+                const set<string> sa = _InputSIDA.getAskedStringArray ();
+                CMessage msgout (_InputSIDA, "AA");
+                //nlassert (sa.size () < 65536); // no size limit anymore
+                CStringIdArray::TStringId size = sa.size ();
+                nldebug ("LNETL3NB_ASSOC: client didn't answer my asked association, retry! I need %d string association, ask them to the other side", size);
+                msgout.serial (size);
+                for (set<string>::iterator it = sa.begin(); it != sa.end(); it++)
+                {
+                        nldebug ("LNETL3NB_ASSOC:  what is the id of '%s'?", (*it).c_str ());
+                        string str(*it);
+                        msgout.serial (str);
+                }
+                // sends the message to the other side
+                send (msgout, 0);
+                _LastMovedStringArray = t0;
+        }
+
+        /*
+         * timeout -1    =>  read one message in the queue
+         * timeout 0     =>  read all messages in the queue
+         * timeout other =>  read all messages in the queue until timeout expired (at least all one time)
+         */
+
+        bool exit = false;
+
+        while (!exit)
+        {
+                // process all messages in the queue
+                while (dataAvailable ())
+                {
+                        processOneMessage ();
+                        if (timeout == -1)
+                        {
+                                exit = true;
+                                break;
+                        }
+                }
+
+                // need to exit?
+                if (timeout == 0 || (sint32)(CTime::getLocalTime() - t0) > timeout)
+                {
+                        exit = true;
+                }
+                else
+                {
+                        // enable multithreading on windows :-/
+                        H_AUTO (CCallbackNetBase_baseUpdate_nlSleep);
+                        nlSleep (10);
+                }
+        }
+
+#ifdef USE_MESSAGE_RECORDER
+        _MR_UpdateCounter++;
+#endif
+
+}
+
+
+const   CInetAddress& CCallbackNetBase::hostAddress (TSockId hostid)
+{
+        // should never be called
+        nlstop;
+        static CInetAddress tmp;
+        return tmp;
+}
+
+void    CCallbackNetBase::setOtherSideAssociations (const char **associationarray, NLMISC::CStringIdArray::TStringId arraysize)
+{
+        checkThreadId ();
+
+        nldebug ("LNETL3NB_ASSOC: setOtherSideAssociations() sets %d association strings", arraysize);
+
+        for (sint i = 0; i < arraysize; i++)
+        {
+                nldebug ("LNETL3NB_ASSOC:  association '%s' -> %d", associationarray[i], i);
+                getSIDA().addString (associationarray[i], i);
+        }
+}
+
+void    CCallbackNetBase::displayAllMyAssociations ()
+{
+        checkThreadId ();
+
+        _OutputSIDA.display ();
+}
+
+void    CCallbackNetBase::authorizeOnly (const char *callbackName, TSockId hostid)
+{
+        checkThreadId ();
+
+        nldebug ("LNETL3NB: authorizeOnly (%s, %s)", callbackName, hostid->asString().c_str());
+
+        hostid = getSockId (hostid);
+        
+        nlassert (hostid != InvalidSockId);
+
+        hostid->AuthorizedCallback = (callbackName == NULL)?"":callbackName;
+}
+
+
+#ifdef USE_MESSAGE_RECORDER
+
+/*
+ * Replay dataAvailable() in replay mode
+ */
+bool CCallbackNetBase::replayDataAvailable()
+{
+        nlassert( _MR_RecordingState == Replay );
+
+        if ( _MR_Recorder.ReceivedMessages.empty() )
+        {
+                // Fill the queue of received messages related to the present update
+                _MR_Recorder.replayNextDataAvailable( _MR_UpdateCounter );
+        }
+
+        return replaySystemCallbacks();
+}
+
+
+/*
+ * Record or replay disconnection
+ */
+void CCallbackNetBase::noticeDisconnection( TSockId hostid )
+{
+        nlassert (hostid != InvalidSockId);        // invalid hostid
+        if ( _MR_RecordingState != Replay )
+        {
+                if ( _MR_RecordingState == Record )
+                {
+                        // Record disconnection
+                        CMessage emptymsg;
+                        _MR_Recorder.recordNext( _MR_UpdateCounter, Disconnecting, hostid, emptymsg );
+                }
+        }
+        else
+        {
+                // Replay disconnection
+                hostid->disconnect( false );
+        }
+}
+
+#endif // USE_MESSAGE_RECORDER
+
+
+
+/*
+ * checkThreadId
+ */
+void CCallbackNetBase::checkThreadId () const
+{
+/*      some people use this class in different thread but with a mutex to be sure to have
+        no concurent access
+        if (getThreadId () != _ThreadId)
+        {
+                nlerror ("You try to access to the same CCallbackClient or CCallbackServer with 2 differents thread (%d and %d)", _ThreadId, getThreadId());
+        }
+*/
+}
+
+
+} // NLNET
+
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?sortby=date new file mode 100644 index 00000000..08cb4310 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/callback_net_base.cpp?sortby=date @@ -0,0 +1,469 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / callback_net_base.cpp
+ + + + + +
callback_net_base.cpp
+

+

Default branch: MAIN
+


+ Revision 1.33 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.32: +4 -7 + lines
Diff to previous 1.32 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.32 / (download) - annotate - [select for diffs] +, Mon Jun 10 10:11:33 2002 UTC (6 weeks, 6 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.31: +7 -1 + lines
Diff to previous 1.31 +

+ADDED: use of htimer
+
+

+ Revision 1.31 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.30: +3 -5 + lines
Diff to previous 1.30 +

+CHANGED: removed some debug info
+
+

+ Revision 1.30 / (download) - annotate - [select for diffs] +, Mon Feb 11 10:20:54 2002 UTC (5 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.29: +2 -2 + lines
Diff to previous 1.29 +

+CHANGED: remove nlsleep(0) and set to 10
+
+

+ Revision 1.29 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.28: +2 -5 + lines
Diff to previous 1.28 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.28 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.27: +26 -26 + lines
Diff to previous 1.27 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.27 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:12:48 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.26: +2 -2 + lines
Diff to previous 1.26 +

+#english fix (sended->sent finnish->finish)
+
+

+ Revision 1.26 / (download) - annotate - [select for diffs] +, Thu Nov 22 10:40:13 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.25: +3 -3 + lines
Diff to previous 1.25 +

+TRY: change nlSleep(10) into nlSleep(0)
+
+

+ Revision 1.25 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:22:26 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.24: +43 -2 + lines
Diff to previous 1.24 +

+ADDED: default callback
+
+

+ Revision 1.24 / (download) - annotate - [select for diffs] +, Thu Sep 20 13:24:24 2001 UTC (10 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.23: +2 -1 + lines
Diff to previous 1.23 +

+BUGFIX in constructor with a client in release and releasedebug
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Thu Aug 30 17:07:36 2001 UTC (10 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.22: +15 -33 + lines
Diff to previous 1.22 +

+CHANGED: update procedure and time sync
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Wed Jul 18 16:13:22 2001 UTC (12 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.21: +2 -2 + lines
Diff to previous 1.21 +

+FIX: now when a callback is not found, doesn't nlerror
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:29:42 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.20: +6 -1 + lines
Diff to previous 1.20 +

+ADDED: stat information (queue size)
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Thu Jun 21 12:33:00 2001 UTC (13 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.19: +3 -1 + lines
Diff to previous 1.19 +

+ADDED: nlassert when sockid is invalid and destroy the structure on the dtor
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:06:18 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.18: +118 -7 + lines
Diff to previous 1.18 +

+Added layer 3 support for message recorder
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Thu Jun 14 13:55:10 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.17: +4 -2 + lines
Diff to previous 1.17 +

+REMOVE: thread id check commented because some people use this class in different thread
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Wed Jun 13 12:11:14 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +2 -3 + lines
Diff to previous 1.16 +

+#BUGFIX: on threadid
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Wed Jun 13 10:22:26 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +24 -2 + lines
Diff to previous 1.15 +

+FIXED: add assert and multithread check
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Tue Jun 12 15:41:11 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +90 -52 + lines
Diff to previous 1.14 +

+CHANGED: the update policy (look service.dxt for more info)
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Thu Jun 7 16:16:47 2001 UTC (13 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.13: +2 -1 + lines
Diff to previous 1.13 +

+#DOC: added some comments on an assert
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Tue Jun 5 15:37:00 2001 UTC (13 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +18 -18 + lines
Diff to previous 1.12 +

+CHANGED: the name of the suffix for debug information
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Tue May 29 12:14:15 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +2 -2 + lines
Diff to previous 1.11 +

+#remove a debug that flood the output
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Tue May 29 09:30:08 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.10: +23 -23 + lines
Diff to previous 1.10 +

+MODIFIED: reformated the output message to be filtered easier
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Thu May 17 15:36:45 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.9: +2 -2 + lines
Diff to previous 1.9 +

+#Typos
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Thu May 10 08:19:27 2001 UTC (14 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.8: +13 -7 + lines
Diff to previous 1.8 +

+BUGFIX: addCallbackArray now ignores empty array. callback are called with a good sockid
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Fri May 4 09:53:42 2001 UTC (14 months, 3 weeks ago) by coutelas +
Branch: MAIN + +
Changes since 1.7: +7 -4 + lines
Diff to previous 1.7 +

+BUGFIX: don't crash when you set NULL to authorizeOnly
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.6: +263 -56 + lines
Diff to previous 1.6 +

+ADD: new version of the network system (in NeL and NeLns)
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Tue Apr 3 08:58:20 2001 UTC (15 months, 3 weeks ago) by cado +
Branch: MAIN + +
CVS Tags: net_0_1 +
Changes since 1.5: +8 -2 + lines
Diff to previous 1.5 +

+ADDED timeout argument in update()
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu Mar 15 15:08:50 2001 UTC (16 months, 2 weeks ago) by coutelas +
Branch: MAIN + +
Changes since 1.4: +5 -1 + lines
Diff to previous 1.4 +

+ADDED: method setTimeout
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Fri Feb 23 15:44:30 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.3: +3 -13 + lines
Diff to previous 1.3 +

+#TNetCallback for connection callbacks
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri Feb 23 09:48:38 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+#DOCFIX
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu Feb 22 18:04:25 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.1: +61 -6 + lines
Diff to previous 1.1 +

+ADD: layer4 implemented by CMsgSocket
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Thu Feb 22 16:18:35 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Diff

+#ADD: network layer4 interface
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/callback_server.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/callback_server.cpp?sortby=date new file mode 100644 index 00000000..18dbfe6e --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/callback_server.cpp?sortby=date @@ -0,0 +1,359 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / callback_server.cpp
+ + + + + +
callback_server.cpp
+

+

Default branch: MAIN
+


+ Revision 1.22 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.21: +4 -5 + lines
Diff to previous 1.21 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Tue May 21 16:37:38 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.20: +8 -7 + lines
Diff to previous 1.20 +

+CHANGED: serial/send/receive 3 time faster
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.19: +2 -2 + lines
Diff to previous 1.19 +

+CHANGED: removed some debug info
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Fri Feb 15 14:40:04 2002 UTC (5 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.18: +3 -2 + lines
Diff to previous 1.18 +

+REMOVED: sendAllMyAssociation () is not use
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.17: +2 -2 + lines
Diff to previous 1.17 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +8 -8 + lines
Diff to previous 1.16 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:12:48 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +3 -3 + lines
Diff to previous 1.15 +

+#english fix (sended->sent finnish->finish)
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Thu Oct 25 12:13:02 2001 UTC (9 months ago) by cado +
Branch: MAIN + +
Changes since 1.14: +2 -2 + lines
Diff to previous 1.14 +

+Compilfix: nlassertex in debug mode
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:22:26 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.13: +2 -1 + lines
Diff to previous 1.13 +

+ADDED: default callback
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:29:42 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.12: +14 -3 + lines
Diff to previous 1.12 +

+ADDED: stat information (queue size)
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Thu Jun 21 12:33:00 2001 UTC (13 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +5 -1 + lines
Diff to previous 1.11 +

+ADDED: nlassert when sockid is invalid and destroy the structure on the dtor
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:06:18 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.10: +266 -7 + lines
Diff to previous 1.10 +

+Added layer 3 support for message recorder
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Wed Jun 13 10:22:26 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +16 -3 + lines
Diff to previous 1.9 +

+FIXED: add assert and multithread check
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Tue Jun 12 15:41:11 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.8: +2 -2 + lines
Diff to previous 1.8 +

+CHANGED: the update policy (look service.dxt for more info)
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Fri Jun 1 13:42:30 2001 UTC (13 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.7: +3 -2 + lines
Diff to previous 1.7 +

+MODIFIED: no size limit anymore
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Tue May 29 09:30:08 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.6: +6 -6 + lines
Diff to previous 1.6 +

+MODIFIED: reformated the output message to be filtered easier
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +62 -54 + lines
Diff to previous 1.5 +

+ADD: new version of the network system (in NeL and NeLns)
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Mon Feb 26 15:13:30 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
CVS Tags: net_0_1 +
Changes since 1.4: +5 -3 + lines
Diff to previous 1.4 +

+#small changes
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Fri Feb 23 15:44:30 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.3: +2 -11 + lines
Diff to previous 1.3 +

+#TNetCallback for connection callbacks
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri Feb 23 09:48:28 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.2: +11 -2 + lines
Diff to previous 1.2 +

+#ADD: listenAddress()
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu Feb 22 18:04:25 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Changes since 1.1: +41 -7 + lines
Diff to previous 1.1 +

+ADD: layer4 implemented by CMsgSocket
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Thu Feb 22 16:18:35 2001 UTC (17 months ago) by cado +
Branch: MAIN + +
Diff

+#ADD: network layer4 interface
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?rev=1.38&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?rev=1.38&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..4986879c --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?rev=1.38&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,452 @@ + + + +code/nel/src/net/inet_address.cpp - view - 1.38 + +
[BACK] Return to inet_address.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / inet_address.cpp (download)
+Revision 1.38, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN +
CVS Tags: georges_v2, HEAD
Changes since 1.37: +3 -6 + lines
+ADDED: support of precompilated header on visual
+
+

/** \file inet_address.cpp
+ * Class CInetAddress (IP address + port)
+ *
+ * $Id: inet_address.cpp,v 1.38 2001/12/28 10:17:21 lecroart Exp $
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/net/inet_address.h"
+#include "nel/net/sock.h"
+
+#ifdef NL_OS_WINDOWS
+
+#include <winsock2.h>
+
+#elif defined NL_OS_UNIX
+
+#include <unistd.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netdb.h>
+
+#define WSAGetLastError() 0
+#define SOCKET_ERROR -1
+
+#endif
+
+
+using namespace std;
+
+
+namespace NLNET
+{
+
+bool CInetAddress::RetrieveNames = true;
+
+
+/*
+ * Constructor
+ */
+CInetAddress::CInetAddress() :
+  _Valid( false )
+{
+        init();
+        _SockAddr->sin_port = 0; // same as htons(0)
+        memset( &_SockAddr->sin_addr, 0, sizeof(in_addr) ); // same as htonl(INADDR_ANY)
+}
+
+
+/*
+ * Constructor with ip address, port=0
+ */
+CInetAddress::CInetAddress( const in_addr *ip )
+{
+        init();
+        _SockAddr->sin_port = 0;
+        memcpy( &_SockAddr->sin_addr, ip, sizeof(in_addr) );
+}
+
+
+/*
+ * Alternate constructor (calls setByName())
+ */
+CInetAddress::CInetAddress( const std::string& hostName, uint16 port ) :
+        _Valid( false )
+{
+        init();
+        setPort( port );
+        setByName( hostName );
+}
+
+
+/*
+ * Alternate constructor (calls setNameAndPort())
+ */
+CInetAddress::CInetAddress( const std::string& hostNameAndPort ) :
+        _Valid( false )
+{
+        init();
+        setNameAndPort( hostNameAndPort );
+}
+
+
+/*
+ * Copy constructor
+ */
+CInetAddress::CInetAddress( const CInetAddress& other ) :
+        _Valid( false )
+{
+        init();
+        _HostName = other._HostName;
+        memcpy( _SockAddr, other._SockAddr, sizeof( *_SockAddr ) );
+        _Valid = other._Valid;
+}
+
+
+/*
+ * Assignment operator
+ */
+CInetAddress& CInetAddress::operator=( const CInetAddress& other )
+{
+        _HostName = other._HostName;
+        memcpy( _SockAddr, other._SockAddr, sizeof( *_SockAddr ) );
+        _Valid = other._Valid;
+        return *this;
+}
+
+
+/*
+ * Comparison == operator
+ */
+bool operator==( const CInetAddress& a1, const CInetAddress& a2 )
+{
+        // Compares the sockaddr structure except the last 8 bytes equal to zero.
+        return ( memcmp( a1._SockAddr, a2._SockAddr, sizeof(sockaddr_in)-8 ) == 0 );
+}
+
+
+/*
+ * Comparison < operator
+ */
+bool operator<( const CInetAddress& a1, const CInetAddress& a2 )
+{
+#ifdef NL_OS_WINDOWS
+        if ( a1._SockAddr->sin_addr.S_un.S_addr == a2._SockAddr->sin_addr.S_un.S_addr )
+        {
+                return ( a1.port() < a2.port() );
+        }
+        else
+        {
+                return ( a1._SockAddr->sin_addr.S_un.S_addr < a2._SockAddr->sin_addr.S_un.S_addr );
+        }
+#elif defined NL_OS_UNIX
+        if ( a1._SockAddr->sin_addr.s_addr == a2._SockAddr->sin_addr.s_addr )
+        {
+                return ( a1.port() < a2.port() );
+        }
+        else
+        {
+                return ( a1._SockAddr->sin_addr.s_addr < a2._SockAddr->sin_addr.s_addr );
+        }
+#endif  
+}
+
+
+/*
+ * Constructor contents
+ */
+void CInetAddress::init()
+{
+        CSock::initNetwork(); /// \todo cado: handle exception (because init() is called within a constructor)
+        
+        _SockAddr = new sockaddr_in;
+        _SockAddr->sin_family = AF_INET;
+        memset( _SockAddr->sin_zero, 0, 8 );
+}
+
+
+/*
+ * Destructor
+ */
+CInetAddress::~CInetAddress()
+{
+        delete _SockAddr;
+        // _Valid = false;
+}
+
+
+/*
+ * Sets hostname and port (ex: www.nevrax.com:80)
+ */
+void CInetAddress::setNameAndPort( const std::string& hostNameAndPort )
+{
+        int pos = hostNameAndPort.find_first_of (':');
+        if (pos != string::npos)
+        {
+                setPort( atoi(hostNameAndPort.substr(pos + 1).c_str()) );
+        }
+        else
+        {
+                setPort( 0 );
+        }
+
+        // if pos == -1, it will copy all the string
+        setByName( hostNameAndPort.substr (0, pos) );
+}
+
+
+/*
+ * Resolves a name
+ */
+CInetAddress& CInetAddress::setByName( const std::string& hostName )
+{
+        // Try to convert directly for addresses such as a.b.c.d
+        in_addr iaddr;
+#ifdef NL_OS_WINDOWS
+        iaddr.S_un.S_addr = inet_addr( hostName.c_str() );
+        if ( iaddr.S_un.S_addr == INADDR_NONE )
+#elif defined NL_OS_UNIX
+        iaddr.s_addr = inet_addr( hostName.c_str() );
+        if ( iaddr.s_addr == INADDR_NONE )
+#endif
+        {
+
+                // Otherwise use the traditional DNS look-up
+                hostent *phostent = gethostbyname( hostName.c_str() );
+                if ( phostent == NULL )
+                {
+                        _Valid = false;
+                        nldebug( "LNETL0: Network error: resolution of hostname '%s' failed", hostName.c_str() );
+                        // return *this;
+                        throw ESocket( (string("Hostname resolution failed for ")+hostName).c_str() );
+                }
+                _HostName = string( phostent->h_name );
+                memcpy( &_SockAddr->sin_addr, phostent->h_addr, sizeof(in_addr) );
+        }
+        else
+        {
+                _HostName = hostName;
+                memcpy( &_SockAddr->sin_addr, &iaddr, sizeof(iaddr) );
+        }
+        _Valid = true;
+        return *this;
+}
+
+
+/*
+ * Sets port
+ */
+void CInetAddress::setPort( uint16 port )
+{
+        _SockAddr->sin_port = htons( port );
+
+}
+
+
+/* Sets internal socket address directly (contents is copied).
+ * It also retrieves the host name if CInetAddress::RetrieveNames is true.
+ */
+void CInetAddress::setSockAddr( const sockaddr_in* saddr )
+{
+        memcpy( _SockAddr, saddr, sizeof(*saddr) );
+
+        // Get host name
+        // Warning: when it can't find it, it take more than 4 seconds
+        if ( CInetAddress::RetrieveNames )
+        {
+                hostent *phostent = gethostbyaddr( (char*)&saddr->sin_addr.s_addr, 4,  AF_INET );
+                if ( phostent == NULL )
+                {
+                        _HostName = ipAddress();
+                }
+                else
+                {
+                        _HostName = string( phostent->h_name );
+                }
+        }
+        _Valid = true;
+}
+
+
+/*
+ * Returns if object (address and port) is valid
+ */
+bool CInetAddress::isValid() const
+{
+        return ( _Valid && _SockAddr->sin_port!=0 ); // same as ntohs(0)
+}
+
+
+/*
+ * Returns internal socket address (read only)
+ */
+const sockaddr_in *CInetAddress::sockAddr() const
+{
+        return _SockAddr;
+}
+
+
+/*
+ * Returns internal IP address
+ */
+uint32 CInetAddress::internalIPAddress() const
+{
+        return _SockAddr->sin_addr.s_addr;
+}
+
+
+/*
+ * Returns readable IP address. (ex: "195.68.21.195")
+ */
+string CInetAddress::ipAddress() const
+{
+        /*stringstream ss; // or use inet_ntoa
+        ss << inet_ntoa ( _SockAddr->sin_addr );
+        return ss.str();*/
+        return string( inet_ntoa( _SockAddr->sin_addr ) );
+}
+
+
+/*
+ * Returns host name. (ex: "www.nevrax.org")
+ */
+const string& CInetAddress::hostName() const
+{
+        return _HostName;
+}
+
+
+/*
+ * Returns port
+ */
+uint16 CInetAddress::port() const
+{
+        return ntohs( _SockAddr->sin_port );
+}
+
+
+/*
+ * Returns hostname and port as a string. (ex: "www.nevrax.org:80 (195.68.21.195)")
+ */
+std::string CInetAddress::asString() const
+{
+        stringstream ss;
+        ss << hostName() << ":" << port() << " (" << ipAddress() << ")";
+        return ss.str();
+}
+
+
+/*
+ * Returns IP address and port as a string. (ex: "195.68.21.195:80")
+ */
+std::string CInetAddress::asIPString() const
+{
+        stringstream ss;
+        ss << ipAddress() << ":" << port();
+        return ss.str();
+}
+
+
+/*
+ * Serialize
+ */
+void CInetAddress::serial( NLMISC::IStream& s )
+{
+        NLMISC::CMemStream *ms = dynamic_cast<NLMISC::CMemStream*>(&s);
+        if ( ms && ms->stringMode() )
+        {
+                // String stream
+                string addrs;
+                if ( ms->isReading() )
+                {
+                        ms->serial( addrs );
+                        setNameAndPort( addrs );
+                }
+                else
+                {
+                        addrs = asIPString();
+                        ms->serial( addrs );
+                }
+        }
+        else
+        {
+                // Binary stream
+                s.serialBuffer( (uint8*)_SockAddr, sizeof(*_SockAddr) ); // this is possible only because the contents of _SockAddr is platform-independant !
+                s.serial( _Valid );
+        }
+
+        // Common
+        s.serial( _Valid );
+}
+
+
+/*
+ * Creates a CInetAddress object with local host address, port=0
+ */
+CInetAddress CInetAddress::localHost()
+{
+        const uint maxlength = 80;
+        char localhost [maxlength];
+        if ( gethostname( localhost, maxlength ) != 0 )
+                throw ESocket( "Unable to get local hostname" );
+        CInetAddress localaddr = CInetAddress( string(localhost) );
+        nlassert( localaddr.ipAddress() != "127.0.0.1" );
+        return localaddr;
+}
+
+
+/* Returns the list of the local host addresses (with port=0)
+ * (especially useful if the host is multihomed)
+ */
+std::vector<CInetAddress> CInetAddress::localAddresses()
+{
+        // 1. Get local host name
+        const uint maxlength = 80;
+        char localhost [maxlength];
+        if ( gethostname( localhost, maxlength ) == SOCKET_ERROR )
+        {
+                throw ESocket( "Unable to get local hostname" );
+        }
+
+        // 2. Get address list
+    hostent *phostent = gethostbyname( localhost );
+    if ( phostent == NULL )
+        {
+                throw ESocket( (string("Hostname resolution failed for ")+string(localhost)).c_str() );
+        }
+        uint i;
+        vector<CInetAddress> vect;
+    for ( i=0; phostent->h_addr_list[i]!=0; ++i )
+        {
+                vect.push_back( CInetAddress( (const in_addr*)(phostent->h_addr_list[i]) ) );
+    } 
+        return vect;
+}
+
+
+} // NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?sortby=date new file mode 100644 index 00000000..139a2275 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/inet_address.cpp?sortby=date @@ -0,0 +1,533 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / inet_address.cpp
+ + + + + +
inet_address.cpp
+

+

Default branch: MAIN
+


+ Revision 1.38 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.37: +3 -6 + lines
Diff to previous 1.37 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.37 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.36: +2 -2 + lines
Diff to previous 1.36 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.36 / (download) - annotate - [select for diffs] +, Thu Oct 25 12:12:03 2001 UTC (9 months ago) by cado +
Branch: MAIN + +
Changes since 1.35: +20 -26 + lines
Diff to previous 1.35 +

+ADDED multiformat mem stream
+
+

+ Revision 1.35 / (download) - annotate - [select for diffs] +, Fri Sep 28 12:53:48 2001 UTC (9 months, 4 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.34: +2 -1 + lines
Diff to previous 1.34 +

+#BUGFIX: SOCKET_ERROR missing
+
+

+ Revision 1.34 / (download) - annotate - [select for diffs] +, Fri Sep 28 12:39:44 2001 UTC (9 months, 4 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.33: +41 -1 + lines
Diff to previous 1.33 +

+ADDED address enumeration, multihomed hosts support
+
+

+ Revision 1.33 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:31:19 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.32: +2 -2 + lines
Diff to previous 1.32 +

+DOCFIX: change todo syntax
+
+

+ Revision 1.32 / (download) - annotate - [select for diffs] +, Thu Jun 21 08:45:13 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.31: +2 -2 + lines
Diff to previous 1.31 +

+Doxfix: added file desc
+
+

+ Revision 1.31 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:01:01 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.30: +55 -19 + lines
Diff to previous 1.30 +

+Added serialization to string stream
+
+

+ Revision 1.30 / (download) - annotate - [select for diffs] +, Tue May 15 14:45:38 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.29: +2 -2 + lines
Diff to previous 1.29 +

+Changed serialization : no longer transfers the hostname
+
+

+ Revision 1.29 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.28: +43 -12 + lines
Diff to previous 1.28 +

+ADD: new version of the network system (in NeL and NeLns)
+
+

+ Revision 1.28 / (download) - annotate - [select for diffs] +, Wed Mar 28 09:35:47 2001 UTC (16 months ago) by cado +
Branch: MAIN + +
CVS Tags: net_0_1 +
Changes since 1.27: +4 -3 + lines
Diff to previous 1.27 +

+Small change in the way CInetAddress::ipAddress() works
+
+

+ Revision 1.27 / (download) - annotate - [select for diffs] +, Thu Mar 15 18:02:15 2001 UTC (16 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.26: +4 -3 + lines
Diff to previous 1.26 +

+localHost() didn't compile on Linux
+
+

+ Revision 1.26 / (download) - annotate - [select for diffs] +, Thu Mar 15 16:41:16 2001 UTC (16 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.25: +3 -2 + lines
Diff to previous 1.25 +

+ADDED IP display in asString() + assert in localHost()
+
+

+ Revision 1.25 / (download) - annotate - [select for diffs] +, Tue Jan 16 11:23:03 2001 UTC (18 months, 1 week ago) by cado +
Branch: MAIN + +
CVS Tags: proto_0_2, +proto_0_1, +nel_0_3, +nel_0_2 +
Changes since 1.24: +2 -2 + lines
Diff to previous 1.24 +

+no message
+
+

+ Revision 1.24 / (download) - annotate - [select for diffs] +, Mon Jan 15 14:44:26 2001 UTC (18 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.23: +3 -3 + lines
Diff to previous 1.23 +

+no message
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Mon Jan 15 13:40:57 2001 UTC (18 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.22: +3 -3 + lines
Diff to previous 1.22 +

+better error handling for sockets
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Tue Jan 2 14:39:21 2001 UTC (18 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.21: +7 -5 + lines
Diff to previous 1.21 +

+small debug and doc update
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Mon Nov 27 10:43:50 2000 UTC (20 months ago) by cado +
Branch: MAIN + +
Changes since 1.20: +6 -3 + lines
Diff to previous 1.20 +

+Mod. setSockAddr()
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Mon Nov 27 10:07:07 2000 UTC (20 months ago) by cado +
Branch: MAIN + +
Changes since 1.19: +3 -3 + lines
Diff to previous 1.19 +

+Removed somes warnings
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Thu Nov 23 13:09:50 2000 UTC (20 months ago) by cado +
Branch: MAIN + +
Changes since 1.18: +3 -2 + lines
Diff to previous 1.18 +

+Using config file for the naming client
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Wed Nov 22 15:56:47 2000 UTC (20 months ago) by cado +
Branch: MAIN + +
Changes since 1.17: +29 -2 + lines
Diff to previous 1.17 +

+Naming service now allocates port numbers
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Tue Nov 21 17:30:55 2000 UTC (20 months ago) by valignat +
Branch: MAIN + +
Changes since 1.16: +13 -3 + lines
Diff to previous 1.16 +

+Add GNU/Linux support and use the inet_ntoa function to keep it as compatible
+as possible
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Wed Nov 15 10:26:22 2000 UTC (20 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.15: +4 -4 + lines
Diff to previous 1.15 +

+Removed throw ()
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Tue Oct 24 15:35:51 2000 UTC (21 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +10 -10 + lines
Diff to previous 1.14 +

+new copyright headers
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Wed Oct 11 16:25:25 2000 UTC (21 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.13: +2 -2 + lines
Diff to previous 1.13 +

+Improved NamingClient
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Wed Oct 11 13:23:50 2000 UTC (21 months, 2 weeks ago) by valignat +
Branch: MAIN + +
Changes since 1.12: +3 -3 + lines
Diff to previous 1.12 +

+Change NL_OS_LINUX to NL_OS_UNIX to make it more unix "generic"
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Tue Oct 10 15:28:15 2000 UTC (21 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.11: +11 -1 + lines
Diff to previous 1.11 +

+Added CNamingClient
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Mon Oct 9 08:46:29 2000 UTC (21 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.10: +2 -2 + lines
Diff to previous 1.10 +

+Updated CLog
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Wed Oct 4 14:34:10 2000 UTC (21 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.9: +11 -6 + lines
Diff to previous 1.9 +

+Improved logging system
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Tue Oct 3 13:27:12 2000 UTC (21 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.8: +1 -4 + lines
Diff to previous 1.8 +

+Changed name from CServerSocket to CMsgSocket...
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Mon Oct 2 16:42:23 2000 UTC (21 months, 3 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.7: +37 -3 + lines
Diff to previous 1.7 +

+Message system.
+CDatagram needs some modifications to work.
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Mon Sep 25 15:01:47 2000 UTC (22 months ago) by cado +
Branch: MAIN + +
Changes since 1.6: +6 -4 + lines
Diff to previous 1.6 +

+updated code doc
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Mon Sep 25 11:14:23 2000 UTC (22 months ago) by cado +
Branch: MAIN + +
Changes since 1.5: +2 -1 + lines
Diff to previous 1.5 +

+First net logging system (CNetDisplayer, CLogService)
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu Sep 21 09:45:09 2000 UTC (22 months ago) by cado +
Branch: MAIN + +
Changes since 1.4: +4 -4 + lines
Diff to previous 1.4 +

+added CDatagramSocket, upgraded and tested OK all other network classes
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Tue Sep 19 09:14:03 2000 UTC (22 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.3: +15 -5 + lines
Diff to previous 1.3 +

+Updated comments
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Mon Sep 18 17:13:15 2000 UTC (22 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.2: +72 -28 + lines
Diff to previous 1.2 +

+CSocket, CServerSocket, CInetAddress and CMessage were tested and seem to work fine.
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu Sep 14 16:40:53 2000 UTC (22 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.1: +3 -3 + lines
Diff to previous 1.1 +

+Corrected some missings #include problems
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Thu Sep 14 16:17:21 2000 UTC (22 months, 1 week ago) by lecroart +
Branch: MAIN + +
Diff

+new net directory
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/listen_sock.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/listen_sock.cpp?sortby=date new file mode 100644 index 00000000..e32b7488 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/listen_sock.cpp?sortby=date @@ -0,0 +1,196 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / listen_sock.cpp
+ + + + + +
listen_sock.cpp
+

+

Default branch: MAIN
+


+ Revision 1.6 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.5: +2 -2 + lines
Diff to previous 1.5 +

+CHANGED: removed some debug info
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +3 -3 + lines
Diff to previous 1.4 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.3: +6 -6 + lines
Diff to previous 1.3 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:12:48 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+#english fix (sended->sent finnish->finish)
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:31:19 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.1: +2 -3 + lines
Diff to previous 1.1 +

+DOCFIX: change todo syntax
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/login_client.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/login_client.cpp?sortby=date new file mode 100644 index 00000000..69a5a7b6 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/login_client.cpp?sortby=date @@ -0,0 +1,276 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / login_client.cpp
+ + + + + +
login_client.cpp
+

+

Default branch: MAIN
+


+ Revision 1.14 / (download) - annotate - [select for diffs] +, Mon Feb 11 10:20:54 2002 UTC (5 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.13: +4 -4 + lines
Diff to previous 1.13 +

+CHANGED: remove nlsleep(0) and set to 10
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Mon Jan 14 17:51:26 2002 UTC (6 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +2 -2 + lines
Diff to previous 1.12 +

+#infochanged
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Fri Dec 28 15:36:14 2001 UTC (6 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +38 -4 + lines
Diff to previous 1.11 +

+ADDED: udp mode for login system
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.10: +2 -5 + lines
Diff to previous 1.10 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Thu Nov 22 10:40:13 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +4 -4 + lines
Diff to previous 1.9 +

+TRY: change nlSleep(10) into nlSleep(0)
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:22:03 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.8: +4 -1 + lines
Diff to previous 1.8 +

+CHANGED: new compatability with the unified network protocole
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Mon Jul 2 14:27:33 2001 UTC (12 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.7: +2 -1 + lines
Diff to previous 1.7 +

+BUGFIX: linux doesn't receive the message just before the disconnection
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Mon Jul 2 11:44:18 2001 UTC (12 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.6: +7 -4 + lines
Diff to previous 1.6 +

+BUGFIX: fix the bad if test expression causing on linux bad results on authentification
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Thu Jun 21 09:00:44 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.5: +4 -1 + lines
Diff to previous 1.5 +

+Doxfix: added file desc
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Wed Jun 13 10:21:33 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +43 -18 + lines
Diff to previous 1.4 +

+FIXED: release CCallbackClient at dtor
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Thu May 3 13:30:01 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.3: +2 -2 + lines
Diff to previous 1.3 +

+BUGFIX: forgot .c_str() in nldebug
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Wed May 2 12:57:16 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+BUGFIX: forgot some c_str() and new lines
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Wed May 2 12:54:13 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +6 -5 + lines
Diff to previous 1.1 +

+BUGFIX: forgot to change v2 to nel/net
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/login_cookie.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/login_cookie.cpp?sortby=date new file mode 100644 index 00000000..49ed66c3 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/login_cookie.cpp?sortby=date @@ -0,0 +1,166 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / login_cookie.cpp
+ + + + + +
login_cookie.cpp
+

+

Default branch: MAIN
+


+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:31:20 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.1: +2 -2 + lines
Diff to previous 1.1 +

+DOCFIX: change todo syntax
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?rev=1.16&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?rev=1.16&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..f68bcdc7 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?rev=1.16&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,506 @@ + + + +code/nel/src/net/login_server.cpp - view - 1.16 + +
[BACK] Return to login_server.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / login_server.cpp (download)
+Revision 1.16, Tue Mar 26 09:44:47 2002 UTC (4 months ago) by lecroart +
Branch: MAIN +
CVS Tags: georges_v2, HEAD
Changes since 1.15: +57 -20 + lines
+CHANGED: unified the command format
+
+

/** \file login_server.cpp
+ * CLoginServer is the interface used by the front end to accepts authenticate users.
+ *
+ * $Id: login_server.cpp,v 1.16 2002/03/26 09:44:47 lecroart Exp $
+ *
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/net/callback_client.h"
+#include "nel/net/service.h"
+
+#include "nel/net/login_cookie.h"
+#include "nel/net/login_server.h"
+
+#include "nel/net/udp_sock.h"
+
+using namespace std;
+using namespace NLMISC;
+
+namespace NLNET {
+
+struct CPendingUser
+{
+        CPendingUser (const CLoginCookie &cookie) : Cookie (cookie) { }
+        CLoginCookie Cookie;
+};
+
+static list<CPendingUser> PendingUsers;
+
+static CCallbackServer *Server;
+static string ListenAddr;
+
+static TDisconnectClientCallback DisconnectClientCallback = NULL;
+
+/// contains the correspondance between userid and the sockid
+map<uint32, TSockId> UserIdSockAssociations;
+
+TNewClientCallback NewClientCallback = NULL;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+///////////// CONNECTION TO THE WELCOME SERVICE //////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void cbWSChooseShard (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        // the WS call me that a new client want to come in my shard
+        string reason;
+        CLoginCookie cookie;
+        
+        //
+        // S08: receive "CS" message from WS and send "SCS" message to WS
+        //
+
+        msgin.serial (cookie);
+
+        list<CPendingUser>::iterator it;
+        for (it = PendingUsers.begin(); it != PendingUsers.end (); it++)
+        {
+                if ((*it).Cookie == cookie)
+                {
+                        // the cookie already exists, erase it and return false
+                        nlwarning ("cookie %s is already in the pending user list", cookie.toString().c_str());
+                        PendingUsers.erase (it);
+                        reason = "cookie already exists";
+                        break;
+                }
+        }
+        if (it == PendingUsers.end ())
+        {
+                // add it to the awaiting client
+                PendingUsers.push_back (CPendingUser (cookie));
+                reason = "";
+        }
+
+        CMessage msgout (CNetManager::getSIDA ("WS"), "SCS");
+        msgout.serial (reason);
+        msgout.serial (cookie);
+        msgout.serial (ListenAddr);
+        CNetManager::send ("WS", msgout);
+}
+
+void cbWSChooseShard5 (CMessage &msgin, const std::string &serviceName, uint16 sid)
+{
+        // the WS call me that a new client want to come in my shard
+        string reason;
+        CLoginCookie cookie;
+        
+        //
+        // S08: receive "CS" message from WS and send "SCS" message to WS
+        //
+
+        msgin.serial (cookie);
+
+        list<CPendingUser>::iterator it;
+        for (it = PendingUsers.begin(); it != PendingUsers.end (); it++)
+        {
+                if ((*it).Cookie == cookie)
+                {
+                        // the cookie already exists, erase it and return false
+                        nlwarning ("cookie %s is already in the pending user list", cookie.toString().c_str());
+                        PendingUsers.erase (it);
+                        reason = "cookie already exists";
+                        break;
+                }
+        }
+        if (it == PendingUsers.end ())
+        {
+                // add it to the awaiting client
+                nlinfo ("New cookie %s inserted in the pending user list (awaiting new client)", cookie.toString().c_str());
+                PendingUsers.push_back (CPendingUser (cookie));
+                reason = "";
+        }
+
+        CMessage msgout ("SCS");
+        msgout.serial (reason);
+        msgout.serial (cookie);
+        msgout.serial (ListenAddr);
+        CUnifiedNetwork::getInstance()->send ("WS", msgout);
+}
+
+void cbWSDisconnectClient5 (CMessage &msgin, const std::string &serviceName, uint16 sid)
+{
+        // the WS tells me that i have to disconnect a client
+
+        uint32 userid;
+        msgin.serial (userid);
+
+        map<uint32, TSockId>::iterator it = UserIdSockAssociations.find (userid);
+        if (it == UserIdSockAssociations.end ())
+        {
+                nlwarning ("Can't disconnect the user %d, he is not found", userid);
+        }
+        else
+        {
+                nlinfo ("Disconnect the user %d", userid);
+                Server->disconnect ((*it).second);
+        }
+
+        if (DisconnectClientCallback != NULL)
+        {
+                DisconnectClientCallback (userid);
+        }
+}
+
+void cbWSDisconnectClient (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        cbWSDisconnectClient5 (msgin, "", 0);
+}
+
+static TCallbackItem WSCallbackArray[] =
+{
+        { "CS", cbWSChooseShard },
+        { "DC", cbWSDisconnectClient },
+};
+
+static TUnifiedCallbackItem WSCallbackArray5[] =
+{
+        { "CS", cbWSChooseShard5 },
+        { "DC", cbWSDisconnectClient5 },
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+///////////// CONNECTION TO THE CLIENT ///////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void cbShardValidation (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        //
+        // S13: receive "SV" message from client
+        //
+
+        // the client send me a cookie
+        CLoginCookie cookie;
+        string reason;
+        msgin.serial (cookie);
+
+        // verify that the user was pending
+        reason = CLoginServer::isValidCookie (cookie);
+
+        CMessage msgout2 (netbase.getSIDA (), "SV");
+        msgout2.serial (reason);
+        netbase.send (msgout2, from);
+        
+        if (!reason.empty())
+        {
+                nlwarning ("User (%s) is not in the pending user list (cookie:%s)", netbase.hostAddress(from).asString().c_str(), cookie.toString().c_str());
+                // deconnect him
+                netbase.disconnect (from);
+        }
+        else
+        {
+                // add the user association
+                uint32 userid = cookie.getUserId();
+                UserIdSockAssociations.insert (make_pair(userid, from));
+
+                // identification OK, let's call the user callback
+                if (NewClientCallback != NULL)
+                        NewClientCallback (from, cookie);
+
+                // ok, now, he can call all callback
+                Server->authorizeOnly (NULL, from);
+        }
+}
+
+void ClientConnection (TSockId from, void *arg)
+{
+        nldebug("new client connection: %s", from->asString ().c_str ());
+
+        // the client could only call "SV" message
+        Server->authorizeOnly ("SV", from);
+}
+
+
+static const TCallbackItem ClientCallbackArray[] =
+{
+        { "SV", cbShardValidation },
+};
+
+void cfcbListenAddress (CConfigFile::CVar &var)
+{
+        // set the new ListenAddr
+        ListenAddr = var.asString();
+        
+        // is the var is empty or not found, take it from the listenAddress()
+        if (ListenAddr.empty())
+        {
+                ListenAddr = Server->listenAddress ().asIPString();
+        }
+
+        nlinfo("Listen Address trapped '%s'", ListenAddr.c_str());
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+///////////// CONNECTION TO THE WELCOME SERVICE //////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void CLoginServer::init (CCallbackServer &server, TNewClientCallback ncl)
+{
+        // connect to the welcome service
+        connectToWS ();
+
+        // add callback to the server
+        server.addCallbackArray (ClientCallbackArray, sizeof (ClientCallbackArray) / sizeof (ClientCallbackArray[0]));
+        server.setConnectionCallback (ClientConnection, NULL);
+
+        try
+        {
+                cfcbListenAddress (IService::getInstance()->ConfigFile.getVar("ListenAddress"));
+                IService::getInstance()->ConfigFile.setCallback("ListenAddress", cfcbListenAddress);
+        }
+        catch(Exception &)
+        {
+        }
+
+        // if the listen addr is not in the config file, try to find it dynamically
+        if (ListenAddr.empty())
+        {
+                ListenAddr = server.listenAddress ().asIPString();
+        }
+
+        nlinfo("Listen Address trapped '%s'", ListenAddr.c_str());
+
+        NewClientCallback = ncl;
+        Server = &server;
+}
+
+void CLoginServer::init (CUdpSock &server, TDisconnectClientCallback dc)
+{
+        // connect to the welcome service
+        connectToWS ();
+
+        try
+        {
+                cfcbListenAddress (IService::getInstance()->ConfigFile.getVar("ListenAddress"));
+                IService::getInstance()->ConfigFile.setCallback("ListenAddress", cfcbListenAddress);
+        }
+        catch(Exception &)
+        {
+        }
+        
+        // if the listen addr is not in the config file, try to find it dynamically
+        if (ListenAddr.empty())
+        {
+                ListenAddr = server.localAddr ().asIPString();
+        }
+
+        nlinfo("Listen Addresss trapped '%s'", ListenAddr.c_str());
+
+        DisconnectClientCallback = dc;
+}
+
+string CLoginServer::isValidCookie (const CLoginCookie &lc)
+{
+        // verify that the user was pending
+        list<CPendingUser>::iterator it;
+        for (it = PendingUsers.begin(); it != PendingUsers.end (); it++)
+        {
+                if ((*it).Cookie == lc)
+                {
+                        // ok, it was validate, remove it
+                        PendingUsers.erase (it);
+
+                        // warn the WS that the client effectively connected
+                        uint8 con = 1;
+                        CMessage msgout ("CC");
+                        uint32 userid = lc.getUserId();
+                        msgout.serial (userid);
+                        msgout.serial (con);
+
+                        if (CUnifiedNetwork::isUsed ())
+                        {
+                                CUnifiedNetwork::getInstance()->send("WS", msgout);
+                        }
+                        else
+                        {
+                                CNetManager::send("WS", msgout);
+                        }
+
+                        return "";
+                }
+        }
+        return "I didn't receive the cookie from WS";
+}
+
+void CLoginServer::connectToWS ()
+{
+        if (CUnifiedNetwork::isUsed ())
+        {
+                CUnifiedNetwork::getInstance()->addCallbackArray(WSCallbackArray5, sizeof(WSCallbackArray5)/sizeof(WSCallbackArray5[0]));
+        }
+        else
+        {
+                CNetManager::addClient ("WS");
+                CNetManager::addCallbackArray ("WS", WSCallbackArray, sizeof (WSCallbackArray) / sizeof (WSCallbackArray[0]));
+
+                CMessage        msg("UN_SIDENT");
+                nlassert (IService::getInstance());
+                uint16                ssid = IService::getInstance()->getServiceId();
+                string name = IService::getInstance()->getServiceShortName();
+                msg.serial(name);
+                msg.serial(ssid);        // serializes a 16 bits service id
+                CNetManager::send("WS", msg);
+        }
+}
+
+void CLoginServer::clientDisconnected (uint32 userId)
+{
+        uint8 con = 0;
+        CMessage msgout ("CC");
+        msgout.serial (userId);
+        msgout.serial (con);
+
+        if (CUnifiedNetwork::isUsed ())
+        {
+                CUnifiedNetwork::getInstance()->send("WS", msgout);
+        }
+        else
+        {
+                CNetManager::send("WS", msgout);
+        }
+
+        // remove the user association
+        UserIdSockAssociations.erase (userId);
+}
+
+//
+// Commands
+//
+
+NLMISC_COMMAND (lsUsers, "displays the list of all connected users", "")
+{
+        if(args.size() != 0) return false;
+
+        log.displayNL ("Display the %d connected users :", UserIdSockAssociations.size());
+        for (map<uint32, TSockId>::iterator it = UserIdSockAssociations.begin(); it != UserIdSockAssociations.end (); it++)
+        {
+                log.displayNL ("> %u %s", (*it).first, (*it).second->asString().c_str());
+        }
+        log.displayNL ("End ot the list");
+
+        return true;
+}
+
+NLMISC_COMMAND (lsPending, "displays the list of all pending users", "")
+{
+        if(args.size() != 0) return false;
+
+        log.displayNL ("Display the %d pending users :", PendingUsers.size());
+        for (list<CPendingUser>::iterator it = PendingUsers.begin(); it != PendingUsers.end (); it++)
+        {
+                log.displayNL ("> %s", (*it).Cookie.toString().c_str());
+        }
+        log.displayNL ("End ot the list");
+
+        return true;
+}
+
+
+NLMISC_DYNVARIABLE(string, LSListenAddress, "the listen address sended to the client to connect on this front_end")
+{
+        if (get)
+        {
+                *pointer = ListenAddr;
+        }
+        else
+        {
+                if ((*pointer).find (":") == string::npos)
+                {
+                        log.displayNL ("You must set the address + port (ie: \"itsalive.nevrax.org:38000\")");
+                        return;
+                }
+                else if ((*pointer).empty())
+                {
+                        ListenAddr = Server->listenAddress ().asIPString();
+                }
+                else
+                {
+                        ListenAddr = *pointer;
+                }
+                log.displayNL ("Listen Address trapped '%s'", ListenAddr.c_str());
+        }
+}
+
+
+} // NLNET
+
+
+/////////////////////////////////////////////
+/////////////////////////////////////////////
+/////////////////////////////////////////////
+/*
+#include "v2/service.h"
+
+using namespace std;
+using namespace NLNET;
+
+void ClientConnection (TSockId from, const CLoginCookie &cookie)
+{
+        nlinfo("player (%d) comes in", cookie.getUserId());
+        from->setAppId (cookie.getUserId());
+}
+
+void ClientDisconnection (TSockId from, void *arg)
+{
+        nlinfo("player (%d) leaves", from->appId());
+        CLoginServer::clientDisconnected (from->appId());
+
+}
+
+class CFrontEndService : public NLNET::IService
+{
+public:
+
+        /// Init the service, load the universal time.
+        void init ()
+        {
+                CLoginServer::init (dynamic_cast<CCallbackServer&>(*CNetManager::getNetBase ("FES")), ClientConnection);
+                CNetManager::getNetBase ("FES")->setDisconnectionCallback (ClientDisconnection, NULL);
+        }
+};
+
+
+/// Naming Service
+NLNET_SERVICE_MAIN (CFrontEndService, "FES", "front_end_service", 0);
+*/
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?sortby=date new file mode 100644 index 00000000..4252cd42 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/login_server.cpp?sortby=date @@ -0,0 +1,296 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / login_server.cpp
+ + + + + +
login_server.cpp
+

+

Default branch: MAIN
+


+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Mar 26 09:44:47 2002 UTC (4 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.15: +57 -20 + lines
Diff to previous 1.15 +

+CHANGED: unified the command format
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Mon Mar 25 09:23:07 2002 UTC (4 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +4 -4 + lines
Diff to previous 1.14 +

+CHANGED: use the new service
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Mon Mar 4 10:35:24 2002 UTC (4 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.13: +1 -3 + lines
Diff to previous 1.13 +

+#BUGFIX: sended 2 times a message
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Mon Jan 14 13:55:21 2002 UTC (6 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +44 -4 + lines
Diff to previous 1.12 +

+ADDED: can set the listen address manually
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Wed Jan 2 14:53:40 2002 UTC (6 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +3 -2 + lines
Diff to previous 1.11 +

+ADDED: UDP support
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Fri Dec 28 15:36:14 2001 UTC (6 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.10: +66 -50 + lines
Diff to previous 1.10 +

+ADDED: udp mode for login system
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +2 -7 + lines
Diff to previous 1.9 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Mon Oct 29 18:33:54 2001 UTC (8 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.8: +90 -8 + lines
Diff to previous 1.8 +

+ADDED: compatibility with layer4
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Fri Oct 26 13:51:56 2001 UTC (9 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.7: +7 -4 + lines
Diff to previous 1.7 +

+BUGFIX: try to access to an invalid iterator
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:22:03 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.6: +14 -15 + lines
Diff to previous 1.6 +

+CHANGED: new compatability with the unified network protocole
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Thu Oct 4 15:45:40 2001 UTC (9 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +3 -3 + lines
Diff to previous 1.5 +

+CHANGED: name of the command
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Wed Sep 5 17:19:48 2001 UTC (10 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.4: +35 -1 + lines
Diff to previous 1.4 +

+ADDED: commands for admin
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Thu Jun 21 08:45:13 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.3: +2 -1 + lines
Diff to previous 1.3 +

+Doxfix: added file desc
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Wed May 2 12:57:16 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +4 -4 + lines
Diff to previous 1.2 +

+BUGFIX: forgot some c_str() and new lines
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Wed May 2 12:54:13 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +7 -6 + lines
Diff to previous 1.1 +

+BUGFIX: forgot to change v2 to nel/net
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/message.cpp?rev=1.21&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/message.cpp?rev=1.21&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..0f2922b2 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/message.cpp?rev=1.21&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,343 @@ + + + +code/nel/src/net/message.cpp - view - 1.21 + +
[BACK] Return to message.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / message.cpp (download)
+Revision 1.21, Wed Jul 10 17:08:24 2002 UTC (2 weeks, 4 days ago) by lecroart +
Branch: MAIN +
CVS Tags: HEAD
Changes since 1.20: +2 -2 + lines
+REMOVE: a warning
+
+

/** \file message.cpp
+ * CMessage class
+ *
+ * $Id: message.cpp,v 1.21 2002/07/10 17:08:24 lecroart Exp $
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/net/message.h"
+
+/*#ifdef MESSAGES_PLAIN_TEXT
+#pragma message( "CMessage: compiling messages as plain text" )
+#else
+#pragma message( "CMessage: compiling messages as binary" )
+#endif*/
+
+namespace NLNET
+{
+
+bool CMessage::_DefaultStringMode = false;
+
+
+#define FormatLong 1
+#define FormatShort 0
+
+
+CMessage::CMessage (NLMISC::CStringIdArray &sida, const std::string &name, bool inputStream, TStreamFormat streamformat, uint32 defaultCapacity) :
+        NLMISC::CMemStream (inputStream, false, defaultCapacity),
+        _TypeSet (false), _SIDA (&sida), _HeaderSize(0xFFFFFFFF)
+{
+        init( name, streamformat );
+}
+
+CMessage::CMessage (const std::string &name, bool inputStream, TStreamFormat streamformat, uint32 defaultCapacity) :
+        NLMISC::CMemStream (inputStream, false, defaultCapacity),
+        _TypeSet (false), _SIDA (NULL), _HeaderSize(0xFFFFFFFF)
+{
+        init( name, streamformat );
+}
+
+
+/*
+ * Utility method
+ */
+void CMessage::init( const std::string &name, TStreamFormat streamformat )
+{
+        if ( streamformat == UseDefault )
+        {
+                setStringMode( _DefaultStringMode );
+        }
+        else
+        {
+                setStringMode( streamformat == String );
+        }
+
+        if (!name.empty())
+                setType (name);
+}
+
+
+CMessage::CMessage (NLMISC::CMemStream &memstr) :
+        _HeaderSize(0xFFFFFFFF)
+{
+        fill (memstr.buffer (), memstr.length ());
+        uint8 LongFormat=2;
+        serial (LongFormat);
+
+        if (LongFormat)
+        {
+                std::string name;
+                serial (name);
+                setType (name);
+        }
+        else
+        {
+                NLMISC::CStringIdArray::TStringId id;
+                serial (id);
+                setType (id);
+        }
+}
+
+
+/// Copy constructor
+CMessage::CMessage (const CMessage &other)
+{
+        operator= (other);
+}
+
+/// Assignment operator
+CMessage &CMessage::operator= (const CMessage &other)
+{
+        CMemStream::operator= (other);
+        _TypeSet = other._TypeSet;
+        _SIDA = other._SIDA;
+        TypeHasAnId = other.TypeHasAnId;
+        TypeHasAName = other.TypeHasAName;
+        _Name = other._Name;
+        _Id = other._Id;
+        _HeaderSize = other._HeaderSize;
+        return *this;
+
+}
+
+/// Sets the message type as a number (in range 0..32767) and put it in the buffer if we are in writing mode
+void CMessage::setType (NLMISC::CStringIdArray::TStringId id)
+{
+        // PATCH: the id system is not available
+        nlstop;
+
+        // check if we already do a setType ()
+        nlassert (!_TypeSet);
+        // don't accept negative value
+        nlassert (id >= 0 && id < pow(2, sizeof (NLMISC::CStringIdArray::TStringId)*8));
+
+        _Id = id;
+        TypeHasAnId = true;
+        TypeHasAName = false;
+
+        if (!isReading ())
+        {
+                // check if they don't already serial some stuffs
+                nlassert (length () == 0);
+
+                uint8 format = FormatLong | (_StringMode << 1);
+                nlinfo( "OUT format = %hu", (uint16)format );
+
+                // Force binary mode for header
+                bool msgmode = _StringMode;
+                _StringMode = false;
+
+                // debug features, we number all packet to be sure that they are all sent and received
+                // \todo remove this debug feature when ok
+                // this value will be fill after in the callback function
+                uint32 zeroValue = 123;
+                serial (zeroValue);
+
+                serial (format);
+
+                // End of binary header
+                _StringMode = msgmode;
+
+                serial (id);
+                _HeaderSize = getPos ();
+        }
+        else
+        {
+                // we set the id, now, we try to set the name if available in the sida
+                if (_SIDA != NULL)
+                {
+                        _Name = _SIDA->getString (id);
+                        TypeHasAName = true;
+                }
+        }
+
+        _TypeSet = true;
+}
+
+/// Sets the message type as a string and put it in the buffer if we are in writing mode
+void CMessage::setType (const std::string &name)
+{
+        // check if we already do a setType ()
+        nlassert (!_TypeSet);
+        // don't accept empty string
+        nlassert (!name.empty ());
+
+        _Name = name;
+        TypeHasAnId = false;
+        TypeHasAName = true;
+
+        if (!isReading ())
+        {
+                // check if they don't already serial some stuffs
+                nlassert (length () == 0);
+
+                // if we can send the id instead of the string, "just do it" (c)nike!
+                //NLMISC::CStringIdArray::TStringId id = _SIDA->getId (name);
+
+                // PATCH: always send in full text
+                NLMISC::CStringIdArray::TStringId id = -1;
+
+                // Force binary mode for header
+                bool msgmode = _StringMode;
+                _StringMode = false;
+
+                // debug features, we number all packet to be sure that they are all sent and received
+                // \todo remove this debug feature when ok
+                // this value will be fill after in the callback function
+                uint32 zeroValue = 123;
+                serial (zeroValue);
+
+                if (id == -1)
+                {
+                        uint8 format = FormatLong | (msgmode << 1);
+                        //nldebug( "OUT format = %hu", (uint16)format );
+                        serial (format);
+
+                        // End of binary header
+                        _StringMode = msgmode;
+
+                        serial ((std::string&)name);
+                }
+                else
+                {
+                        uint8 format = FormatShort | (msgmode << 1);
+                        //nldebug( "OUT format = %hu", (uint16)format );
+                        serial (format);
+
+                        // End of binary header
+                        _StringMode = msgmode;
+
+                        serial (id);
+
+                        _Id = id;
+                        TypeHasAnId = true;
+                }
+                _HeaderSize = getPos ();
+        }
+
+        _TypeSet = true;
+}
+
+/// Returns the size, in byte of the header that contains the type name of the message or the type number
+uint32 CMessage::getHeaderSize ()
+{
+        nlassert (!isReading ());
+        nlassert (_HeaderSize != 0xFFFFFFFF);
+        return _HeaderSize;
+}
+
+// The message was filled with an CMemStream, Now, we'll get the message type on this buffer
+void CMessage::readType ()
+{
+        nlassert (isReading ());
+
+        // debug features, we number all packet to be sure that they are all sent and received
+        // \todo remove this debug feature when ok
+
+        // we remove the message from the message
+        const uint HeaderSize = 4;
+        seek (HeaderSize, begin);
+//              uint32 zeroValue;
+//              serial (zeroValue);
+
+        // Force binary mode for header
+        _StringMode = false;
+
+        uint8 format;
+        serial (format);
+        //nldebug( "IN format = %hu", (uint16)format );
+        bool LongFormat = (format & 1);
+
+        // Set mode for the following of the buffer
+        _StringMode = (format >> 1) & 1;
+        if (LongFormat)
+        {
+                std::string name;
+                serial (name);
+                setType (name);
+        }
+        else
+        {
+                NLMISC::CStringIdArray::TStringId id;
+                serial (id);
+                setType (id);
+        }
+}
+
+// Returns true if the message type was already set
+bool CMessage::typeIsSet () const
+{
+        return _TypeSet;
+}
+
+// Clear the message. With this function, you can reuse a message to create another message
+void CMessage::clear ()
+{
+        CMemStream::clear ();
+        _TypeSet = false;
+}
+
+/// Returns the type name in string if available. Be sure that the message have the name of the message type
+std::string CMessage::getName () const
+{
+        nlassert (_TypeSet && TypeHasAName);
+        return _Name;
+}
+
+/// Returns the type id of this message is available.
+NLMISC::CStringIdArray::TStringId CMessage::getId () const
+{
+        nlassert (_TypeSet && TypeHasAnId);
+        return _Id;
+}
+
+/** Returns a readable string to display it to the screen. It's only for debugging purpose!
+ * Don't use it for anything else than to debugging, the string format could change in the futur
+ */
+std::string CMessage::toString () const
+{
+        nlassert (_TypeSet);
+        std::stringstream s;
+        if (TypeHasAName && TypeHasAnId) s << "('" << _Name << "'," << _Id << ")";
+        else if (TypeHasAName) s << "('" << _Name << "'," << _SIDA->getId (_Name, true) << ")";
+        else if (TypeHasAnId) s << "('" << _SIDA->getString (_Id) << "'," << _Id << "')";
+        return s.str();
+}
+
+
+
+}
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/message_recorder.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/message_recorder.cpp?sortby=date new file mode 100644 index 00000000..8ab3ade6 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/message_recorder.cpp?sortby=date @@ -0,0 +1,196 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / message_recorder.cpp
+ + + + + +
message_recorder.cpp
+

+

Default branch: MAIN
+


+ Revision 1.6 / (download) - annotate - [select for diffs] +, Tue May 21 16:37:38 2002 UTC (2 months, 1 week ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.5: +6 -2 + lines
Diff to previous 1.5 +

+CHANGED: serial/send/receive 3 time faster
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.4: +3 -1 + lines
Diff to previous 1.4 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Thu Oct 25 12:12:03 2001 UTC (9 months ago) by cado +
Branch: MAIN + +
Changes since 1.3: +3 -3 + lines
Diff to previous 1.3 +

+ADDED multiformat mem stream
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:31:20 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+DOCFIX: change todo syntax
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Thu Jun 21 08:45:13 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.1: +2 -2 + lines
Diff to previous 1.1 +

+Doxfix: added file desc
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:02:01 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Diff

+Initial import of message recorder
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/naming_client.cpp?rev=1.48&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/naming_client.cpp?rev=1.48&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..8f7e28a2 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/naming_client.cpp?rev=1.48&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,569 @@ + + + +code/nel/src/net/naming_client.cpp - view - 1.48 + +
[BACK] Return to naming_client.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / naming_client.cpp (download)
+Revision 1.48, Thu Jul 18 15:00:43 2002 UTC (10 days, 18 hours ago) by lecroart +
Branch: MAIN +
CVS Tags: HEAD
Changes since 1.47: +15 -1 + lines
+ADDED: quit if the NS ask it
+
+

/** \file naming_client.cpp
+ * CNamingClient
+ *
+ * $Id: naming_client.cpp,v 1.48 2002/07/18 15:00:43 lecroart Exp $
+ *
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+//
+// Includes
+//
+
+#include "stdnet.h"
+
+#include "nel/net/naming_client.h"
+#include "nel/net/callback_client.h"
+#include "nel/net/service.h"
+
+
+//
+// Namespaces
+//
+
+using namespace std;
+using namespace NLMISC;
+
+
+namespace NLNET {
+
+//
+// Variables
+//
+
+CCallbackClient *CNamingClient::_Connection = NULL;
+CNamingClient::TRegServices CNamingClient::_RegisteredServices;
+
+static TBroadcastCallback _RegistrationBroadcastCallback = NULL;
+static TBroadcastCallback _UnregistrationBroadcastCallback = NULL;
+
+uint    CNamingClient::_ThreadId = 0xFFFFFFFF;
+
+TServiceId CNamingClient::_MySId = 0;
+
+
+std::list<CNamingClient::CServiceEntry> CNamingClient::RegisteredServices;
+NLMISC::CMutex CNamingClient::RegisteredServicesMutex("CNamingClient::RegisteredServicesMutex");
+
+void CNamingClient::setRegistrationBroadcastCallback (TBroadcastCallback cb)
+{
+        _RegistrationBroadcastCallback = cb;        
+}
+
+void CNamingClient::setUnregistrationBroadcastCallback (TBroadcastCallback cb)
+{
+        _UnregistrationBroadcastCallback = cb;        
+}
+
+//
+
+//
+
+static bool Registered;
+static TServiceId RegisteredSuccess;
+static TServiceId RegisteredSID;
+
+static void cbRegister (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        msgin.serial (RegisteredSuccess);
+        if (RegisteredSuccess) msgin.serial (RegisteredSID);
+        Registered = true;
+}
+
+//
+
+static bool QueryPort;
+static uint16 QueryPortPort;
+
+static void cbQueryPort (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        msgin.serial (QueryPortPort);
+        QueryPort = true;
+}
+
+//
+
+static bool FirstRegisteredBroadcast;
+
+void cbRegisterBroadcast (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        TServiceId size;
+        string name;
+        TServiceId sid;
+        CInetAddress addr;
+
+        msgin.serial (size);
+
+        for (TServiceId i = 0; i < size; i++)
+        {
+                msgin.serial (name);
+                msgin.serial (sid);
+                msgin.serial (addr);
+
+                // add it in the list
+
+                std::vector<CInetAddress> addrs;
+                CNamingClient::find (sid, addrs);
+
+                if (addrs.size() == 0)
+                {
+                        CNamingClient::RegisteredServicesMutex.enter ();
+                        CNamingClient::RegisteredServices.push_back (CNamingClient::CServiceEntry (name, sid, addr));
+                        CNamingClient::RegisteredServicesMutex.leave ();
+
+                        nlinfo ("NC: Registration Broadcast of the service %s-%hu '%s'", name.c_str(), (uint16)sid, addr.asString().c_str());
+
+                        if (_RegistrationBroadcastCallback != NULL)
+                                _RegistrationBroadcastCallback (name, sid, addr);
+                }
+                else if (addrs.size() == 1)
+                {
+                        CNamingClient::RegisteredServicesMutex.enter ();
+                        for (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
+                        {
+                                if (sid == (*it).SId)
+                                {
+                                        (*it).Name = name;
+                                        (*it).Addr = addr;
+                                        break;
+                                }
+                        }
+                        CNamingClient::RegisteredServicesMutex.leave ();
+                        nlinfo ("NC: Registration Broadcast (update) of the service %s-%hu '%s'", name.c_str(), (uint16)sid, addr.asString().c_str());
+                }
+                else
+                {
+                        nlstop;
+                }
+        }
+
+        FirstRegisteredBroadcast = true;
+
+        //CNamingClient::displayRegisteredServices ();
+}
+        
+//
+
+void cbUnregisterBroadcast (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        string name;
+        TServiceId sid;
+        CInetAddress addr;
+
+        msgin.serial (name);
+        msgin.serial (sid);
+        msgin.serial (addr);
+
+        // remove it in the list, if the service is not found, ignore it
+
+        CNamingClient::RegisteredServicesMutex.enter ();
+        for (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
+        {
+                if ((*it).SId == sid)
+                {
+                        // check the structure
+                        nlassertex ((*it).Name == name, ("%s %s",(*it).Name.c_str(), name.c_str()));
+                        nlassertex ((*it).Addr == addr, ("%d %d",(*it).Addr.asString().c_str(), addr.asString().c_str()));
+
+                        CNamingClient::RegisteredServices.erase (it);
+                        break;
+                }
+        }
+        CNamingClient::RegisteredServicesMutex.leave ();
+
+        nlinfo ("NC: Unregistration Broadcast of the service %s-%hu", name.c_str(), (uint16)sid);
+
+        // send the ACK to the NS
+
+        CMessage msgout (CNamingClient::_Connection->getSIDA(), "ACK_UNI");
+        msgout.serial (sid);
+        CNamingClient::_Connection->send (msgout);
+
+        // oh my god, it s my sid! but i m alive, why this f*cking naming service want to kill me? ok, i leave it alone!
+        if(CNamingClient::_MySId == sid)
+        {
+                nlwarning ("Naming Service asked me to leave, I leave!");
+                IService::getInstance()->exit();
+                return;
+        }
+
+        if (_UnregistrationBroadcastCallback != NULL)
+                _UnregistrationBroadcastCallback (name, sid, addr);
+
+        //CNamingClient::displayRegisteredServices ();
+}
+
+//
+
+static TCallbackItem NamingClientCallbackArray[] =
+{
+        { "RG", cbRegister },
+        { "QP", cbQueryPort },
+
+        { "RGB", cbRegisterBroadcast },
+        { "UNB", cbUnregisterBroadcast },
+};
+
+void CNamingClient::connect( const CInetAddress &addr, CCallbackNetBase::TRecordingState rec )
+{
+        nlassert (_Connection == NULL || _Connection != NULL && !_Connection->connected ());
+        _ThreadId = getThreadId ();
+
+        if (_Connection == NULL)
+        {
+                _Connection = new CCallbackClient( rec, "naming_client.nmr" );
+                _Connection->addCallbackArray (NamingClientCallbackArray, sizeof (NamingClientCallbackArray) / sizeof (NamingClientCallbackArray[0]));
+        }
+
+        _Connection->connect (addr);
+
+        // now we are connected, clear the old registered service table
+/*
+        CNamingClient::RegisteredServicesMutex.enter ();
+        CNamingClient::RegisteredServices.clear ();
+        CNamingClient::RegisteredServicesMutex.leave ();
+*/
+        // wait the message that contains all already connected services
+
+        FirstRegisteredBroadcast = false;
+        while (!FirstRegisteredBroadcast && _Connection->connected ())
+        {
+                _Connection->update (-1);
+                nlSleep (1);
+        }
+}
+
+
+void CNamingClient::disconnect ()
+{
+        checkThreadId ();
+        
+        if (_Connection != NULL)
+        {
+                if (_Connection->connected ())
+                {
+                        _Connection->disconnect ();
+                }
+                delete _Connection;
+                _Connection = NULL;
+        }
+
+        // we don't call unregisterAllServices because when the naming service will see the disconnection,
+        // it'll automatically unregister all services registered by this client.
+}
+
+string CNamingClient::info ()
+{
+        string res;
+
+        if (connected ())
+        {
+                res = "connected to ";
+                res += _Connection->remoteAddress().asString();
+        }
+        else
+        {
+                res = "Not connected";
+        }
+
+        return res;
+}
+
+TServiceId CNamingClient::registerService (const std::string &name, const CInetAddress &addr)
+{
+        checkThreadId ();
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        CMessage msgout (_Connection->getSIDA(), "RG");
+        msgout.serial (const_cast<std::string&>(name));
+        msgout.serial (const_cast<CInetAddress&>(addr));
+        TServiceId sid = 0;
+        msgout.serial (sid);
+        _Connection->send (msgout);
+
+        // wait the answer of the naming service "RG"
+        Registered = false;
+        while (!Registered)
+        {
+                _Connection->update (-1);
+                nlSleep (1);
+        }
+
+        if (RegisteredSuccess)
+        {
+                _MySId = RegisteredSID;
+                _RegisteredServices.insert (make_pair (RegisteredSID, name));
+                nldebug ("NC: Registered service %s-%hu at %s", name.c_str(), (uint16)RegisteredSID, addr.asString().c_str());
+        }
+        else
+        {
+                nlerror ("NC: Naming service refused to register service %s at %s", name.c_str(), addr.asString().c_str());
+        }
+
+        return RegisteredSID;
+}
+
+bool CNamingClient::registerServiceWithSId (const std::string &name, const CInetAddress &addr, TServiceId sid)
+{
+        checkThreadId ();
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        CMessage msgout (_Connection->getSIDA(), "RG");
+        msgout.serial (const_cast<std::string&>(name));
+        msgout.serial (const_cast<CInetAddress&>(addr));
+        msgout.serial (sid);
+        _Connection->send (msgout);
+
+        // wait the answer of the naming service "RGI"
+        Registered = false;
+        while (!Registered)
+        {
+                _Connection->update (-1);
+                nlSleep (1);
+        }
+
+        if (RegisteredSuccess)
+        {
+                _MySId = sid;
+                _RegisteredServices.insert (make_pair (RegisteredSID, name));
+                nldebug ("NC: Registered service with sid %s-%hu at %s", name.c_str(), (uint16)RegisteredSID, addr.asString().c_str());
+        }
+        else
+        {
+                nlerror ("NC: Naming service refused to register service with sid %s at %s", name.c_str(), addr.asString().c_str());
+        }
+
+        return RegisteredSuccess == 1;
+}
+
+void CNamingClient::resendRegisteration (const std::string &name, const CInetAddress &addr, TServiceId sid)
+{
+        checkThreadId ();
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        CMessage msgout (_Connection->getSIDA(), "RRG");
+        msgout.serial (const_cast<std::string&>(name));
+        msgout.serial (const_cast<CInetAddress&>(addr));
+        msgout.serial (sid);
+        _Connection->send (msgout);
+}
+
+void CNamingClient::unregisterService (TServiceId sid)
+{
+        checkThreadId ();
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        CMessage msgout (_Connection->getSIDA(), "UNI");
+        msgout.serial (sid);
+        _Connection->send (msgout);
+
+        nldebug ("NC: Unregistering service %s-%hu", _RegisteredServices[sid].c_str(), sid);
+        _RegisteredServices.erase (sid);
+}
+
+void CNamingClient::unregisterAllServices ()
+{
+        checkThreadId ();
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        while (!_RegisteredServices.empty())
+        {
+                TRegServices::iterator irs = _RegisteredServices.begin();
+                TServiceId sid = (*irs).first;
+                unregisterService (sid);
+        }
+}
+
+uint16 CNamingClient::queryServicePort ()
+{
+        checkThreadId ();
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        CMessage msgout (_Connection->getSIDA(), "QP");
+        _Connection->send (msgout);
+
+        // wait the answer of the naming service "QP"
+        QueryPort = false;
+        while (!QueryPort)
+        {
+                _Connection->update (-1);
+                nlSleep (1);
+        }
+
+        nlinfo ("NC: Received the answer of the query port (%hu)", QueryPortPort);
+
+        return QueryPortPort;
+}
+
+bool CNamingClient::lookup (const std::string &name, CInetAddress &addr)
+{
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        vector<CInetAddress> addrs;
+        find (name, addrs);
+
+        if (addrs.size()==0)
+                return false;
+
+        nlassert (addrs.size()==1);
+        addr = addrs[0];
+
+        return true;
+}
+
+bool CNamingClient::lookup (TServiceId sid, CInetAddress &addr)
+{
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        vector<CInetAddress> addrs;
+        find (sid, addrs);
+
+        if (addrs.size()==0)
+                return false;
+
+        nlassert (addrs.size()==1);
+        addr = addrs[0];
+        
+        return true;
+}
+
+/// \todo ace: now the lookupAlternate doesn't say to the naming service that this addr is bad so the NS can't remove it from his list. find a solution
+bool CNamingClient::lookupAlternate (const std::string &name, CInetAddress &addr)
+{
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        // remove it from his local list
+        
+        RegisteredServicesMutex.enter ();
+        for (std::list<CServiceEntry>::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++)
+        {
+                if ((*it).Addr == addr)
+                {
+                        RegisteredServices.erase (it);
+                        break;
+                }
+        }
+        RegisteredServicesMutex.leave ();
+
+        vector<CInetAddress> addrs;
+        find (name, addrs);
+
+        if (addrs.size()==0)
+                return false;
+
+        nlassert (addrs.size()==1);
+        addr = addrs[0];
+
+        return true;
+}
+
+void CNamingClient::lookupAll (const std::string &name, std::vector<CInetAddress> &addrs)
+{
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        find (name, addrs);
+}
+
+bool CNamingClient::lookupAndConnect (const std::string &name, CCallbackClient &sock)
+{
+        nlassert (_Connection != NULL && _Connection->connected ());
+
+        // look up for service
+        CInetAddress servaddr;
+        
+        // if service not found, return false
+        if (!CNamingClient::lookup (name, servaddr))
+                return false;
+
+        do
+        {
+                try
+                {
+                        // try to connect to the server
+                        sock.connect (servaddr);
+
+                        // connection succeeded
+                        return true;
+                }
+                catch (ESocketConnectionFailed &e)
+                {
+                        nldebug( "Connection to %s failed: %s, tring another service if available", servaddr.asString().c_str(), e.what() );
+
+                        // try another server and if service is not found, return false
+                        if (!CNamingClient::lookupAlternate (name, servaddr))
+                                return false;
+                }
+        }
+        while (true);
+}
+
+
+
+void CNamingClient::update ()
+{
+        checkThreadId ();
+        // get message for naming service (new registration for example)
+        if (_Connection != NULL && _Connection->connected ())
+                _Connection->update ();
+}
+
+void CNamingClient::checkThreadId ()
+{
+        if (getThreadId () != _ThreadId)
+        {
+                nlerror ("You try to access to the CNamingClient with 2 differents thread (%d and %d)", _ThreadId, getThreadId());
+        }
+}
+
+
+//
+// Commands
+//
+
+NLMISC_COMMAND(services, "displays registered services", "")
+{
+        if(args.size() != 0) return false;
+
+        log.displayNL ("Display the %d registered services :", CNamingClient::getRegisteredServices().size());
+        for (std::list<CNamingClient::CServiceEntry>::const_iterator it = CNamingClient::getRegisteredServices().begin(); it != CNamingClient::getRegisteredServices().end(); it++)
+        {
+                log.displayNL (" > %s-%hu '%s'", (*it).Name.c_str(), (uint16)(*it).SId, (*it).Addr.asString().c_str());
+        }
+        log.displayNL ("End ot the list");
+
+        return true;
+}
+
+} // NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/net_manager.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/net_manager.cpp?sortby=date new file mode 100644 index 00000000..efb85fa6 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/net_manager.cpp?sortby=date @@ -0,0 +1,356 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / net_manager.cpp
+ + + + + +
net_manager.cpp
+

+

Default branch: MAIN
+


+ Revision 1.22 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 4 days ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.21: +4 -6 + lines
Diff to previous 1.21 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Mon Jun 10 10:11:33 2002 UTC (7 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.20: +3 -1 + lines
Diff to previous 1.20 +

+ADDED: use of htimer
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Tue Jan 22 14:09:31 2002 UTC (6 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.19: +2 -1 + lines
Diff to previous 1.19 +

+ADDED: info string
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Tue Jan 15 13:36:42 2002 UTC (6 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.18: +2 -2 + lines
Diff to previous 1.18 +

+CHANGED: put nlsleep(1)
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.17: +4 -7 + lines
Diff to previous 1.17 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +17 -17 + lines
Diff to previous 1.16 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:12:48 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +5 -5 + lines
Diff to previous 1.15 +

+#english fix (sended->sent finnish->finish)
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Thu Nov 22 10:40:13 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +2 -2 + lines
Diff to previous 1.14 +

+TRY: change nlSleep(10) into nlSleep(0)
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Thu Sep 6 09:15:58 2001 UTC (10 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.13: +9 -1 + lines
Diff to previous 1.13 +

+CHANGED: rulez of update
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Thu Aug 30 17:07:36 2001 UTC (10 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +60 -52 + lines
Diff to previous 1.12 +

+CHANGED: update procedure and time sync
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Wed Jun 27 08:24:57 2001 UTC (13 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +55 -4 + lines
Diff to previous 1.11 +

+ADDED: stat information (send/receive bytes)
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Thu Jun 21 12:33:26 2001 UTC (13 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.10: +3 -1 + lines
Diff to previous 1.10 +

+ADDED: nlassert when sockid is invalid and destroy the structure on the dtor
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:06:26 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.9: +17 -11 + lines
Diff to previous 1.9 +

+Added layer 4 support for message recorder
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Wed Jun 13 12:10:34 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.8: +3 -2 + lines
Diff to previous 1.8 +

+#BUGFIX: update namingclient only if connected
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Tue Jun 12 15:41:19 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.7: +2 -1 + lines
Diff to previous 1.7 +

+CHANGED: the update policy (look service.dxt for more info)
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Tue Jun 5 15:36:38 2001 UTC (13 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.6: +32 -5 + lines
Diff to previous 1.6 +

+ADDED: connect the UpdateTimout to the layer3
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Fri May 18 14:40:20 2001 UTC (14 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +9 -1 + lines
Diff to previous 1.5 +

+ADDED: new delete callbacknetbase in the release method
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu May 17 15:36:45 2001 UTC (14 months, 1 week ago) by cado +
Branch: MAIN + +
Changes since 1.4: +2 -1 + lines
Diff to previous 1.4 +

+#Typos
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Wed May 16 16:21:04 2001 UTC (14 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.3: +21 -12 + lines
Diff to previous 1.3 +

+ADDED: autoRetry in the addClient. connection retry every 5 seconds
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Thu May 10 08:13:44 2001 UTC (14 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +5 -5 + lines
Diff to previous 1.2 +

+BUGFIX: now, dis/connection callback gives a good sockid
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Fri May 4 14:44:29 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +16 -2 + lines
Diff to previous 1.1 +

+ADDED: register with sid
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/service.cpp?rev=1.136&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/service.cpp?rev=1.136&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..c4f12e9a --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/service.cpp?rev=1.136&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,1475 @@ + + + +code/nel/src/net/service.cpp - view - 1.136 + +
[BACK] Return to service.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / service.cpp (download)
+Revision 1.136, Thu Jul 18 15:01:14 2002 UTC (10 days, 19 hours ago) by lecroart +
Branch: MAIN +
Changes since 1.135: +18 -1 + lines
+ADDED: exit and freeze
+
+

/** \file service.cpp
+ * Base class for all network services
+ *
+ * $Id: service.cpp,v 1.136 2002/07/18 15:01:14 lecroart Exp $
+ *
+ * \todo ace: test the signal redirection on Unix
+ * \todo ace: add parsing command line (with CLAP?)
+ */
+
+/* Copyright, 2001 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+ *
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#ifdef NL_OS_WINDOWS
+
+//
+// Includes
+//
+
+// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
+// just comment this and the IsDebuggerPresent to compile on windows 95
+#       define _WIN32_WINDOWS        0x0410
+#       define WINVER                        0x0400
+#       include <windows.h>
+#       include <direct.h>
+
+#elif defined NL_OS_UNIX
+
+#       include <unistd.h>
+
+#endif
+
+#include <stdlib.h>
+#include <signal.h>
+
+#include "nel/misc/config_file.h"
+#include "nel/misc/displayer.h"
+#include "nel/misc/mutex.h"
+#include "nel/misc/window_displayer.h"
+#include "nel/misc/gtk_displayer.h"
+#include "nel/misc/win_displayer.h"
+#include "nel/misc/path.h"
+#include "nel/misc/hierarchical_timer.h"
+
+#include "nel/net/naming_client.h"
+#include "nel/net/service.h"
+#include "nel/net/unified_network.h"
+#include "nel/net/net_manager.h"
+#include "nel/net/net_displayer.h"
+
+#include "nel/misc/hierarchical_timer.h"
+
+
+//
+// Namespace
+//
+
+using namespace std;
+using namespace NLMISC;
+
+
+namespace NLNET
+{
+
+
+//
+// Constants
+//
+
+static const sint Signal[] = {
+  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM
+};
+
+static const char *SignalName[]=
+{
+  "SIGABRT", "SIGFPE", "SIGILL", "SIGINT", "SIGSEGV", "SIGTERM"
+};
+
+
+//
+// Variables
+//
+
+
+// class static member
+IService        *IService::_Instance = NULL;
+
+static sint ExitSignalAsked = 0;
+
+// services stat
+static sint32 NetSpeedLoop, UserSpeedLoop;
+
+// this is the thread that initialized the signal redirection
+// we ll ignore other thread signals
+static uint SignalisedThread;
+
+static CFileDisplayer fd;
+static CNetDisplayer commandDisplayer(false);
+static CLog commandLog;
+
+
+//
+// Callback managing
+//
+
+void AESConnection (const string &serviceName, TSockId from, void *arg)
+{
+        // established a connection to the AES, identify myself
+
+        //
+        // Sends the identification message with the name of the service and all commands available on this service
+        //
+
+        CMessage msgout (CNetManager::getSIDA ("AES"), "SID");
+        msgout.serial (IService::getInstance()->_AliasName, IService::getInstance()->_ShortName, IService::getInstance()->_LongName);
+        ICommand::serialCommands (msgout);
+        CNetManager::send ("AES", msgout);
+
+        if (IService::getInstance()->_Initialized)
+        {
+                CMessage msgout2 (CNetManager::getSIDA ("AES"), "SR");
+                CNetManager::send ("AES", msgout2);
+        }
+
+        // add the displayer to the standard logger
+        CCallbackClient *client = dynamic_cast<CCallbackClient *>(CNetManager::getNetBase("AES"));
+        commandDisplayer.setLogServer (client);
+        commandLog.addDisplayer (&commandDisplayer);
+}
+
+void AESConnection5 (const string &serviceName, uint16 sid, void *arg)
+{
+        // established a connection to the AES, identify myself
+
+        //
+        // Sends the identification message with the name of the service and all commands available on this service
+        //
+
+        CMessage msgout ("SID");
+        msgout.serial (IService::getInstance()->_AliasName, IService::getInstance()->_ShortName, IService::getInstance()->_LongName);
+        ICommand::serialCommands (msgout);
+        CUnifiedNetwork::getInstance()->send("AES", msgout);
+
+        if (IService::getInstance()->_Initialized)
+        {
+                CMessage msgout2 ("SR");
+                CUnifiedNetwork::getInstance()->send("AES", msgout2);
+        }
+
+        // add the displayer to the standard logger
+        TSockId                        hid;
+        CCallbackClient *client = dynamic_cast<CCallbackClient *>(CUnifiedNetwork::getInstance()->getNetBase("AES", hid));
+        commandDisplayer.setLogServer (client);
+        commandLog.addDisplayer (&commandDisplayer);
+}
+
+static void AESDisconnection (const string &serviceName, TSockId from, void *arg)
+{
+        commandLog.removeDisplayer (&commandDisplayer);
+}
+
+
+static void AESDisconnection5 (const std::string &serviceName, uint16 sid, void *arg)
+{
+        commandLog.removeDisplayer (&commandDisplayer);
+}
+
+
+static void cbExecCommand (CMessage& msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        string command;
+        msgin.serial (command);
+
+        ICommand::execute (command, commandLog);
+}
+
+static void cbExecCommand5 (CMessage &msgin, const std::string &serviceName, uint16 sid)
+{
+        string command;
+        msgin.serial (command);
+
+        ICommand::execute (command, commandLog);
+}
+
+
+// if we receive the stop service, we try to exit now
+static void cbStopService (CMessage& msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        ExitSignalAsked = 0xFFFF;
+}
+
+static void cbStopService5 (CMessage &msgin, const std::string &serviceName, uint16 sid)
+{
+        ExitSignalAsked = 0xFFFF;
+}
+
+
+// layer4
+static TCallbackItem AESCallbackArray[] =
+{
+        { "STOPS", cbStopService },
+        { "EXEC_COMMAND", cbExecCommand },
+};
+
+// layer 5
+static TUnifiedCallbackItem AESCallbackArray5[] =
+{
+        { "STOPS", cbStopService5 },
+        { "EXEC_COMMAND", cbExecCommand5 },
+};
+
+//
+// Signals managing
+//
+
+// This function is called when a signal comes
+static void sigHandler(int Sig)
+{
+        // redirect the signal for the next time
+        signal(Sig, sigHandler);
+
+        // find the signal
+        for (int i = 0; i < (int)(sizeof(Signal)/sizeof(Signal[0])); i++)
+        {
+                if (Sig == Signal[i])
+                {
+                        if (getThreadId () != SignalisedThread)
+                        {
+                                nldebug ("Not the main thread received the signal (%s, %d), ignore it", SignalName[i],Sig);
+                                return;
+                        }
+                        else
+                        {
+                                nlinfo ("Signal %s (%d) received", SignalName[i], Sig);
+                                switch (Sig)
+                                {
+                                case SIGABRT :
+                                case SIGILL  :
+                                case SIGINT  :
+                                case SIGSEGV :
+                                case SIGTERM :
+                                // you should not call a function and system function like printf in a SigHandle because
+                                // signal-handler routines are usually called asynchronously when an interrupt occurs.
+                                if (ExitSignalAsked == 0)
+                                {
+                                        ExitSignalAsked = Sig;
+                                        return;
+                                }
+                                else
+                                {
+                                        nlinfo ("Signal already received, launch the brutal exit");
+                                        exit (EXIT_FAILURE);
+                                }
+                                break;
+                                }
+                        }
+                }
+        }
+        nlinfo ("Unknown signal received (%d)", Sig);
+}
+
+// Initialise the signal redirection
+static void initSignal()
+{
+        SignalisedThread = getThreadId ();
+#ifdef NL_DEBUG
+        // in debug mode, we only trap the SIGINT signal
+        signal(Signal[3], sigHandler);
+        //nldebug("Signal : %s (%d) trapped", SignalName[3], Signal[3]);
+#else
+        // in release, redirect all signals
+/* don't redirect now because to hard to debug...
+        for (int i = 0; i < (int)(sizeof(Signal)/sizeof(Signal[0])); i++)
+        {
+                signal(Signal[i], sigHandler);
+                nldebug("Signal %s (%d) trapped", SignalName[i], Signal[i]);
+        }
+*/
+#endif
+}
+
+//
+// Class implementation
+//
+
+// Ctor
+IService::IService() :
+        _Initialized(false), WindowDisplayer(NULL), _UpdateTimeout(100), _Port(0), _RecordingState(CCallbackNetBase::Off), _SId(0), _Status(0), _IsService5(false), _ResetMeasures(false)
+{
+        // Singleton
+        nlassert( _Instance == NULL );
+
+        _Instance = this;
+}
+
+
+
+bool IService::haveArg (char argName)
+{
+        for (uint32 i = 0; i < _Args.size(); i++)
+        {
+                if (_Args[i].size() >= 2 && _Args[i][0] == '-')
+                {
+                        if (_Args[i][1] == argName)
+                        {
+                                return true;
+                        }
+                }
+        }
+        return false;
+}
+
+string IService::getArg (char argName)
+{
+        for (uint32 i = 0; i < _Args.size(); i++)
+        {
+                if (_Args[i].size() >= 2 && _Args[i][0] == '-')
+                {
+                        if (_Args[i][1] == argName)
+                        {
+                                return _Args[i].substr(2);
+                        }
+                }
+        }
+        throw Exception ("Parameter '-%c' is not found in command line", argName);
+}
+
+
+void IService::setArgs (const char *args)
+{
+        _Args.push_back ("<ProgramName>");
+
+        string sargs (args);
+        sint pos1 = 0, pos2 = 0;
+
+        do
+        {
+                pos1 = sargs.find_first_not_of (" ", pos2);
+                if (pos1 == string::npos) break;
+                pos2 = sargs.find_first_of (" ", pos1);
+                _Args.push_back (sargs.substr (pos1, pos2-pos1));
+        }
+        while (pos2 != string::npos);
+}
+
+void IService::setArgs (int argc, const char **argv)
+{
+        for (sint i = 0; i < argc; i++)
+        {
+                _Args.push_back (argv[i]);
+        }
+}
+
+/*
+ * Returns a pointer to the CCallbackServer object
+ */
+CCallbackServer *IService::getServer()
+{
+        if (isService5())
+                return NULL;
+        else
+                return dynamic_cast<CCallbackServer*>(CNetManager::getNetBase(IService::_ShortName));
+}
+
+
+
+void cbLogFilter (CConfigFile::CVar &var)
+{
+        CLog *log = NULL;
+        if (var.Name == "NegFiltersDebug")
+        {
+                log = DebugLog;
+                nlinfo ("Updating negative filter on debug from config file");
+        }
+        else if (var.Name == "NegFiltersInfo")
+        {
+                log = InfoLog;
+                nlinfo ("Updating negative filter on info from config file");
+        }
+        else
+        {
+                nlstop;
+        }
+
+        // remove all old filter from configfile
+        CConfigFile::CVar &oldvar = IService::getInstance()->ConfigFile.getVar (var.Name);
+        for (sint j = 0; j < oldvar.size(); j++)
+        {
+                log->removeFilter (oldvar.asString(j).c_str());
+        }
+
+        // add all new filter from configfile
+        for (sint i = 0; i < var.size(); i++)
+        {
+                log->addNegativeFilter (var.asString(i).c_str());
+        }
+}
+
+
+
+
+
+
+
+
+//
+// The main function of the service
+//
+
+sint IService::main (const char *serviceShortName, const char *serviceLongName, uint16 servicePort, const char *configDir, const char *logDir)
+{
+        bool userInitCalled = false;
+        bool resyncEvenly = false;
+        CConfigFile::CVar *var = NULL;
+
+        try
+        {
+                // get the path where to run the service if any in the command line
+                if (haveArg('A'))
+                {
+                        _RunningPath = CPath::standardizePath(getArg('A'));
+#ifdef NL_OS_WINDOWS
+                        _chdir (_RunningPath.c_str());
+#else
+                        chdir (_RunningPath.c_str());
+#endif
+                }
+
+                //
+                // Init parameters
+                //
+
+                _ConfigDir = CPath::standardizePath(configDir);
+                _LogDir = CPath::standardizePath(logDir);
+                _ShortName = serviceShortName;
+                _LongName = serviceLongName;
+
+                //
+                // Init debug/log stuffs (must be first things otherwise we can't log if errors)
+                //
+
+                // get the log dir if any in the command line
+                if (haveArg('L'))
+                        _LogDir = CPath::standardizePath(getArg('L'));
+
+                // get the config file dir if any in the command line
+                if (haveArg('C'))
+                        _ConfigDir = CPath::standardizePath(getArg('C'));
+
+                createDebug (_LogDir.c_str(), false);
+
+                DebugLog->addNegativeFilter ("NETL");
+
+                // we create the log with service name filename ("test_service.log" for example)
+                fd.setParam (_LogDir + _LongName + ".log", false);
+
+                DebugLog->addDisplayer (&fd);
+                InfoLog->addDisplayer (&fd);
+                WarningLog->addDisplayer (&fd);
+                AssertLog->addDisplayer (&fd);
+                ErrorLog->addDisplayer (&fd);
+
+
+                //
+                // Init the hierarchical timer
+                //
+
+                CHTimer::startBench(false, true);
+
+
+                //
+                // Load the config file
+                //
+
+                ConfigFile.load (_ConfigDir + _LongName + ".cfg");
+
+
+                //
+                // Set the negatif filter from the config file
+                //
+
+                if ((var = ConfigFile.getVarPtr ("NegFiltersDebug")) != NULL)
+                {
+                        ConfigFile.setCallback ("NegFiltersDebug", cbLogFilter);
+                        for (sint i = 0; i < var->size(); i++)
+                        {
+                                DebugLog->addNegativeFilter (var->asString(i).c_str());
+                        }
+                }
+
+                if ((var = ConfigFile.getVarPtr ("NegFiltersInfo")) != NULL)
+                {
+                        ConfigFile.setCallback ("NegFiltersInfo", cbLogFilter);
+                        for (sint i = 0; i < var->size(); i++)
+                        {
+                                InfoLog->addNegativeFilter (var->asString(i).c_str());
+                        }
+                }
+
+
+                //
+                // Create the window if neeeded
+                //
+
+                if ((var = ConfigFile.getVarPtr ("WindowStyle")) != NULL)
+                {
+                        string disp = var->asString ();
+#ifdef NL_USE_GTK
+                        if (disp == "GTK")
+                        {
+                                WindowDisplayer = new CGtkDisplayer ("DEFAULT_WD");
+                        }
+#endif // NL_USE_GTK
+
+#ifdef NL_OS_WINDOWS
+                        if (disp == "WIN")
+                        {
+                                WindowDisplayer = new CWinDisplayer ("DEFAULT_WD");
+                        }
+#endif // NL_OS_WINDOWS
+
+                        if (WindowDisplayer == NULL && disp != "NONE")
+                        {
+                                nlwarning ("Unknown value for the WindowStyle (should be GTK, WIN or NONE), use no window displayer");
+                        }
+                }
+
+                vector <pair<string,uint> > displayedVariables;
+                //uint speedNetLabel, speedUsrLabel, rcvLabel, sndLabel, rcvQLabel, sndQLabel, scrollLabel;
+                if (WindowDisplayer != NULL)
+                {
+                        //
+                        // Init window param if necessary
+                        //
+
+                        sint x=-1, y=-1, w=-1, h=-1;
+                        bool iconified = false;
+
+                        if ((var = ConfigFile.getVarPtr("XWinParam")) != NULL) x = var->asInt();
+                        if ((var = ConfigFile.getVarPtr("YWinParam")) != NULL) y = var->asInt();
+                        if ((var = ConfigFile.getVarPtr("WWinParam")) != NULL) w = var->asInt();
+                        if ((var = ConfigFile.getVarPtr("HWinParam")) != NULL) h = var->asInt();
+                        if ((var = ConfigFile.getVarPtr("HWinParam")) != NULL) iconified = var->asInt() == 1;
+
+                        if (haveArg('I')) iconified = true;
+
+                        if (w == -1 && h == -1)
+                                WindowDisplayer->create (string("*INIT* ") + _ShortName + " " + _LongName, iconified, x, y);
+                        else
+                                WindowDisplayer->create (string("*INIT* ") + _ShortName + " " + _LongName, iconified, x, y, w, h);
+
+                        DebugLog->addDisplayer (WindowDisplayer);
+                        InfoLog->addDisplayer (WindowDisplayer);
+                        WarningLog->addDisplayer (WindowDisplayer);
+                        ErrorLog->addDisplayer (WindowDisplayer);
+                        AssertLog->addDisplayer (WindowDisplayer);
+
+                        // adding default displayed variables
+                        displayedVariables.push_back(make_pair(string("NetLop|NetSpeedLoop"), WindowDisplayer->createLabel ("NetLop")));
+                        displayedVariables.push_back(make_pair(string("UsrLop|UserSpeedLoop"), WindowDisplayer->createLabel ("UsrLop")));
+//                      displayedVariables.push_back(make_pair(string("Rcv|ReceivedBytes"), WindowDisplayer->createLabel ("Rcv")));
+//                      displayedVariables.push_back(make_pair(string("Snd|SentBytes"), WindowDisplayer->createLabel ("Snd")));
+//                      displayedVariables.push_back(make_pair(string("RcvQ|ReceivedQueueSize"), WindowDisplayer->createLabel ("RcvQ")));
+//                      displayedVariables.push_back(make_pair(string("SndQ|SentQueueSize"), WindowDisplayer->createLabel ("SndQ")));
+                        displayedVariables.push_back(make_pair(string("|Scroller"), WindowDisplayer->createLabel ("NeL Rulez")));
+                        
+                        CConfigFile::CVar *v = ConfigFile.getVarPtr("DisplayedVariables");
+                        if (v != NULL)
+                        {
+                                for (sint i = 0; i < v->size(); i++)
+                                {
+                                        displayedVariables.push_back(make_pair(v->asString(i), WindowDisplayer->createLabel (v->asString(i).c_str())));
+                                }
+                        }
+                }
+
+                nlinfo ("Starting Service %d '%s' using NeL ("__DATE__" "__TIME__")", isService5()?5:4, _ShortName.c_str());
+
+                setStatus (EXIT_SUCCESS);
+
+                //
+                // Redirect signal if needed (in release mode only)
+                //
+
+#ifdef NL_OS_WINDOWS
+#ifdef NL_RELEASE
+                initSignal();
+#else
+                // don't install signal is the application is started in debug mode
+                if (IsDebuggerPresent ())
+                {
+                        //nlinfo("Running with the debugger, don't redirect signals");
+                        initSignal();
+                }
+                else
+                {
+                        //nlinfo("Running without the debugger, redirect SIGINT signal");
+                        initSignal();
+                }
+#endif
+#else // NL_OS_UNIX
+                initSignal();
+#endif
+
+
+                //
+                // Ignore SIGPIPE (broken pipe) on unix system
+                //
+
+#ifdef NL_OS_UNIX
+                // Ignore the SIGPIPE signal
+                sigset_t SigList;
+                bool IgnoredPipe = true;
+                if (sigemptyset (&SigList) == -1)
+                {
+                        perror("sigemptyset()");
+                        IgnoredPipe = false;
+                }
+
+                if (sigaddset (&SigList, SIGPIPE) == -1)
+                {
+                        perror("sigaddset()");
+                        IgnoredPipe = false;
+                }
+
+                if (sigprocmask (SIG_BLOCK, &SigList, NULL) == -1)
+                {
+                        perror("sigprocmask()");
+                        IgnoredPipe = false;
+                }
+                nldebug ("SIGPIPE %s", IgnoredPipe?"Ignored":"Not Ignored");
+#endif // NL_OS_UNIX
+
+
+                //
+                // Initialize the network system
+                //
+                
+                string localhost;
+                try
+                {
+                        // Initialize WSAStartup and network stuffs
+                        CSock::initNetwork();
+
+                        // Get the localhost name
+                        localhost = CInetAddress::localHost().hostName();
+                }
+                catch (NLNET::ESocket &)
+                {
+                        localhost = "<UnknownHost>";
+                }
+
+                // Set the localhost name and service name to the logger
+                string processName = localhost;
+                processName += '/';
+                processName += _ShortName;
+                CLog::setProcessName (processName);
+
+
+                //
+                // Initialize server parameters
+                //
+
+                // Get the port from config file or in the macro (overload the port set by the user init())
+                if ((var = ConfigFile.getVarPtr("Port")) != NULL)
+                {
+                        // set the listen port with the value in the config file if any
+                        _Port = var->asInt();
+                }
+                else
+                {
+                        // set the listen port with the value in the NLNET_SERVICE_MAIN macro
+                        _Port = servicePort;
+                }
+
+                // set the listen port if there are a port arg in the command line
+                if (haveArg('P'))
+                {
+                        _Port = atoi(getArg('P').c_str());
+                }
+
+                // set the aliasname if is present in the command line
+                if (haveArg('N'))
+                {
+                        _AliasName = getArg('N');
+                }
+
+                // Load the recording state from the config file
+                if ((var = ConfigFile.getVarPtr ("Rec")) != NULL)
+                {
+                        string srecstate = var->asString();
+                        strupr( srecstate );
+                        if ( srecstate == "RECORD" )
+                        {
+                                _RecordingState = CCallbackNetBase::Record;
+                                nlinfo( "Service recording messages" );
+                        }
+                        else if ( srecstate == "REPLAY" )
+                        {
+                                _RecordingState = CCallbackNetBase::Replay;
+                                nlinfo( "Service replaying messages" );
+                        }
+                        else
+                        {
+                                _RecordingState = CCallbackNetBase::Off;
+                        }
+                }
+                else
+                {
+                        // Not found
+                        _RecordingState = CCallbackNetBase::Off;
+                }
+
+                // Load the default stream format
+                if ((var = ConfigFile.getVarPtr ("StringMsgFormat")) != NULL)
+                {
+                        CMessage::setDefaultStringMode( var->asInt() == 1 );
+                }
+                else
+                {
+                        // Not found => binary
+                        CMessage::setDefaultStringMode( false );
+                }
+
+/*
+                //
+                // Layer4 Startup (Connect to the Naming Service (except for the NS itself and Login Service))
+                //
+
+                if (IService::_ShortName != "NS" && IService::_ShortName != "LS" && IService::_ShortName != "AES" && IService::_ShortName != "AS")
+                {
+                        bool ok = false;
+                        while (!ok)
+                        {
+                                // read the naming service address from the config file
+                                CInetAddress loc(ConfigFile.getVar("NSHost").asString(), ConfigFile.getVar("NSPort").asInt());
+                                try
+                                {
+                                        CNetManager::init( &loc, _RecordingState );
+                                        ok = true;
+                                }
+                                catch (ESocketConnectionFailed &)
+                                {
+                                        nlwarning ("Could not connect to the Naming Service (%s). Retrying in a few seconds...", loc.asString().c_str());
+                                        nlSleep (5000);
+                                }
+                        }
+                }
+                else
+                {
+                        CNetManager::init( NULL, _RecordingState );
+                }
+*/
+
+                ///
+                /// Layer5 Startup
+                ///
+
+                // get the sid
+                if ((var = ConfigFile.getVarPtr ("SId")) != NULL)
+                {
+                        sint32 sid = var->asInt();
+                        if (sid<0 || sid>255)
+                        {
+                                nlwarning("Bad SId value in the config file, %d is not in [0;255] range", sid);
+                                _SId = 0;
+                        }
+                        else
+                        {
+                                _SId = (uint8) sid;
+                        }
+                }
+                else
+                {
+                        // ok, SId not found, use dynamic sid
+                        _SId = 0;
+                }
+
+
+                // look if we don't want to use NS
+                if ((var = ConfigFile.getVarPtr ("DontUseNS")) != NULL)
+                {
+                        // if we set the value in the config file, get it
+                        _DontUseNS = var->asInt() == 1;
+                }
+                else
+                {
+                        // if not, we use ns only if service is not ns, ls, aes, as
+                        _DontUseNS = (_ShortName == "NS" || _ShortName == "LS" || _ShortName == "AES" || _ShortName == "AS");
+                }
+
+                // normal setup for the common services
+                if (!_DontUseNS)
+                {
+                        bool ok = false;
+                        while (!ok)
+                        {
+                                // read the naming service address from the config file
+                                string LSAddr = ConfigFile.getVar ("NSHost").asString();
+                                
+                                // if there's no port to the NS, use the default one 50000
+                                if (LSAddr.find(":") == string::npos)
+                                                LSAddr += ":50000";
+
+                                CInetAddress loc(LSAddr);
+                                try
+                                {
+                                        if (isService5())
+                                                CUnifiedNetwork::getInstance()->init (&loc, _RecordingState, _ShortName, _Port, _SId);
+                                        else
+                                                CNetManager::init( &loc, _RecordingState );
+
+                                        ok = true;
+                                }
+                                catch (ESocketConnectionFailed &)
+                                {
+                                        nlwarning ("Could not connect to the Naming Service (%s). Retrying in a few seconds...", loc.asString().c_str());
+                                        nlSleep (5000);
+                                }
+                        }
+                }
+                else
+                {
+                        if (isService5())
+                                CUnifiedNetwork::getInstance()->init(NULL, _RecordingState, _ShortName, _Port, _SId);
+                        else
+                                CNetManager::init( NULL, _RecordingState );
+                }
+
+
+                //
+                // Connect to the local AES and send identification
+                //
+
+                // look if we don't want to use NS
+                if ((var = ConfigFile.getVarPtr ("DontUseAES")) != NULL)
+                {
+                        // if we set the value in the config file, get it
+                        _DontUseAES = var->asInt() == 1;
+                }
+                else
+                {
+                        // if not, we use aes only if service is not aes or as
+                        _DontUseAES = (_ShortName == "AES" || _ShortName == "AS");
+                }
+
+                if (!_DontUseAES)
+                {
+                        if (isService5())
+                        {
+                                CUnifiedNetwork::getInstance()->setServiceUpCallback ("AES", AESConnection5, NULL);
+                                CUnifiedNetwork::getInstance()->setServiceDownCallback ("AES", AESDisconnection5, NULL);
+                                CUnifiedNetwork::getInstance()->addService ("AES", CInetAddress("localhost:49997"), false);
+                                CUnifiedNetwork::getInstance()->addCallbackArray (AESCallbackArray5, sizeof(AESCallbackArray5)/sizeof(AESCallbackArray5[0]));
+                        }
+                        else
+                        {
+                                CNetManager::setConnectionCallback ("AES", AESConnection, NULL);
+                                CNetManager::setDisconnectionCallback ("AES", AESDisconnection, NULL);
+                                CNetManager::addClient ("AES", "localhost:49997");
+                                CNetManager::addCallbackArray ("AES", AESCallbackArray, sizeof(AESCallbackArray)/sizeof(AESCallbackArray[0]));
+                        }
+                }
+
+
+                //
+                // Add callback array
+                //
+
+                if (isService5())
+                {
+                        // add callback set in the NLNET_SERVICE_MAIN macro
+                        NLNET::CUnifiedNetwork::getInstance()->addCallbackArray(_CallbackArray5, _CallbackArraySize);
+                }
+                else
+                {
+                        CNetManager::addServer (_ShortName, _Port, _SId);
+                        CNetManager::addCallbackArray (_ShortName, _CallbackArray, _CallbackArraySize);
+                }
+
+                //
+                // Now we have the service id, we can set the entites id generator
+                //
+
+                _NextEntityId.setServiceId(_SId);
+
+
+                //
+                // Call the user service init
+                //
+
+                userInitCalled = true; // the bool must be put *before* the call to init()
+                init ();
+
+
+                //
+                // Connects to the present services
+                // WARNING: only after the user init() was called because the
+                // addService may call up service callbacks.
+                //
+
+                if (isService5())
+                        CUnifiedNetwork::getInstance()->connect();
+
+
+                //
+                // On Unix system, the service fork itself to give back the hand to the shell
+                //
+                // note: we don't forking anymore because it doesn't work with thread system
+                //
+
+#ifdef NL_OS_UNIX
+                /*
+                nlinfo( "Forking the service" );
+
+                int pid = fork();
+
+                /// \todo ace: when we fork() on linux, the father process tries to release threads but it should not, so we have to find a solution
+
+                if (pid == -1)
+                {
+                        nlerror ("Couldn't fork the service");
+                }
+                else if (pid != 0)
+                {
+                        // It's the father, return the hand to the shell.
+                        exit(EXIT_SUCCESS);
+                }
+                */
+#endif // NL_OS_UNIX
+
+
+                //
+                // Say to the AES that the service is ready
+                //
+
+                if (!_DontUseAES)
+                {
+                        if (isService5())
+                        {
+                                // send the ready message (service init finished)
+                                CMessage msgout ("SR");
+                                CUnifiedNetwork::getInstance()->send("AES", msgout);
+                        }
+                        else
+                        {
+                                // send the ready message (service init finished)
+                                CMessage msgout (CNetManager::getSIDA ("AES"), "SR");
+                                CNetManager::send ("AES", msgout);
+                        }
+                }
+
+
+                //
+                // Add default pathes
+                //
+
+                if ((var = ConfigFile.getVarPtr ("Paths")) != NULL)
+                {
+                        for (sint i = 0; i < var->size(); i++)
+                        {
+                                CPath::addSearchPath (var->asString(i));
+                        }
+                }
+
+
+                _Initialized = true;
+
+                nlinfo ("Service initialised");
+
+
+                //
+                // Call the user command from the config file if any
+                //
+
+                if ((var = ConfigFile.getVarPtr ("StartCommands")) != NULL)
+                {
+                        for (sint i = 0; i < var->size(); i++)
+                        {
+                                ICommand::execute (var->asString(i), *InfoLog);
+                        }
+                }
+
+                nlinfo ("Service ready");
+
+                if (WindowDisplayer != NULL)
+                        WindowDisplayer->setTitleBar (_ShortName + " " + _LongName);
+
+
+                //
+                // Call the user service update each loop and check files and network activity
+                //
+
+                do
+                {
+                        H_BEFORE(NLNETServiceLoop);
+
+                        // count the amount of time to manage internal system
+                        TTime bbefore = CTime::getLocalTime ();
+
+                        // call the user update and exit if the user update asks it
+                        H_BEFORE(NLNETServiceUpdate);
+                        if (!update ())
+                        {
+                                H_AFTER(NLNETServiceUpdate);
+                                H_AFTER(NLNETServiceLoop);
+                                break;
+                        }
+                        H_AFTER(NLNETServiceUpdate);
+                        
+                        // count the amount of time to manage internal system
+                        TTime before = CTime::getLocalTime ();
+
+                        if (WindowDisplayer != NULL)
+                        {
+                                // update the window displayer and quit if asked
+                                if (!WindowDisplayer->update ())
+                                        ExitSignalAsked = true;
+                        }
+
+                        // stop the loop if the exit signal asked
+                        if (ExitSignalAsked)
+                        {
+                                H_AFTER(NLNETServiceLoop);
+                                break;
+                        }
+        
+                        CConfigFile::checkConfigFiles ();
+
+                        CFile::checkFileChange();
+
+                        H_BEFORE(NLNETServiceManageMessages);
+                        if (isService5())
+                        {
+                                // get and manage layer 5 messages
+                                CUnifiedNetwork::getInstance()->update (_UpdateTimeout);
+                        }
+                        else
+                        {
+                                // get and manage layer 4 messages
+                                CNetManager::update (_UpdateTimeout);
+                        }
+                        H_AFTER(NLNETServiceManageMessages);
+                        
+                        // resync the clock every hours
+                        if (resyncEvenly)
+                        {
+                                static TTime LastSyncTime = CTime::getLocalTime ();
+
+                                //---------------------------------------
+                                // To simulate Ctrl-C in the debugger... Exit after 1 min !
+                                /*if (CTime::getLocalTime () - LastSyncTime > 60 * 1000 )
+                                {
+                                        ExitSignalAsked = 1;
+                                }*/
+                                //---------------------------------------
+/*
+                                if (CTime::getLocalTime () - LastSyncTime > 60*60*1000)
+                                {
+                                        CUniTime::syncUniTimeFromService ( _RecordingState );
+                                        LastSyncTime = CTime::getLocalTime ();
+                                }
+*/
+                        }
+
+                        NetSpeedLoop = (sint32) (CTime::getLocalTime () - before);
+                        UserSpeedLoop = (sint32) (before - bbefore);
+
+                        if (WindowDisplayer != NULL)
+                        {
+                                uint64 rcv, snd, rcvq, sndq;
+                                if (isService5())
+                                {
+                                        rcv = CUnifiedNetwork::getInstance()->getBytesReceived ();
+                                        snd = CUnifiedNetwork::getInstance()->getBytesSent ();
+                                        rcvq = CUnifiedNetwork::getInstance()->getReceiveQueueSize ();
+                                        sndq = CUnifiedNetwork::getInstance()->getSendQueueSize ();
+                                }
+                                else
+                                {
+                                        rcv = CNetManager::getBytesReceived ();
+                                        snd = CNetManager::getBytesSent ();
+                                        rcvq = CNetManager::getReceiveQueueSize ();
+                                        sndq = CNetManager::getSendQueueSize ();
+                                }
+
+                                string str;
+                                CLog log;
+                                CMemDisplayer md;
+                                log.addDisplayer (&md);
+
+                                for (uint i = 0; i < displayedVariables.size(); i++)
+                                {
+                                        // it s a separator, do nothing
+                                        if (displayedVariables[i].first.empty())
+                                                continue;
+
+                                        // it s a command, do nothing
+                                        if (displayedVariables[i].first[0] == '@')
+                                                continue;
+
+                                        string dispName = displayedVariables[i].first;
+                                        string varName = dispName;
+                                        sint pos = dispName.find("|");
+                                        if (pos != string::npos)
+                                        {
+                                                varName = displayedVariables[i].first.substr(pos+1);
+                                                dispName = displayedVariables[i].first.substr(0, pos);
+                                        }
+
+                                        if (dispName.empty())
+                                                str = "";
+                                        else
+                                                str = dispName + ": ";
+                                        
+                                        md.clear ();
+                                        ICommand::execute(varName, log, true);
+                                        const std::deque<std::string>        &strs = md.lockStrings();
+                                        if (strs.size()>0)
+                                        {
+                                                sint pos = strs[0].find("=");
+                                                if(pos != string::npos && pos + 2 < (sint)strs[0].size())
+                                                {
+                                                        sint pos2 = string::npos;
+                                                        if(strs[0][strs[0].size()-1] == '\n')
+                                                                pos2 = strs[0].size() - pos - 2 - 1;
+
+                                                        str += strs[0].substr (pos+2, pos2);
+                                                }
+                                                else
+                                                {
+                                                        str += "???";
+                                                }
+                                        }
+                                        md.unlockStrings();
+                                        WindowDisplayer->setLabel (displayedVariables[i].second, str);
+                                }
+
+                        }
+
+//                      nldebug ("SYNC: updatetimeout must be %d and is %d, sleep the rest of the time", _UpdateTimeout, delta);
+                        H_AFTER(NLNETServiceLoop);
+
+                        // Resetting the hierarchical timer must be done outside the top-level timer
+                        if ( _ResetMeasures )
+                        {
+                                CHTimer::clear();
+                                _ResetMeasures = false;
+                        }
+                }
+                while (true);
+        }
+        catch (EFatalError &)
+        {
+                // Somebody call nlerror, so we have to quit now, the message already display
+                // so we don't have to to anything
+                setStatus (EXIT_FAILURE);
+        }
+        catch ( uint ) // SEH exceptions
+        {
+                ErrorLog->displayNL( "System exception" );
+        }
+
+#ifdef NL_RELEASE
+/*      // in release mode, we catch everything to handle clean release.
+        catch (Exception &e)
+        {
+                // Catch NeL exception to release the system cleanly
+                setStatus (EXIT_FAILURE);
+                nlinfo ("ERROR: NeL Exception: Error running the service \"%s\": %s", _ShortName.c_str(), e.what());
+        }
+        catch (...)
+        {
+                // Catch anything we can to release the system cleanly
+                setStatus (EXIT_FAILURE);
+                nlinfo ("ERROR: Unknown external exception");
+        }
+*/
+#endif
+
+        try
+        {
+                nlinfo ("Service starts releasing");
+
+                //
+                // Call the user service release() if the init() was called
+                //
+
+                if (userInitCalled)
+                        release ();
+
+                //
+                // Delete all network connection (naming client also)
+                //
+
+                if (isService5())
+                        CUnifiedNetwork::getInstance()->release ();
+                else
+                        CNetManager::release ();
+
+                CSock::releaseNetwork ();
+
+                //
+                // Remove the window displayer
+                //
+
+                if (WindowDisplayer != NULL)
+                {
+                        DebugLog->removeDisplayer (WindowDisplayer);
+                        InfoLog->removeDisplayer (WindowDisplayer);
+                        WarningLog->removeDisplayer (WindowDisplayer);
+                        ErrorLog->removeDisplayer (WindowDisplayer);
+                        AssertLog->removeDisplayer (WindowDisplayer);
+
+                        delete WindowDisplayer;
+                        WindowDisplayer = NULL;
+                }
+
+                nlinfo ("Service released succesfuly");
+        }
+        catch (EFatalError &)
+        {
+                // Somebody call nlerror, so we have to quit now, the message already display
+                // so we don't have to to anything
+                setStatus (EXIT_FAILURE);
+        }
+
+#ifdef NL_RELEASE
+/*      // in release mode, we catch everything to handle clean release.
+        catch (Exception &e)
+        {
+                setStatus (EXIT_FAILURE);
+                nlinfo ("ERROR: NeL Exception: Error releasing the service \"%s\": %s", _ShortName.c_str(), e.what());
+        }
+        catch (...)
+        {
+                // Catch anything we can to release the system cleanly
+                setStatus (EXIT_FAILURE);
+                nlinfo ("ERROR: Unknown external exception");
+        }
+*/
+#endif
+
+        CHTimer::endBench();
+        CHTimer::display();
+        CHTimer::displayByExecutionPath ();
+        CHTimer::displayHierarchical(InfoLog, true, 64);
+        CHTimer::displayHierarchicalByExecutionPathSorted (InfoLog, CHTimer::TotalTime, true, 64);
+
+        nlinfo ("Service ends");
+
+        return ExitSignalAsked?100+ExitSignalAsked:getStatus ();
+}
+
+void IService::exit (sint code)
+{
+        ExitSignalAsked = code;
+}
+
+/*
+ * Require to reset the hierarchical timer
+ */
+void IService::requireResetMeasures()
+{
+        _ResetMeasures = true;
+}
+
+
+//
+// Commands and Variables for controling all services
+//
+
+NLMISC_VARIABLE(sint32, NetSpeedLoop, "duration of the last network loop (in ms)");
+NLMISC_VARIABLE(sint32, UserSpeedLoop, "duration of the last user loop (in ms)");
+
+NLMISC_DYNVARIABLE(uint64, ReceivedBytes, "total of bytes received by this service")
+{
+        // we can only read the value
+        if (get)
+                *pointer = IService::getInstance()->isService5()?CUnifiedNetwork::getInstance()->getBytesReceived ():CNetManager::getBytesReceived ();
+}
+
+NLMISC_DYNVARIABLE(uint64, SentBytes, "total of bytes sent by this service")
+{
+        // we can only read the value
+        if (get)
+                *pointer = IService::getInstance()->isService5()?CUnifiedNetwork::getInstance()->getBytesSent ():CNetManager::getBytesSent ();
+}
+
+NLMISC_DYNVARIABLE(uint64, ReceivedQueueSize, "current size in bytes of the received queue size")
+{
+        // we can only read the value
+        if (get)
+                *pointer = IService::getInstance()->isService5()?CUnifiedNetwork::getInstance()->getReceiveQueueSize ():CNetManager::getReceiveQueueSize ();
+}
+
+NLMISC_DYNVARIABLE(uint64, SentQueueSize, "current size in bytes of the sent queue size")
+{
+        // we can only read the value
+        if (get)
+                *pointer = IService::getInstance()->isService5()?CUnifiedNetwork::getInstance()->getSendQueueSize ():CNetManager::getSendQueueSize ();
+}
+
+NLMISC_DYNVARIABLE(string, Scroller, "current size in bytes of the sent queue size")
+{
+        if (get)
+        {
+                // display the scroll text
+                static string foo =        "Welcome to NeL Service! This scroll is used to see the update frequency of the main function and to see if the service is frozen or not. Have a nice day and hope you'll like NeL!!! "
+                                                        "Welcome to NeL Service! This scroll is used to see the update frequency of the main function and to see if the service is frozen or not. Have a nice day and hope you'll like NeL!!! ";
+                static int pos = 0;
+                *pointer = foo.substr ((pos++)%(foo.size()/2), 10);
+        }
+}
+
+NLMISC_COMMAND (quit, "exit the service", "")
+{
+        if(args.size() != 0) return false;
+
+        ExitSignalAsked = 0xFFFF;
+
+        return true;
+}
+
+NLMISC_COMMAND (brutalQuit, "exit the service brutally", "")
+{
+        if(args.size() != 0) return false;
+
+        exit (0xFFFFFFFF);
+
+        return true;
+}
+
+
+#ifdef MUTEX_DEBUG
+NLMISC_COMMAND (mutex, "display mutex values", "")
+{
+        if(args.size() != 0) return false;
+
+        map<CFairMutex*,TMutexLocks>        acquiretimes = getNewAcquireTimes();
+
+        map<CFairMutex*,TMutexLocks>::iterator im;
+        for ( im=acquiretimes.begin(); im!=acquiretimes.end(); ++im )
+        {
+                nlinfo( "%d %p %s: %.0f %.0f, called %u times th(%d, %d wait)%s", (*im).second.MutexNum, (*im).first, (*im).second.MutexName.c_str(),
+                        CTime::cpuCycleToSecond((*im).second.TimeToEnter)*1000.0, CTime::cpuCycleToSecond((*im).second.TimeInMutex)*1000.0,
+                        (*im).second.Nb, (*im).second.ThreadHavingTheMutex, (*im).second.WaitingMutex,
+                        (*im).second.Dead?" DEAD":"");
+        }
+
+        return true;
+}
+#endif // MUTEX_DEBUG
+
+NLMISC_COMMAND (serviceInfo, "display information about this service", "")
+{
+        if(args.size() != 0) return false;
+
+        log.displayNL ("Service %d '%s' '%s' '%s' using NeL ("__DATE__" "__TIME__")", IService::getInstance()->isService5()?5:4, IService::getInstance()->_ShortName.c_str(), IService::getInstance()->_LongName.c_str(), IService::getInstance()->_AliasName.c_str());
+        log.displayNL ("Service listening port: %d", IService::getInstance()->_Port);
+        log.displayNL ("Service running directory: '%s'", IService::getInstance()->_RunningPath.c_str());
+        log.displayNL ("Service log directory: '%s'", IService::getInstance()->_LogDir.c_str());
+        log.displayNL ("Service config directory: '%s' config filename: '%s.cfg'", IService::getInstance()->_ConfigDir.c_str(), IService::getInstance()->_LongName.c_str());
+        log.displayNL ("Service id: %d", IService::getInstance()->_SId);
+        log.displayNL ("Service update timeout: %dms", IService::getInstance()->_UpdateTimeout);
+        log.displayNL ("Service %suse naming service", IService::getInstance()->_DontUseNS?"don't ":"");
+        log.displayNL ("Service %suse admin executor service", IService::getInstance()->_DontUseAES?"don't ":"");
+#ifdef NL_RELEASE_DEBUG
+        string mode = "NL_RELEASE_DEBUG";
+#elif defined(NL_DEBUG_FAST)
+        string mode = "NL_DEBUG_FAST";
+#elif defined(NL_DEBUG)
+        string mode = "NL_DEBUG";
+#elif defined(NL_RELEASE)
+        string mode = "NL_RELEASE";
+#else
+        string mode = "???";
+#endif
+        log.displayNL ("NeL is compiled in %s mode", mode.c_str());
+
+        nlinfo ("Services arguments: %d args", IService::getInstance()->_Args.size ());
+        for (uint i = 0; i < IService::getInstance()->_Args.size (); i++)
+        {
+                nlinfo ("  argv[%d] = '%s'", i, IService::getInstance()->_Args[i].c_str ());
+        }
+
+        log.displayNL ("Naming service info: %s", CNamingClient::info().c_str());
+
+        ICommand::execute ("services", log);
+
+        return true;
+}
+
+NLMISC_COMMAND(resetMeasures, "reset hierarchical timer", "")
+{
+        IService::getInstance()->requireResetMeasures();
+        return true;
+}
+
+NLMISC_COMMAND(displayMeasures, "display hierarchical timer", "")
+{
+        CHTimer::display();
+        CHTimer::displayHierarchicalByExecutionPathSorted (InfoLog, CHTimer::TotalTime, true, 64);
+        return true;
+}
+
+NLMISC_COMMAND(getWinDisplayerInfo, "display the info about the pos and size of the window displayer", "")
+{
+        uint32 x,y,w,h;
+        IService::getInstance()->WindowDisplayer->getWindowPos (x,y,w,h);
+        log.displayNL ("Window Displayer : XWinParam = %d; YWinParam = %d; WWinParam = %d; HWinParam = %d;", x, y, w, h);
+        return true;
+}
+
+NLMISC_COMMAND(printConfigFile, "display the variables of the default configfile", "")
+{
+        IService::getInstance()->ConfigFile.print(&log);
+        return true;
+}
+
+NLMISC_COMMAND(getUnknownConfigFileVariables, "display the variables from config file that are called but not present", "")
+{
+        log.displayNL ("%d Variables not found in the configfile '%s'", IService::getInstance()->ConfigFile.UnknownVariables.size(), IService::getInstance()->ConfigFile.getFilename().c_str() );
+        for (uint i = 0; i < IService::getInstance()->ConfigFile.UnknownVariables.size(); i++)
+        {
+                log.displayNL ("  %s", IService::getInstance()->ConfigFile.UnknownVariables[i].c_str());
+        }
+        return true;
+}
+
+NLMISC_COMMAND (freeze, "Freeze the service for N seconds (for debug purpose)", "<N>")
+{
+        if(args.size() != 1) return false;
+
+        sint32 n = atoi (args[0].c_str());
+
+        log.displayNL ("Freezing %d seconds", n);
+
+        nlSleep(n * 1000);        
+        return true;
+}
+
+
+} //NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/stdnet.cpp?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/stdnet.cpp?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..eabe08c7 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/stdnet.cpp?rev=1.1&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,15 @@ + + + +code/nel/src/net/stdnet.cpp - view - 1.1 + +
[BACK] Return to stdnet.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / stdnet.cpp (download)
+Revision 1.1, Fri Dec 28 10:41:38 2001 UTC (7 months ago) by lecroart +
Branch: MAIN +
CVS Tags: georges_v2, HEAD
+ADDED: pch
+
+

+#include "stdnet.h"
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/tcp_sock.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/tcp_sock.cpp?sortby=date new file mode 100644 index 00000000..2887bf5f --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/tcp_sock.cpp?sortby=date @@ -0,0 +1,206 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / tcp_sock.cpp
+ + + + + +
tcp_sock.cpp
+

+

Default branch: MAIN
+


+ Revision 1.7 / (download) - annotate - [select for diffs] +, Thu Feb 28 15:22:50 2002 UTC (4 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.6: +2 -2 + lines
Diff to previous 1.6 +

+CHANGED: removed some debug info
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +3 -3 + lines
Diff to previous 1.5 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +3 -3 + lines
Diff to previous 1.4 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Mon Sep 10 13:43:56 2001 UTC (10 months, 2 weeks ago) by cado +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.3: +4 -3 + lines
Diff to previous 1.3 +

+CHANGED: removed synchronization of connected()
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Thu Aug 23 14:22:41 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+Compilation Fix: socklen_t instead of int type for Unix's getsockopt
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Wed Aug 22 15:50:55 2001 UTC (11 months ago) by cado +
Branch: MAIN + +
Changes since 1.1: +53 -4 + lines
Diff to previous 1.1 +

+ADDED TCP Window Size options
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?rev=1.12&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?rev=1.12&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..cb3cf9c1 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?rev=1.12&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,414 @@ + + + +code/nel/src/net/transport_class.cpp - view - 1.12 + +
[BACK] Return to transport_class.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / transport_class.cpp (download)
+Revision 1.12, Tue Jul 2 17:27:30 2002 UTC (3 weeks, 6 days ago) by miller +
Branch: MAIN +
CVS Tags: HEAD
Changes since 1.11: +3 -2 + lines
+bug fix by Vianney
+
+

/** \file transport_class.cpp
+ * <File description>
+ *
+ * $Id: transport_class.cpp,v 1.12 2002/07/02 17:27:30 miller Exp $
+ */
+
+/* Copyright, 2000-2002 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NeL Network Services.
+ * NEVRAX NeL Network Services 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.
+
+ * NEVRAX NeL Network Services 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 NEVRAX NeL Network Services; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+/*
+ * Limitations: Not threadsafe, not reentrant.
+ */
+
+
+//
+// Includes
+//
+
+#include "stdnet.h"
+
+#include "nel/misc/types_nl.h"
+#include "nel/misc/debug.h"
+#include "nel/misc/entity_id.h"
+#include "nel/misc/sheet_id.h"
+
+#include "nel/net/unified_network.h"
+
+#include "nel/net/transport_class.h"
+
+//
+// Namespace
+//
+
+using namespace std;
+using namespace NLMISC;
+using namespace NLNET;
+
+namespace NLNET {
+
+//
+// Variables
+//
+
+uint CTransportClass::Mode = 0; // 0=nothing 1=read 2=write 3=register
+
+map<string, CTransportClass::CRegisteredClass>  CTransportClass::LocalRegisteredClass;        // registered class that are in my program
+
+CTransportClass::CRegisteredClass       CTransportClass::TempRegisteredClass;
+
+NLNET::CMessage CTransportClass::TempMessage;
+
+vector<CTransportClass::CRegisteredBaseProp *> CTransportClass::DummyProp;
+
+bool CTransportClass::Init = false;
+
+
+//
+// Functions
+//
+
+string typeToString (CTransportClass::TProp type)
+{
+        string conv[] = {
+                "PropUInt8", "PropUInt16", "PropUInt32", "PropUInt64",
+                "PropSInt8", "PropSInt16", "PropSInt32", "PropSInt64",
+                "PropBool", "PropFloat", "PropDouble", "PropString", "PropEntityId", "PropSheetId", "PropUKN" };
+
+        if (type > CTransportClass::PropUKN)
+                return "<InvalidType>";
+        else
+                return conv[type];
+}
+
+void CTransportClass::displayDifferentClass (uint8 sid, const string &className, const vector<CRegisteredBaseProp> &otherClass, const vector<CRegisteredBaseProp *> &myClass)
+{
+        nlinfo ("Service with sid %u send me the TransportClass '%s' with differents properties:", sid, className.c_str());
+        uint i;
+        nlinfo ("  My local TransportClass is:");
+        for (i = 0; i < myClass.size(); i++)
+        {
+                nlinfo ("    Property: %d Name: '%s' type: '%s'", i, myClass[i]->Name.c_str(), typeToString(myClass[i]->Type).c_str());
+        }
+
+        nlinfo ("  The other side TransportClass is:");
+        for (i = 0; i < otherClass.size(); i++)
+        {
+                nlinfo ("    Property: %d Name: '%s' type: '%s'", i, otherClass[i].Name.c_str(), typeToString(otherClass[i].Type).c_str());
+        }
+}
+
+void CTransportClass::registerOtherSideClass (uint8 sid, TOtherSideRegisteredClass &osrc)
+{
+        for (TOtherSideRegisteredClass::iterator it = osrc.begin(); it != osrc.end (); it++)
+        {
+                // find the class name in the map
+
+                TRegisteredClass::iterator res = LocalRegisteredClass.find ((*it).first);
+                if (res == LocalRegisteredClass.end ())
+                {
+                        // it s a class that the other side have but not me, can't send this class
+                        nlwarning ("CTransportClass::registerOtherSideClass(): the other side class '%s' is not registered in my system, skip it", (*it).first.c_str());
+                        continue;
+                }
+
+                if (sid >= (*res).second.Instance->States.size ())
+                        (*res).second.Instance->States.resize (sid+1);
+
+                (*res).second.Instance->States[sid].clear ();
+
+                for (sint j = 0; j < (sint)(*it).second.size (); j++)
+                {
+                        // check each prop to see the correspondance
+
+                        // try to find the prop name in the array
+                        uint k;
+                        for (k = 0; k < (*res).second.Instance->Prop.size(); k++)
+                        {
+                                if ((*it).second[j].Name == (*res).second.Instance->Prop[k]->Name)
+                                {
+                                        if ((*it).second[j].Type != (*res).second.Instance->Prop[k]->Type)
+                                        {
+                                                nlwarning ("Property '%s' of the class '%s' have not the same type in the 2 sides (%s %s)", (*it).second[j].Name.c_str(), (*it).first.c_str(), typeToString((*it).second[j].Type).c_str(), typeToString((*res).second.Instance->Prop[k]->Type).c_str());
+                                        }
+                                        break;
+                                }
+                        }
+                        if (k == (*res).second.Instance->Prop.size())
+                        {
+                                // not found, put -1
+                                (*res).second.Instance->States[sid].push_back (make_pair (-1, (*it).second[j].Type));
+                        }
+                        else
+                        {
+                                // same, store the index
+                                (*res).second.Instance->States[sid].push_back (make_pair (k, PropUKN));
+                        }
+                }
+
+                // check if the version are the same
+                if ((*it).second.size () != (*res).second.Instance->Prop.size ())
+                {
+                        // 2 class don't have the same number of prop => different class => display class
+                        displayDifferentClass (sid, (*it).first.c_str(), (*it).second, (*res).second.Instance->Prop);
+                }
+                else
+                {
+                        // check if the prop are same
+                        for (uint i = 0; i < (*res).second.Instance->Prop.size (); i++)
+                        {
+                                if ((*res).second.Instance->Prop[i]->Name != (*it).second[i].Name)
+                                {
+                                        // different name => different class => display class
+                                        displayDifferentClass (sid, (*it).first.c_str(), (*it).second, (*res).second.Instance->Prop);
+                                        break;
+                                }
+                                else if ((*res).second.Instance->Prop[i]->Type != (*it).second[i].Type)
+                                {
+                                        // different type => different class => display class
+                                        displayDifferentClass (sid, (*it).first.c_str(), (*it).second, (*res).second.Instance->Prop);
+                                        break;
+                                }
+                        }
+                }
+        }
+
+        displayLocalRegisteredClass ();
+}
+
+
+void CTransportClass::registerClass (CTransportClass &instance)
+{
+        nlassert (Init);
+        nlassert (Mode == 0);
+
+        // set the mode to register
+        Mode = 3;
+        
+        // clear the current class
+        TempRegisteredClass.clear ();
+
+        // set the instance pointer
+        TempRegisteredClass.Instance = &instance;
+
+        // fill name and props
+        TempRegisteredClass.Instance->description ();
+
+        // add the new registered class in the array
+        LocalRegisteredClass[TempRegisteredClass.Instance->Name] = TempRegisteredClass;
+
+        // set to mode none
+        Mode = 0;
+}
+
+void CTransportClass::unregisterClass ()
+{
+        for (TRegisteredClass::iterator it = LocalRegisteredClass.begin(); it != LocalRegisteredClass.end (); it++)
+        {
+                for (uint j = 0; j < (*it).second.Instance->Prop.size (); j++)
+                {
+                        delete (*it).second.Instance->Prop[j];
+                }
+                (*it).second.Instance->Prop.clear ();
+                (*it).second.Instance = NULL;
+        }
+        LocalRegisteredClass.clear ();
+}
+
+void CTransportClass::displayLocalRegisteredClass (CRegisteredClass &c)
+{
+        nldebug ("NETTC:  > %s", c.Instance->Name.c_str());
+        for (uint j = 0; j < c.Instance->Prop.size (); j++)
+        {
+                nldebug ("NETTC:    > %s %s", c.Instance->Prop[j]->Name.c_str(), typeToString(c.Instance->Prop[j]->Type).c_str());
+        }
+
+        for (uint l = 0; l < c.Instance->States.size (); l++)
+        {
+                if (c.Instance->States[l].size () != 0)
+                {
+                        nldebug ("NETTC:      > sid: %u", l);
+                        for (uint k = 0; k < c.Instance->States[l].size (); k++)
+                        {
+                                nldebug ("NETTC:      - %d type : %s", c.Instance->States[l][k].first, typeToString(c.Instance->States[l][k].second).c_str());
+                        }
+                }
+        }
+}
+
+void CTransportClass::displayLocalRegisteredClass ()
+{
+        nldebug ("NETTC:> LocalRegisteredClass:");
+        for (TRegisteredClass::iterator it = LocalRegisteredClass.begin(); it != LocalRegisteredClass.end (); it++)
+        {
+                displayLocalRegisteredClass ((*it).second);
+        }
+}
+
+void cbTCReceiveMessage (CMessage &msgin, const string &name, uint16 sid)
+{
+        nldebug ("NETTC: cbReceiveMessage");
+
+        CTransportClass::TempMessage = msgin;
+
+        string className;
+        CTransportClass::TempMessage.serial (className);
+
+        CTransportClass::TRegisteredClass::iterator it = CTransportClass::LocalRegisteredClass.find (className);
+        if (it == CTransportClass::LocalRegisteredClass.end ())
+        {
+                nlwarning ("receive unknown class '%s', skip it", className.c_str());
+                return;
+        }
+
+        nlassert ((*it).second.Instance != NULL);
+        (*it).second.Instance->read (name, (uint8)sid);
+}
+
+void cbTCReceiveOtherSideClass (CMessage &msgin, const string &name, uint16 sid)
+{
+        nldebug ("NETTC: cbReceiveOtherSideClass");
+
+        CTransportClass::TOtherSideRegisteredClass osrc;
+
+        uint32 nbClass;
+        msgin.serial (nbClass);
+
+        nldebug ("NETTC: %d class", nbClass);
+
+        for (uint i = 0; i < nbClass; i++)
+        {
+                string className;
+                msgin.serial (className);
+
+                osrc.push_back(make_pair (className, vector<CTransportClass::CRegisteredBaseProp>()));
+
+                uint32 nbProp;
+                msgin.serial (nbProp);
+
+                nldebug ("NETTC:   %s (%d prop)", className.c_str(), nbProp);
+
+                for (uint j = 0; j < nbProp; j++)
+                {
+                        CTransportClass::CRegisteredBaseProp prop;
+                        msgin.serial (prop.Name);
+                        msgin.serialEnum (prop.Type);
+                        nldebug ("NETTC:     %s %s", prop.Name.c_str(), typeToString(prop.Type).c_str());
+                        osrc[osrc.size()-1].second.push_back (prop);
+                }
+        }
+
+        // we have the good structure
+        CTransportClass::registerOtherSideClass ((uint8)sid, osrc);
+}
+
+static TUnifiedCallbackItem CallbackArray[] =
+{
+        { "CT_LRC", cbTCReceiveOtherSideClass },
+        { "CT_MSG", cbTCReceiveMessage },
+};
+
+void cbTCUpService (const std::string &serviceName, uint16 sid, void *arg)
+{
+        nldebug ("NETTC: CTransportClass Service %s %d is up", serviceName.c_str(), sid);
+        if (sid >= 256)
+                return;
+        CTransportClass::sendLocalRegisteredClass ((uint8)sid);
+}
+
+void CTransportClass::init ()
+{
+        // this isn't an error!
+        if (Init) return;
+
+        // filter all my debug stuffs
+        DebugLog->addNegativeFilter ("NETTC");
+
+
+        CUnifiedNetwork::getInstance()->addCallbackArray (CallbackArray, sizeof (CallbackArray) / sizeof (CallbackArray[0]));
+
+        // create an instance of all d'ifferent prop types
+
+        DummyProp.resize (PropUKN);
+
+        nlassert (PropUInt8 < PropUKN); DummyProp[PropUInt8] = new CTransportClass::CRegisteredProp<uint8>;
+        nlassert (PropUInt16 < PropUKN); DummyProp[PropUInt16] = new CTransportClass::CRegisteredProp<uint16>;
+        nlassert (PropUInt32 < PropUKN); DummyProp[PropUInt32] = new CTransportClass::CRegisteredProp<uint32>;
+        nlassert (PropUInt64 < PropUKN); DummyProp[PropUInt64] = new CTransportClass::CRegisteredProp<uint64>;
+        nlassert (PropSInt8 < PropUKN); DummyProp[PropSInt8] = new CTransportClass::CRegisteredProp<sint8>;
+        nlassert (PropSInt16 < PropUKN); DummyProp[PropSInt16] = new CTransportClass::CRegisteredProp<sint16>;
+        nlassert (PropSInt32 < PropUKN); DummyProp[PropSInt32] = new CTransportClass::CRegisteredProp<sint32>;
+        nlassert (PropSInt64 < PropUKN); DummyProp[PropSInt64] = new CTransportClass::CRegisteredProp<sint64>;
+        nlassert (PropBool < PropUKN); DummyProp[PropBool] = new CTransportClass::CRegisteredProp<bool>;
+        nlassert (PropFloat < PropUKN); DummyProp[PropFloat] = new CTransportClass::CRegisteredProp<float>;
+        nlassert (PropDouble < PropUKN); DummyProp[PropDouble] = new CTransportClass::CRegisteredProp<double>;
+        nlassert (PropString < PropUKN); DummyProp[PropString] = new CTransportClass::CRegisteredProp<string>;
+        nlassert (PropEntityId < PropUKN); DummyProp[PropEntityId] = new CTransportClass::CRegisteredProp<CEntityId>;
+        nlassert (PropSheetId < PropUKN); DummyProp[PropSheetId] = new CTransportClass::CRegisteredProp<CSheetId>;
+
+        // we have to know when a service comes, so add callback (put the callback before all other one because we have to send this message first)
+        CUnifiedNetwork::getInstance()->setServiceUpCallback("*", cbTCUpService, NULL, false);
+
+        Init = true;
+}
+
+void CTransportClass::release ()
+{
+        unregisterClass ();
+
+        for (uint i = 0; i < DummyProp.size (); i++)
+        {
+                delete DummyProp[i];
+        }
+        DummyProp.clear ();
+}
+
+void CTransportClass::createLocalRegisteredClassMessage ()
+{
+        TempMessage.clear ();
+        if (TempMessage.isReading())
+                TempMessage.invert();
+        TempMessage.setType ("CT_LRC");
+
+        uint32 nbClass = LocalRegisteredClass.size ();
+        TempMessage.serial (nbClass);
+
+        for (TRegisteredClass::iterator it = LocalRegisteredClass.begin(); it != LocalRegisteredClass.end (); it++)
+        {
+                nlassert ((*it).first == (*it).second.Instance->Name);
+
+                TempMessage.serial ((*it).second.Instance->Name);
+
+                uint32 nbProp = (*it).second.Instance->Prop.size ();
+                TempMessage.serial (nbProp);
+
+                for (uint j = 0; j < (*it).second.Instance->Prop.size (); j++)
+                {
+                        // send the name and the type of the prop
+                        TempMessage.serial ((*it).second.Instance->Prop[j]->Name);
+                        TempMessage.serialEnum ((*it).second.Instance->Prop[j]->Type);
+                }
+        }
+}
+
+} // NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?sortby=date new file mode 100644 index 00000000..5b57901f --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/transport_class.cpp?sortby=date @@ -0,0 +1,251 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / transport_class.cpp
+ + + + + +
transport_class.cpp
+

+

Default branch: MAIN
+


+ Revision 1.12 / (download) - annotate - [select for diffs] +, Tue Jul 2 17:27:30 2002 UTC (3 weeks, 6 days ago) by miller +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.11: +3 -2 + lines
Diff to previous 1.11 +

+bug fix by Vianney
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Fri Jun 21 12:59:52 2002 UTC (5 weeks, 3 days ago) by miller +
Branch: MAIN + +
Changes since 1.10: +3 -2 + lines
Diff to previous 1.10 +

+CHANGED: behaviour of init() - now returns peacefuly if already initialised
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Mon Jun 3 14:53:33 2002 UTC (8 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +5 -1 + lines
Diff to previous 1.9 +

+ADDED: manage sheet_id
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Mon Jun 3 09:54:52 2002 UTC (8 weeks ago) by miller +
Branch: MAIN + +
Changes since 1.8: +3 -2 + lines
Diff to previous 1.8 +

+ADDED: PropSheetId to the managed property types
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Mon Apr 15 14:49:34 2002 UTC (3 months, 1 week ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.7: +2 -2 + lines
Diff to previous 1.7 +

+#BUGIX: synthax error
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Mon Apr 15 14:30:42 2002 UTC (3 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.6: +8 -1 + lines
Diff to previous 1.6 +

+ADDED: assert if init() wasn't called.
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Mon Mar 25 09:22:34 2002 UTC (4 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +2 -2 + lines
Diff to previous 1.5 +

+#FIXED: .c_str()
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu Mar 14 13:48:12 2002 UTC (4 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +89 -29 + lines
Diff to previous 1.4 +

+ADDED: more assert and test
+ADDED: warn the user by displaying different classes
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Tue Feb 19 13:14:57 2002 UTC (5 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.3: +4 -2 + lines
Diff to previous 1.3 +

+ADDED: string and entity_id management
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Fri Feb 15 15:23:29 2002 UTC (5 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +2 -2 + lines
Diff to previous 1.2 +

+BUGFIX: linux compile
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Fri Feb 15 15:22:53 2002 UTC (5 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +8 -8 + lines
Diff to previous 1.1 +

+BUGFIX: linux compile
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Fri Feb 15 14:40:21 2002 UTC (5 months, 1 week ago) by lecroart +
Branch: MAIN + +
Diff

+ADDED: transport class
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?rev=1.11&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?rev=1.11&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..02dd6ba2 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?rev=1.11&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,220 @@ + + + +code/nel/src/net/udp_sock.cpp - view - 1.11 + +
[BACK] Return to udp_sock.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / udp_sock.cpp (download)
+Revision 1.11, Wed Apr 17 09:54:00 2002 UTC (3 months, 1 week ago) by cado +
Branch: MAIN +
CVS Tags: georges_v2, HEAD
Changes since 1.10: +3 -4 + lines
+BUGFIX: wrong address
+
+

/** \file udp_sock.cpp
+ * Network engine, layer 0, udp socket
+ *
+ * $Id: udp_sock.cpp,v 1.11 2002/04/17 09:54:00 cado Exp $
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/net/udp_sock.h"
+
+#ifdef NL_OS_WINDOWS
+#include <winsock2.h>
+#define socklen_t int
+#define ERROR_NUM WSAGetLastError()
+
+#elif defined NL_OS_UNIX
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <errno.h>
+//#include <fcntl.h>
+#define SOCKET_ERROR -1
+#define INVALID_SOCKET -1
+#define ERROR_NUM errno
+#define ERROR_MSG strerror(errno)
+typedef int SOCKET;
+
+#endif
+
+using namespace NLMISC;
+
+namespace NLNET {
+
+
+/*
+ * Constructor
+ */
+CUdpSock::CUdpSock( bool logging ) :
+        CSock( logging ),
+        _Bound( false )
+{
+        // Socket creation
+        createSocket( SOCK_DGRAM, IPPROTO_UDP );
+}
+
+
+/** Binds the socket to the specified port. Call bind() for an unreliable socket if the host acts as a server and waits for
+ * messages. If the host acts as a client, call sendTo(), there is no need to bind the socket.
+ */
+void CUdpSock::bind( uint16 port )
+{
+        CInetAddress addr; // any IP address
+        addr.setPort( port );
+        bind( addr );
+        setLocalAddress(); // will not set the address if the host is multihomed, use bind(CInetAddress) instead
+}
+
+
+/*
+ * Same as bind(uint16) but binds on a specified address/port (useful when the host has several addresses)
+ */
+void CUdpSock::bind( const CInetAddress& addr )
+{
+#ifndef NL_OS_WINDOWS
+        // Set Reuse Address On (does not work on Win98 and is useless on Win2000)
+        int value = true;
+        if ( setsockopt( _Sock, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value) ) == SOCKET_ERROR )
+        {
+                throw ESocket( "ReuseAddr failed" );
+        }
+#endif
+
+        _LocalAddr = addr;
+
+        // Bind the socket
+        if ( ::bind( _Sock, (sockaddr*)(_LocalAddr.sockAddr()), sizeof(sockaddr) ) == SOCKET_ERROR )
+        {
+                throw ESocket( "Bind failed" );
+        }
+        _Bound = true;
+        if ( _Logging )
+        {
+                nldebug( "LNETL0: Socket %d bound at %s", _Sock, _LocalAddr.asString().c_str() );
+        }
+}
+
+
+/*
+ * Sends a message
+ */
+void CUdpSock::sendTo( const uint8 *buffer, uint len, const CInetAddress& addr )
+{
+        
+        //  Send
+        if ( ::sendto( _Sock, (const char*)buffer, len, 0, (sockaddr*)(addr.sockAddr()), sizeof(sockaddr) ) != (sint32)len )
+        {
+                throw ESocket( "Unable to send datagram" );
+        }
+        _BytesSent += len;
+
+        if ( _Logging )
+        {
+                nldebug( "LNETL0: Socket %d sent %d bytes to %s", _Sock, len, addr.asString().c_str() );
+        }
+
+        // If socket is unbound, retrieve local address
+        if ( ! _Bound )
+        {
+                setLocalAddress();
+                _Bound = true;
+        }
+
+#ifdef NL_OS_WINDOWS
+        // temporary by ace to know size of SO_MAX_MSG_SIZE
+        static bool first = true;
+        if (first)
+        {
+                uint MMS, SB;
+                int  size = sizeof (MMS);
+                getsockopt (_Sock, SOL_SOCKET, SO_SNDBUF, (char *)&SB, &size);
+                getsockopt (_Sock, SOL_SOCKET, SO_MAX_MSG_SIZE, (char *)&MMS, &size);
+                nlinfo ("the udp SO_MAX_MSG_SIZE=%u, SO_SNDBUF=%u", MMS, SB);
+                first = false;
+        }
+#endif
+}
+
+
+/*
+ * Receives data from the peer. (blocking function)
+ */
+void CUdpSock::receive( uint8 *buffer, uint32& len )
+{
+        nlassert( _Connected && (buffer!=NULL) );
+
+        // Receive incoming message
+        len = ::recv( _Sock, (char*)buffer, len , 0 );
+
+        // Check for errors (after setting the address)
+        if ( len == SOCKET_ERROR )
+        {
+                throw ESocket( "Cannot receive data" );
+        }
+
+        _BytesReceived += len;
+        if ( _Logging )
+        {
+                nldebug( "LNETL0: Socket %d received %d bytes from peer %s", _Sock, len, _RemoteAddr.asString().c_str() );
+        }
+}
+
+
+/*
+ * Receives data and say who the sender is. (blocking function)
+ */
+void CUdpSock::receivedFrom( uint8 *buffer, uint& len, CInetAddress& addr )
+{
+        // Receive incoming message
+        sockaddr_in saddr;
+        socklen_t saddrlen = sizeof(saddr);
+
+        len = ::recvfrom( _Sock, (char*)buffer, len , 0, (sockaddr*)&saddr, &saddrlen );
+
+        // If an error occurs, the saddr is not valid
+        // When the remote socket is closed, get sender's address to know who is quitting
+        addr.setSockAddr( &saddr );
+
+        // Check for errors (after setting the address)
+        if ( len == SOCKET_ERROR )
+        {
+                throw ESocket( "Cannot receive data" );
+        }
+
+        _BytesReceived += len;
+        if ( _Logging )
+        {
+                nldebug( "LNETL0: Socket %d received %d bytes from %s", _Sock, len, addr.asString().c_str() );
+        }
+}
+
+
+} // NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?sortby=date new file mode 100644 index 00000000..f10c79e0 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/udp_sock.cpp?sortby=date @@ -0,0 +1,246 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / udp_sock.cpp
+ + + + + +
udp_sock.cpp
+

+

Default branch: MAIN
+


+ Revision 1.11 / (download) - annotate - [select for diffs] +, Wed Apr 17 09:54:00 2002 UTC (3 months, 1 week ago) by cado +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.10: +3 -4 + lines
Diff to previous 1.10 +

+BUGFIX: wrong address
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Tue Apr 9 12:23:52 2002 UTC (3 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +5 -3 + lines
Diff to previous 1.9 +

+BUGFIX
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.8: +3 -3 + lines
Diff to previous 1.8 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.7: +5 -5 + lines
Diff to previous 1.7 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Tue Oct 9 09:34:25 2001 UTC (9 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.6: +35 -9 + lines
Diff to previous 1.6 +

+ADDED receive and receiveFrom return len
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Fri Sep 28 12:39:49 2001 UTC (10 months ago) by cado +
Branch: MAIN + +
Changes since 1.5: +14 -10 + lines
Diff to previous 1.5 +

+ADDED address enumeration, multihomed hosts support
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Thu Aug 23 14:31:20 2001 UTC (11 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.4: +3 -5 + lines
Diff to previous 1.4 +

+CHANGED: receivedfrom don't return anything now
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Wed Aug 22 15:50:34 2001 UTC (11 months ago) by cado +
Branch: MAIN + +
Changes since 1.3: +1 -6 + lines
Diff to previous 1.3 +

+Changed behaviour of receiveFrom : does not check if data available
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Mon Jul 9 10:12:25 2001 UTC (12 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.2: +13 -6 + lines
Diff to previous 1.2 +

+BUGFIX: setsockopt missing option
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Fri Jul 6 17:30:24 2001 UTC (12 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +11 -3 + lines
Diff to previous 1.1 +

+ADDED: debug info about MMS and MTU
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+ADD: new version of the network system (in NeL and NeLns)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/unified_network.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/unified_network.cpp?sortby=date new file mode 100644 index 00000000..efcb2f6b --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/unified_network.cpp?sortby=date @@ -0,0 +1,570 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / unified_network.cpp
+ + + + + +
unified_network.cpp
+

+

Default branch: MAIN
+


+ Revision 1.44 / (download) - annotate - [select for diffs] +, Fri Jul 26 09:01:18 2002 UTC (3 days, 9 hours ago) by lecroart +
Branch: MAIN + +
CVS Tags: HEAD +
Changes since 1.43: +11 -2 + lines
Diff to previous 1.43 +

+ADDED: stop check if the fucking assert occurs
+
+

+ Revision 1.43 / (download) - annotate - [select for diffs] +, Thu Jul 25 14:32:44 2002 UTC (4 days, 4 hours ago) by legros +
Branch: MAIN + +
Changes since 1.42: +27 -12 + lines
Diff to previous 1.42 +

+ADDED: verbose info
+
+

+ Revision 1.42 / (download) - annotate - [select for diffs] +, Mon Jul 1 18:27:42 2002 UTC (4 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.41: +25 -13 + lines
Diff to previous 1.41 +

+FIXED: unicallback not called on not shard service relogging
+
+

+ Revision 1.41 / (download) - annotate - [select for diffs] +, Tue Jun 25 09:35:58 2002 UTC (4 weeks, 6 days ago) by legros +
Branch: MAIN + +
Changes since 1.40: +17 -3 + lines
Diff to previous 1.40 +

+FIXED: getNetBase() doesn't returns disconnected sockets any longer
+
+

+ Revision 1.40 / (download) - annotate - [select for diffs] +, Wed Jun 12 10:16:34 2002 UTC (6 weeks, 5 days ago) by lecroart +
Branch: MAIN + +
Changes since 1.39: +7 -5 + lines
Diff to previous 1.39 +

+ADDED: changed NULL into InvalidSockId
+
+

+ Revision 1.39 / (download) - annotate - [select for diffs] +, Tue Jun 11 14:46:19 2002 UTC (6 weeks, 6 days ago) by legros +
Branch: MAIN + +
Changes since 1.38: +3 -1 + lines
Diff to previous 1.38 +

+FIXED: flush should not crash any longer on client callbacks
+
+

+ Revision 1.38 / (download) - annotate - [select for diffs] +, Fri May 31 08:00:09 2002 UTC (8 weeks, 3 days ago) by chafik +
Branch: MAIN + +
Changes since 1.37: +3 -1 + lines
Diff to previous 1.37 +

+#added: float & double in the createMessage procedure.
+
+

+ Revision 1.37 / (download) - annotate - [select for diffs] +, Mon May 27 16:50:50 2002 UTC (2 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.36: +123 -8 + lines
Diff to previous 1.36 +

+BUGFIX: everything to avoid problem when disconnection lag
+
+

+ Revision 1.36 / (download) - annotate - [select for diffs] +, Thu Mar 28 17:45:07 2002 UTC (4 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2 +
Changes since 1.35: +3 -2 + lines
Diff to previous 1.35 +

+BUGFIX: don't disconnect the NS if we don't use NS
+
+

+ Revision 1.35 / (download) - annotate - [select for diffs] +, Mon Mar 25 09:22:22 2002 UTC (4 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.34: +13 -13 + lines
Diff to previous 1.34 +

+CHANGED: rename callback to avoid function name conflict
+
+

+ Revision 1.34 / (download) - annotate - [select for diffs] +, Thu Mar 21 13:30:51 2002 UTC (4 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.33: +19 -2 + lines
Diff to previous 1.33 +

+FIXED: service lookup in getNetBase should work now (looks into _ConnectionStack as well)
+
+

+ Revision 1.33 / (download) - annotate - [select for diffs] +, Thu Mar 14 09:47:57 2002 UTC (4 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.32: +149 -2 + lines
Diff to previous 1.32 +

+ADDED: msgin and msgout command to simulate send and receive message from network
+
+

+ Revision 1.32 / (download) - annotate - [select for diffs] +, Tue Mar 12 14:12:49 2002 UTC (4 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.31: +25 -16 + lines
Diff to previous 1.31 +

+FIXED: unified network
+
+

+ Revision 1.31 / (download) - annotate - [select for diffs] +, Mon Mar 11 11:32:57 2002 UTC (4 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.30: +18 -8 + lines
Diff to previous 1.30 +

+CHANGED: getInstance() assert if CUnifiedNetwork is not initialized
+
+

+ Revision 1.30 / (download) - annotate - [select for diffs] +, Mon Feb 11 17:38:48 2002 UTC (5 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.29: +35 -3 + lines
Diff to previous 1.29 +

+FIXED: message processing now checks the validity of the service name
+
+

+ Revision 1.29 / (download) - annotate - [select for diffs] +, Thu Feb 7 17:16:22 2002 UTC (5 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.28: +27 -17 + lines
Diff to previous 1.28 +

+ADDED: can add more than one callback for service up and down
+
+

+ Revision 1.28 / (download) - annotate - [select for diffs] +, Tue Jan 22 14:08:59 2002 UTC (6 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.27: +4 -2 + lines
Diff to previous 1.27 +

+CHANGED: sleep(1)
+
+

+ Revision 1.27 / (download) - annotate - [select for diffs] +, Mon Dec 31 13:32:39 2001 UTC (6 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.26: +36 -13 + lines
Diff to previous 1.26 +

+ADDED: the NS can shutdown/restart and resync with other services
+
+

+ Revision 1.26 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.25: +6 -5 + lines
Diff to previous 1.25 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.25 / (download) - annotate - [select for diffs] +, Mon Dec 10 14:34:31 2001 UTC (7 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.24: +15 -13 + lines
Diff to previous 1.24 +

+CHANGED: net log are better specified to enable log filtering
+
+

+ Revision 1.24 / (download) - annotate - [select for diffs] +, Thu Nov 29 15:39:54 2001 UTC (7 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.23: +38 -11 + lines
Diff to previous 1.23 +

+ADDED: update time out depending of the last update
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Wed Nov 28 11:12:08 2001 UTC (7 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.22: +3 -3 + lines
Diff to previous 1.22 +

+BUGFIX: autoretry connection crashed
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Wed Nov 28 10:36:52 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.21: +3 -4 + lines
Diff to previous 1.21 +

+BUGFIX: crash when launching/killing lot of services quickly
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Tue Nov 27 17:53:12 2001 UTC (8 months ago) by legros +
Branch: MAIN + +
Changes since 1.20: +2 -2 + lines
Diff to previous 1.20 +

+FIXED: uses service id instead of service name in addService()
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Tue Nov 27 17:33:07 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.19: +35 -20 + lines
Diff to previous 1.19 +

+CHANGED: now release threads in the release()
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Tue Nov 27 15:01:52 2001 UTC (8 months ago) by legros +
Branch: MAIN + +
Changes since 1.18: +167 -148 + lines
Diff to previous 1.18 +

+FIXED: layer5 secured a bit
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:15:09 2001 UTC (8 months ago) by cado +
Branch: MAIN + +
Changes since 1.17: +5 -3 + lines
Diff to previous 1.17 +

+BUGFIX: compile on linux
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Tue Nov 27 14:12:48 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.16: +3 -4 + lines
Diff to previous 1.16 +

+#english fix (sended->sent finnish->finish)
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Mon Nov 26 16:42:40 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +89 -21 + lines
Diff to previous 1.15 +

+BUGFIX: when decon->con quickly
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Thu Nov 22 10:40:13 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +17 -2 + lines
Diff to previous 1.14 +

+TRY: change nlSleep(10) into nlSleep(0)
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Tue Nov 20 16:36:55 2001 UTC (8 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.13: +33 -5 + lines
Diff to previous 1.13 +

+FIXED: service id correctly set
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Mon Nov 19 14:24:54 2001 UTC (8 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.12: +2 -2 + lines
Diff to previous 1.12 +

+FIXED: read/write accessor debugged
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Mon Nov 19 14:07:45 2001 UTC (8 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +9 -7 + lines
Diff to previous 1.11 +

+REMOVED: unuseful debug
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Thu Nov 15 15:26:40 2001 UTC (8 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.10: +318 -125 + lines
Diff to previous 1.10 +

+FIXED: now works properly in multithreaded
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Wed Nov 14 10:14:06 2001 UTC (8 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +2 -2 + lines
Diff to previous 1.9 +

+#FIXED: char * to string&
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Wed Nov 14 10:02:00 2001 UTC (8 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.8: +3 -2 + lines
Diff to previous 1.8 +

+FIXED: serviceName in callbacks
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Wed Nov 14 09:45:05 2001 UTC (8 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.7: +19 -11 + lines
Diff to previous 1.7 +

+CHANGED: timeout reinterpreted in update(timeout)
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Tue Nov 13 14:36:18 2001 UTC (8 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.6: +7 -4 + lines
Diff to previous 1.6 +

+FIXED: appId() correctly set now a relog (after a service crash and autoRetry)
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Tue Nov 13 13:05:58 2001 UTC (8 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.5: +54 -20 + lines
Diff to previous 1.5 +

+FIXED: connection is a bit more secured, auto retry should work properly now
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Tue Nov 13 11:58:42 2001 UTC (8 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +6 -1 + lines
Diff to previous 1.4 +

+ADDED: comment
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Tue Nov 13 10:53:46 2001 UTC (8 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.3: +7 -1 + lines
Diff to previous 1.3 +

+FIXED: "*" properly handled for service up/down
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Mon Nov 12 10:21:21 2001 UTC (8 months, 2 weeks ago) by legros +
Branch: MAIN + +
Changes since 1.2: +23 -1 + lines
Diff to previous 1.2 +

+ADDED: callbacks for all up/down service
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Mon Oct 29 18:33:29 2001 UTC (8 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.1: +5 -1 + lines
Diff to previous 1.1 +

+ADDED: isUsed()
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:23:04 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Diff

+New hi level network protocol
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?rev=1.31&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?rev=1.31&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..d4ccaf2b --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?rev=1.31&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,397 @@ + + + +code/nel/src/net/unitime.cpp - view - 1.31 + +
[BACK] Return to unitime.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / src / net

File: Nevrax / code / nel / src / net / unitime.cpp (download)
+Revision 1.31, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN +
CVS Tags: georges_v2, HEAD
Changes since 1.30: +12 -11 + lines
+ADDED: support of precompilated header on visual
+
+

/** \file unitime.cpp
+ * _CUniTime class
+ *
+ * $Id: unitime.cpp,v 1.31 2001/12/28 10:17:21 lecroart Exp $
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL 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.
+
+ * NEVRAX NEL 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 NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include "stdnet.h"
+
+#include "nel/net/callback_client.h"
+#include "nel/net/callback_server.h"
+#include "nel/net/naming_client.h"
+#include "nel/net/message.h"
+
+#include "nel/net/unitime.h"
+
+using namespace NLMISC;
+using namespace std;
+
+namespace NLNET
+{
+
+TTime _CUniTime::_SyncUniTime = 0;
+TTime _CUniTime::_SyncLocalTime = 0;
+bool _CUniTime::_Simulate = false;
+
+bool _CUniTime::Sync = false;
+
+
+void _CUniTime::setUniTime (NLMISC::TTime uTime, NLMISC::TTime lTime)
+{
+        nlstop;
+/*      if (Sync)
+        {
+                TTime lt = getLocalTime ();
+                TTime delta = uTime - lTime + _SyncLocalTime - _SyncUniTime;
+
+                nlinfo ("_CUniTime::setUniTime(%"NL_I64"d, %"NL_I64"d): Resyncing delta %"NL_I64"dms",uTime,lTime,delta);
+        }
+        else
+        {
+                nlinfo ("_CUniTime::setUniTime(%"NL_I64"d, %"NL_I64"d)",uTime,lTime);
+                Sync = true;
+        }
+        _SyncUniTime = uTime;
+        _SyncLocalTime = lTime;
+*/}
+
+void _CUniTime::setUniTime (NLMISC::TTime uTime)
+{
+        nlstop;
+//      setUniTime (uTime, getLocalTime ());
+}
+
+
+
+TTime _CUniTime::getUniTime ()
+{
+        nlstop;
+        return 0;
+/*      if (!Sync)
+        {
+                nlerror ("called getUniTime before calling syncUniTimeFromServer");
+        }
+        return getLocalTime () - (_SyncLocalTime - _SyncUniTime);
+*/
+}
+
+
+const char *_CUniTime::getStringUniTime ()
+{
+        nlstop;
+        return getStringUniTime(_CUniTime::getUniTime());
+}
+
+
+const char *_CUniTime::getStringUniTime (TTime ut)
+{
+        nlstop;
+        static char str[512];
+
+        uint32 ms = (uint32) (ut % 1000); // time in ms 1000ms dans 1s
+        ut /= 1000;
+
+        uint32 s = (uint32) (ut % 60); // time in seconds 60s dans 1mn
+        ut /= 60;
+
+        uint32 m = (uint32) (ut % 60); // time in minutes 60m dans 1h
+        ut /= 60;
+
+        uint32 h = (uint32) (ut % 9); // time in hours 9h dans 1j
+        ut /= 9;
+
+        uint32 day = (uint32) (ut % (8*4)); // time in days 8day dans 1month
+        ut /= 8;
+
+        uint32 week = (uint32) (ut % 4); // time in weeks 4week dans 1month
+        ut /= 4;
+
+        uint32 month = (uint32) (ut % 12); // time in months 12month dans 1year
+        ut /= 12;
+
+        uint  year =  (uint32) ut;        // time in years
+
+        smprintf (str, 512, "%02d/%02d/%04d (week %d) %02d:%02d:%02d.%03d", day+1, month+1, year+1, week+1, h, m, s, ms);
+        return str;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////// SYNCHRONISATION BETWEEN TIME SERVICE AND OTHER SERVICES ////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static bool GetUniversalTime;
+static uint32 GetUniversalTimeSecondsSince1970;
+static TTime GetUniversalTimeUniTime;
+
+
+static void cbGetUniversalTime (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        nlstop;
+        // get the association between a date and unitime
+        msgin.serial (GetUniversalTimeSecondsSince1970);
+        msgin.serial (GetUniversalTimeUniTime);
+        GetUniversalTime = true;
+}
+
+static TCallbackItem UniTimeCallbackArray[] =
+{
+        { "GUT", cbGetUniversalTime }
+};
+
+void _CUniTime::syncUniTimeFromService (CCallbackNetBase::TRecordingState rec, const CInetAddress *addr)
+{
+        nlstop;
+        /*
+        TTime deltaAdjust, lt;
+        uint32 firstsecond, nextsecond;
+        TTime before, after, delta;
+
+        // create a message with type in the full text format
+        CMessage msgout ("AUT");
+        CCallbackClient server( rec, "TS.nmr" );
+        server.addCallbackArray (UniTimeCallbackArray, sizeof (UniTimeCallbackArray) / sizeof (UniTimeCallbackArray[0]));
+
+        if (addr == NULL)
+        {
+                CNamingClient::lookupAndConnect ("TS", server);
+        }
+        else
+        {
+                server.connect (*addr);
+        }
+
+        if (!server.connected()) goto error;
+
+        server.send (msgout);
+
+        // before time
+        before = CTime::getLocalTime ();
+
+        // receive the answer
+        GetUniversalTime = false;
+        while (!GetUniversalTime)
+        {
+                if (!server.connected()) goto error;
+                        
+                server.update ();
+
+                nlSleep( 0 );
+        }
+
+        // after, before and delta is not used. It's only for information purpose.
+        after = CTime::getLocalTime ();
+        delta = after - before;
+
+        nlinfo ("_CUniTime::syncUniTimeFromService(): ping:%"NL_I64"dms, time:%ds, unitime:%"NL_I64"dms", delta, GetUniversalTimeSecondsSince1970, GetUniversalTimeUniTime);
+
+// <-- from here to the "-->" comment, the block must be executed in less than one second or an infinite loop occurs
+
+        // get the second
+        firstsecond = CTime::getSecondsSince1970 ();
+        nextsecond = firstsecond+1;
+        
+        // wait the next start of the second (take 100% of CPU to be more accurate)
+        while (nextsecond != CTime::getSecondsSince1970 ())
+                nlassert (CTime::getSecondsSince1970 () <= nextsecond);
+
+// -->
+
+        // get the local time of the beginning of the next second
+        lt = CTime::getLocalTime ();
+
+        if ( ! _Simulate )
+        {
+                if (abs((sint32)((TTime)nextsecond - (TTime)GetUniversalTimeSecondsSince1970)) > 10)
+                {
+                        nlerror ("the time delta (between me and the Time Service) is too big (more than 10s), servers aren't NTP synchronized");
+                        goto error;
+                }
+                
+                // compute the delta between the other side and our side number of second since 1970
+                deltaAdjust = ((TTime) nextsecond - (TTime) GetUniversalTimeSecondsSince1970) * 1000;
+
+                // adjust the unitime to the current localtime
+                GetUniversalTimeUniTime += deltaAdjust;
+
+                nlinfo ("_CUniTime::syncUniTimeFromService(): rtime:%ds, runitime:%"NL_I64"ds, rlocaltime:%"NL_I64"d, deltaAjust:%"NL_I64"dms", nextsecond, GetUniversalTimeUniTime, lt, deltaAdjust);
+        }
+        else
+        {
+                nlinfo ("_CUniTime::syncUniTimeFromService(): runitime:%"NL_I64"ds, rlocaltime:%"NL_I64"d", GetUniversalTimeUniTime, lt);
+        }
+
+        _CUniTime::setUniTime (GetUniversalTimeUniTime, lt);
+
+        server.disconnect ();
+        return;
+
+error:
+        nlerror ("Time Service is not found, lost or can't synchronize universal time");
+*/
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////// SYNCHRONISATION BETWEEN CLIENT AND SHARD ///////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Server part
+
+static void cbServerAskUniversalTime (CMessage& msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        nlstop;
+        TTime ut = _CUniTime::getUniTime ();
+
+        // afficher l adresse de celui qui demande
+        nlinfo("Send the universal time %"NL_I64"d to '%s'", ut, netbase.hostAddress(from).asString().c_str());
+        
+        CMessage msgout (netbase.getSIDA(), "GUT");
+        msgout.serial (ut);
+        netbase.send (msgout, from);
+}
+
+TCallbackItem ServerTimeServiceCallbackArray[] =
+{
+        { "AUT", cbServerAskUniversalTime },
+};
+
+void _CUniTime::installServer (CCallbackServer *server)
+{
+        nlstop;
+        static bool alreadyAddedCallback = false;
+        nlassert (server != NULL);
+        nlassert (!alreadyAddedCallback);
+
+        server->addCallbackArray (ServerTimeServiceCallbackArray, sizeof (ServerTimeServiceCallbackArray) / sizeof (ServerTimeServiceCallbackArray[0]));
+        alreadyAddedCallback = true;
+}
+
+// Client part
+
+static bool GetClientUniversalTime;
+static TTime GetClientUniversalTimeUniTime;
+
+static void cbClientGetUniversalTime (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+{
+        nlstop;
+        // get the association between a date and unitime
+        msgin.serial (GetClientUniversalTimeUniTime);
+        GetClientUniversalTime = true;
+}
+
+static TCallbackItem ClientUniTimeCallbackArray[] =
+{
+        { "GUT", cbClientGetUniversalTime }
+};
+
+
+void _CUniTime::syncUniTimeFromServer (CCallbackClient *client)
+{
+        nlstop;
+/*      static bool alreadyAddedCallback = false;
+        nlassert (client != NULL);
+
+        if (!alreadyAddedCallback)
+        {
+                client->addCallbackArray (ClientUniTimeCallbackArray, sizeof (ClientUniTimeCallbackArray) / sizeof (ClientUniTimeCallbackArray[0]));
+                alreadyAddedCallback = true;
+        }
+
+        sint attempt = 0;
+        TTime bestdelta = 60000;        // 1 minute
+
+        if (!client->connected ()) goto error;
+
+        while (attempt < 10)
+        {
+                CMessage msgout (client->getSIDA(), "AUT");
+
+                if (!client->connected()) goto error;
+
+                // send the message
+                client->send (msgout);
+
+                // before time
+                TTime before = CTime::getLocalTime ();
+
+                // receive the answer
+                GetClientUniversalTime = false;
+                while (!GetClientUniversalTime)
+                {
+                        if (!client->connected()) goto error;
+                                
+                        client->update ();
+                }
+
+                TTime after = CTime::getLocalTime (), delta = after - before;
+
+                if (delta < 10 || delta < bestdelta)
+                {
+                        bestdelta = delta;
+
+                        _CUniTime::setUniTime (GetClientUniversalTimeUniTime, (before+after)/2);
+
+                        if (delta < 10) break;
+                }
+                attempt++;
+        }
+        client->disconnect ();
+        nlinfo ("Universal time is %"NL_I64"dms with a mean error of %"NL_I64"dms", _CUniTime::getUniTime(), bestdelta/2);
+        return;
+error:
+        nlwarning ("there's no connection or lost or can't synchronize universal time");
+*/
+}
+
+
+//
+// Commands
+//
+/*
+NLMISC_COMMAND (time, "displays the universal time", "")
+{
+        if(args.size() != 0) return false;
+
+        if ( _CUniTime::Sync )
+        {
+                log.displayNL ("CTime::getLocalTime(): %"NL_I64"dms, _CUniTime::getUniTime(): %"NL_I64"dms", CTime::getLocalTime (), _CUniTime::getUniTime ());
+                log.displayNL ("_CUniTime::getStringUniTime(): '%s'", _CUniTime::getStringUniTime());
+        }
+        else
+        {
+                log.displayNL ("CTime::getLocalTime(): %"NL_I64"dms <Universal time not sync>", CTime::getLocalTime ());
+        }
+
+        return true;
+}
+*/
+
+} // NLNET
+
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?sortby=date b/cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?sortby=date new file mode 100644 index 00000000..6bdc46b2 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/src/net/unitime.cpp?sortby=date @@ -0,0 +1,461 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / src / net / unitime.cpp
+ + + + + +
unitime.cpp
+

+

Default branch: MAIN
+


+ Revision 1.31 / (download) - annotate - [select for diffs] +, Fri Dec 28 10:17:21 2001 UTC (7 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: georges_v2, +HEAD +
Changes since 1.30: +12 -11 + lines
Diff to previous 1.30 +

+ADDED: support of precompilated header on visual
+
+

+ Revision 1.30 / (download) - annotate - [select for diffs] +, Thu Nov 22 10:40:13 2001 UTC (8 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.29: +2 -2 + lines
Diff to previous 1.29 +

+TRY: change nlSleep(10) into nlSleep(0)
+
+

+ Revision 1.29 / (download) - annotate - [select for diffs] +, Tue Nov 13 12:00:14 2001 UTC (8 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.28: +3 -3 + lines
Diff to previous 1.28 +

+no message
+
+

+ Revision 1.28 / (download) - annotate - [select for diffs] +, Tue Oct 16 09:19:35 2001 UTC (9 months, 1 week ago) by legros +
Branch: MAIN + +
Changes since 1.27: +38 -27 + lines
Diff to previous 1.27 +

+CHANGED: renamed CUniTime into _CUniTime to inactivate unitime functionnality (deprecated)
+
+

+ Revision 1.27 / (download) - annotate - [select for diffs] +, Fri Oct 5 14:52:41 2001 UTC (9 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.26: +25 -1 + lines
Diff to previous 1.26 +

+BUGFIX: there was 2 'time' commands
+
+

+ Revision 1.26 / (download) - annotate - [select for diffs] +, Mon Jun 18 09:09:20 2001 UTC (13 months, 1 week ago) by cado +
Branch: MAIN + +
CVS Tags: nel_0_4, +demo_0_1 +
Changes since 1.25: +25 -13 + lines
Diff to previous 1.25 +

+Added service support for message recorder
+
+

+ Revision 1.25 / (download) - annotate - [select for diffs] +, Wed Jun 13 10:19:19 2001 UTC (13 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.24: +3 -3 + lines
Diff to previous 1.24 +

+#DOCFIX
+
+

+ Revision 1.24 / (download) - annotate - [select for diffs] +, Thu May 31 15:26:53 2001 UTC (13 months, 4 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.23: +4 -3 + lines
Diff to previous 1.23 +

+#MODIFIED: change nlwarning to nlerror, now if the synchro failed, the program ll stop
+
+

+ Revision 1.23 / (download) - annotate - [select for diffs] +, Tue May 29 11:51:34 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.22: +3 -3 + lines
Diff to previous 1.22 +

+BUGFIX: compile on linux
+
+

+ Revision 1.22 / (download) - annotate - [select for diffs] +, Fri May 25 11:52:42 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.21: +2 -2 + lines
Diff to previous 1.21 +

+BUGFIX: forgot a ; after an assert, failed to compile in release mode
+
+

+ Revision 1.21 / (download) - annotate - [select for diffs] +, Fri May 25 08:51:07 2001 UTC (14 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.20: +222 -54 + lines
Diff to previous 1.20 +

+MODIFIED: new time system for services<->time service and client<->shard
+
+

+ Revision 1.20 / (download) - annotate - [select for diffs] +, Wed May 2 12:36:31 2001 UTC (14 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.19: +57 -36 + lines
Diff to previous 1.19 +

+ADD: new version of the network system (in NeL and NeLns)
+
+

+ Revision 1.19 / (download) - annotate - [select for diffs] +, Fri Feb 23 10:58:12 2001 UTC (17 months ago) by lecroart +
Branch: MAIN + +
CVS Tags: net_0_1 +
Changes since 1.18: +2 -3 + lines
Diff to previous 1.18 +

+MODIFY: display only the result of the time synchronisation
+
+

+ Revision 1.18 / (download) - annotate - [select for diffs] +, Mon Jan 29 17:47:55 2001 UTC (17 months, 4 weeks ago) by cado +
Branch: MAIN + +
CVS Tags: proto_0_2, +nel_0_3 +
Changes since 1.17: +2 -2 + lines
Diff to previous 1.17 +

+no message
+
+

+ Revision 1.17 / (download) - annotate - [select for diffs] +, Thu Jan 4 14:37:24 2001 UTC (18 months, 3 weeks ago) by lecroart +
Branch: MAIN + +
CVS Tags: proto_0_1, +nel_0_2 +
Changes since 1.16: +8 -6 + lines
Diff to previous 1.16 +

+bug fix in time conversion
+
+

+ Revision 1.16 / (download) - annotate - [select for diffs] +, Tue Dec 19 14:35:31 2000 UTC (19 months, 1 week ago) by lecroart +
Branch: MAIN + +
Changes since 1.15: +2 -2 + lines
Diff to previous 1.15 +

+set unix compatibility
+
+

+ Revision 1.15 / (download) - annotate - [select for diffs] +, Thu Dec 14 17:43:04 2000 UTC (19 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.14: +2 -2 + lines
Diff to previous 1.14 +

+bugfix
+
+

+ Revision 1.14 / (download) - annotate - [select for diffs] +, Wed Dec 13 14:38:14 2000 UTC (19 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.13: +3 -2 + lines
Diff to previous 1.13 +

+improved network engine
+
+

+ Revision 1.13 / (download) - annotate - [select for diffs] +, Mon Dec 11 11:46:58 2000 UTC (19 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.12: +12 -3 + lines
Diff to previous 1.12 +

+new connection possibility
+
+

+ Revision 1.12 / (download) - annotate - [select for diffs] +, Fri Dec 8 18:11:43 2000 UTC (19 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.11: +2 -2 + lines
Diff to previous 1.11 +

+fixing connexion
+
+

+ Revision 1.11 / (download) - annotate - [select for diffs] +, Fri Dec 8 17:20:27 2000 UTC (19 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.10: +2 -2 + lines
Diff to previous 1.10 +

+Debug info
+
+

+ Revision 1.10 / (download) - annotate - [select for diffs] +, Fri Dec 8 15:17:45 2000 UTC (19 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Changes since 1.9: +3 -3 + lines
Diff to previous 1.9 +

+sync to unitime for all services
+
+

+ Revision 1.9 / (download) - annotate - [select for diffs] +, Tue Nov 28 15:50:33 2000 UTC (19 months, 4 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.8: +1 -2 + lines
Diff to previous 1.8 +

+Doc update
+
+

+ Revision 1.8 / (download) - annotate - [select for diffs] +, Mon Nov 27 13:25:40 2000 UTC (20 months ago) by cado +
Branch: MAIN + +
Changes since 1.7: +3 -5 + lines
Diff to previous 1.7 +

+Added lookupAndConnect()
+
+

+ Revision 1.7 / (download) - annotate - [select for diffs] +, Fri Nov 24 10:43:53 2000 UTC (20 months ago) by coutelas +
Branch: MAIN + +
Changes since 1.6: +2 -2 + lines
Diff to previous 1.6 +

+no message
+
+

+ Revision 1.6 / (download) - annotate - [select for diffs] +, Fri Nov 24 10:13:58 2000 UTC (20 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.5: +35 -1 + lines
Diff to previous 1.5 +

+time to string
+
+

+ Revision 1.5 / (download) - annotate - [select for diffs] +, Wed Nov 22 11:17:35 2000 UTC (20 months ago) by lecroart +
Branch: MAIN + +
Changes since 1.4: +2 -2 + lines
Diff to previous 1.4 +

+add automatic lib loading
+
+

+ Revision 1.4 / (download) - annotate - [select for diffs] +, Tue Nov 21 17:59:01 2000 UTC (20 months ago) by valignat +
Branch: MAIN + +
Changes since 1.3: +1 -4 + lines
Diff to previous 1.3 +

+Remove some unnecessary includes
+
+

+ Revision 1.3 / (download) - annotate - [select for diffs] +, Tue Nov 21 10:57:50 2000 UTC (20 months ago) by cado +
Branch: MAIN + +
Changes since 1.2: +3 -4 + lines
Diff to previous 1.2 +

+Using CUniTime (Time Service)
+
+

+ Revision 1.2 / (download) - annotate - [select for diffs] +, Fri Nov 10 16:58:35 2000 UTC (20 months, 2 weeks ago) by cado +
Branch: MAIN + +
Changes since 1.1: +9 -8 + lines
Diff to previous 1.1 +

+Using CTime
+
+

+ Revision 1.1 / (download) - annotate - [select for diffs] +, Wed Nov 8 15:54:35 2000 UTC (20 months, 2 weeks ago) by lecroart +
Branch: MAIN + +
Diff

+time system (unitime & time)
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1