From: g0dil Date: Fri, 4 Apr 2008 14:34:52 +0000 (+0000) Subject: Scheduler: Remove unneeded Socket dependency X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=6ccff463b40b246fcb8a2e4f1b6c72beb7421921;p=senf.git Scheduler: Remove unneeded Socket dependency Scheduler: Fix documentation (main page) Socket/Protocols: return ClockService::clock_type from timestamp() Add 'Scheduler' library dependency to every user of the 'Socket' library git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@785 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Examples/RateStuffer/SConscript b/Examples/RateStuffer/SConscript index dec0b30..8c36a25 100644 --- a/Examples/RateStuffer/SConscript +++ b/Examples/RateStuffer/SConscript @@ -4,7 +4,7 @@ import SENFSCons ########################################################################### SENFSCons.Binary( env, 'ratestuffer', SENFSCons.GlobSources(), - LIBS = [ 'PPI', 'Scheduler', 'Packets', 'Socket', 'Utils' ] ); + LIBS = [ 'PPI', 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ] ); SENFSCons.Doxygen(env, extra_sources=[ env.Dia2Png('ratestuffer.dia') diff --git a/Examples/TCPClientServer/SConscript b/Examples/TCPClientServer/SConscript index 5cb8fd5..aed8d30 100644 --- a/Examples/TCPClientServer/SConscript +++ b/Examples/TCPClientServer/SConscript @@ -4,7 +4,7 @@ import SENFSCons ########################################################################### SENFSCons.Binary(env, 'client', 'client.cc', - LIBS = [ 'Packets', 'Socket', 'Utils' ]); + LIBS = [ 'Packets', 'Socket', 'Scheduler', 'Utils' ]); SENFSCons.Binary(env, 'server', 'server.cc', - LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ]); + LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ]); diff --git a/Examples/UDPClientServer/SConscript b/Examples/UDPClientServer/SConscript index 5c362d2..8fffdaa 100644 --- a/Examples/UDPClientServer/SConscript +++ b/Examples/UDPClientServer/SConscript @@ -4,9 +4,9 @@ import SENFSCons ########################################################################### SENFSCons.Binary(env, 'udpClient', 'udpClient.cc', - LIBS = [ 'Packets', 'Socket', 'Utils' ]); + LIBS = [ 'Packets', 'Socket', 'Scheduler', 'Utils' ]); SENFSCons.Binary(env, 'udpServer', 'udpServer.cc', - LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ]); + LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ]); SENFSCons.Doxygen(env) diff --git a/Scheduler/Mainpage.dox b/Scheduler/Mainpage.dox index 210335b..e2d5f54 100644 --- a/Scheduler/Mainpage.dox +++ b/Scheduler/Mainpage.dox @@ -24,24 +24,20 @@ namespace senf { /** \mainpage The SENF Scheduler Library - The Scheduler library provides a simple yet flexible abstraction - of the standard asynchronous UNIX mainloop utilizing \c select or - \c poll. The Scheduler library is based on the highly efficient - (but linux specific) \c epoll() system call. + The Scheduler library provides a simple yet flexible abstraction of the standard asynchronous + UNIX mainloop utilizing \c select or \c poll. The Scheduler library is based on the highly + efficient (but linux specific) \c epoll() system call. The library provides - \li a central \ref Scheduler singleton and - \li \ref ReadHelper and \ref WriteHelper templates to simplify - common tasks. + \li the ClockService as a reliable high-resolution highly accurate monotonous time source + \li a central \ref Scheduler %singleton and + \li \ref ReadHelper and \ref WriteHelper templates to simplify common tasks. - In it's current incarnation, the library only supports network - file handles (including pipes etc) and simple timers (especially - it does not support asynchronous notification for on-disc file - transfers etc). Additional features will be added: - \li UNIX signal support - \li async IO support for local (disc) file handles - \li multi threading support - \li IPC support for multithreaded applications + The Scheduler supports several types of scheduling activites: + \li Arbitrary file descriptors (however, local disk file-handles are not guaranteed + non-blocking) + \li Timers + \li UNIX Signals */ } diff --git a/Scheduler/SConscript b/Scheduler/SConscript index ef26f80..3b58ec6 100644 --- a/Scheduler/SConscript +++ b/Scheduler/SConscript @@ -10,5 +10,5 @@ SENFSCons.StandardTargets(env) SENFSCons.Lib(env, library = 'Scheduler', sources = sources, - LIBS = [ 'Socket', 'Utils' ]) + LIBS = [ 'Utils' ]) SENFSCons.Doxygen(env) diff --git a/Socket/Protocols/DVB/SConscript b/Socket/Protocols/DVB/SConscript index ffad345..7bbb5ae 100644 --- a/Socket/Protocols/DVB/SConscript +++ b/Socket/Protocols/DVB/SConscript @@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources() allob = [] allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) ) + SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) for sc in glob.glob("*/SConscript"): ob = SConscript(sc) diff --git a/Socket/Protocols/DatagramSocketProtocol.cc b/Socket/Protocols/DatagramSocketProtocol.cc index a0ac877..d9ec0b4 100644 --- a/Socket/Protocols/DatagramSocketProtocol.cc +++ b/Socket/Protocols/DatagramSocketProtocol.cc @@ -35,13 +35,13 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -prefix_ struct timeval senf::DatagramSocketProtocol::timestamp() +prefix_ senf::ClockService::clock_type senf::DatagramSocketProtocol::timestamp() const { struct timeval tv; if (::ioctl(fd(), SIOCGSTAMP, &tv) < 0) SENF_THROW_SYSTEM_EXCEPTION(""); - return tv; + return ClockService::from_timeval(tv); } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/Socket/Protocols/DatagramSocketProtocol.hh b/Socket/Protocols/DatagramSocketProtocol.hh index 3bffdf1..236d8ca 100644 --- a/Socket/Protocols/DatagramSocketProtocol.hh +++ b/Socket/Protocols/DatagramSocketProtocol.hh @@ -29,6 +29,7 @@ // Custom includes #include #include "../../Socket/SocketProtocol.hh" +#include "../../Scheduler/ClockService.hh" //#include "DatagramSocketProtocol.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -44,11 +45,16 @@ namespace senf { : public virtual SocketProtocol { public: - struct timeval timestamp() const; ///< Return packet timestamp of last packet + ClockService::clock_type timestamp() const; ///< Return packet timestamp of last packet /**< The returned timestamp represents the time, at which the last network packet passed to the user has been received from the network. This allows precise network timing. + + The returned value can be converted to the + senf::ClockService::clock_type representation using + semf::ClockService::from_timeval(). + \pre The \c SO_TIMESTAMP socket option must not be set on the socket. \returns timestamp when last packet was received */ diff --git a/Socket/Protocols/INet/SConscript b/Socket/Protocols/INet/SConscript index a4700dd..733c840 100644 --- a/Socket/Protocols/INet/SConscript +++ b/Socket/Protocols/INet/SConscript @@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources() allob = [] allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) ) + SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) for sc in glob.glob("*/SConscript"): ob = SConscript(sc) diff --git a/Socket/Protocols/Raw/SConscript b/Socket/Protocols/Raw/SConscript index 5e09980..d461a08 100644 --- a/Socket/Protocols/Raw/SConscript +++ b/Socket/Protocols/Raw/SConscript @@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources() allob = [] allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) ) + SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) for sc in glob.glob("*/SConscript"): ob = SConscript(sc) diff --git a/Socket/Protocols/SConscript b/Socket/Protocols/SConscript index 0a99e52..e0e2d49 100644 --- a/Socket/Protocols/SConscript +++ b/Socket/Protocols/SConscript @@ -8,7 +8,7 @@ import SENFSCons, glob SENFSCons.StandardTargets(env) sources = SENFSCons.GlobSources() -objects = SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) +objects = SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) for sc in glob.glob("*/SConscript"): ob = SConscript(sc) diff --git a/Socket/Protocols/UN/SConscript b/Socket/Protocols/UN/SConscript index 6a163c1..b1c332f 100644 --- a/Socket/Protocols/UN/SConscript +++ b/Socket/Protocols/UN/SConscript @@ -13,7 +13,7 @@ sources = SENFSCons.GlobSources() allob = [] allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) ) + SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) for sc in glob.glob("*/SConscript"): ob = SConscript(sc) diff --git a/Socket/SConscript b/Socket/SConscript index 3177782..67b1bdc 100644 --- a/Socket/SConscript +++ b/Socket/SConscript @@ -21,7 +21,7 @@ SENFSCons.Lib(env, library = 'Socket', sources = sources + subob, testSources = testSources, - LIBS = [ 'Utils' ]) + LIBS = [ 'Scheduler', 'Utils' ]) SENFSCons.Doxygen(env, extra_sources = [ env.Dia2Png('SocketLibrary-classes.dia'),