From: g0dil Date: Sat, 1 May 2010 09:28:24 +0000 (+0000) Subject: Whitespce cleanup: Remove whitespace at end-on-line, remove tabs, wrap X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=9cb871b939efe93e35dd96808d25089399acfc46;p=senf.git Whitespce cleanup: Remove whitespace at end-on-line, remove tabs, wrap long lines git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1612 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/.project.el b/.project.el index 55478f9..b691d2a 100644 --- a/.project.el +++ b/.project.el @@ -4,17 +4,17 @@ (save-excursion (back-to-indentation) (if (and (looking-at "namespace") - (looking-at ".*{") - (not (looking-at ".*}"))) - [0] '+))) + (looking-at ".*{") + (not (looking-at ".*}"))) + [0] '+))) (defconst senf-c-style '((c-basic-offset . 4) (c-backslash-column . 98) - (c-cleanup-list . (empty-defun-braces - defun-close-semi - list-close-comma - scope-operator)) + (c-cleanup-list . (empty-defun-braces + defun-close-semi + list-close-comma + scope-operator)) (c-hanging-braces-alist . ((namespace-open after) (namespace-close before after) (brace-list-open) @@ -35,12 +35,12 @@ (c-add-style "senf" senf-c-style) (set (make-local-variable 'ccide-file-vars) - '(( fill-column . 100 ) - ( comment-column . 40 ) - ( c-file-style . "senf" ) - ( indent-tabs-mode . nil ) - ( ispell-local-dictionary . "american" ) - ( compile-command . "scons -u test") )) + '((fill-column . 100) + (comment-column . 40) + (c-file-style . "senf") + (indent-tabs-mode . nil) + (ispell-local-dictionary . "american") + (compile-command . "scons -u test"))) (set (make-local-variable 'ccide-default-copyright) (concat "//\n" @@ -71,12 +71,12 @@ checks for C/C++ preproc directives. Additionally, anything after ^L is ignored (Those are the file local variables and local words)." (let ((f (get-text-property (point) 'face))) (and (memq f flyspell-prog-text-faces) - (not (save-excursion - (beginning-of-line) - (looking-at "\\(//\\)?#"))) - (not (let ((l (max (point-min) (- (point-max) 4096)))) - (and (< l (point)) - (save-excursion (search-backward " " l t)))))))) + (not (save-excursion + (beginning-of-line) + (looking-at "\\(//\\)?#"))) + (not (let ((l (max (point-min) (- (point-max) 4096)))) + (and (< l (point)) + (save-excursion (search-backward " " l t)))))))) (defun flyspell-cc-mode () "Torn on `flyspell-mode` for comments and strings in C/C++ mode." @@ -100,3 +100,8 @@ is ignored (Those are the file local variables and local words)." (insert "#include ")))) (add-hook 'ccide-new-file-hooks 'senf-new-file-hook nil t) + + +// Local Variables: +// indent-tabs-mode: nil +// End: diff --git a/Examples/DVBAdapter/MPEdec.cc b/Examples/DVBAdapter/MPEdec.cc index 22fd948..556c53e 100644 --- a/Examples/DVBAdapter/MPEdec.cc +++ b/Examples/DVBAdapter/MPEdec.cc @@ -59,7 +59,7 @@ public: sec_filter.flags |= DMX_CHECK_CRC; handle.protocol().setSectionFilter( &sec_filter ); - + senf::Scheduler::instance().add( handle, senf::membind(&MySniffer::dumpSection, this)); } diff --git a/Examples/DVBAdapter/ULEdec.cc b/Examples/DVBAdapter/ULEdec.cc index 42444b2..1a36b5e 100644 --- a/Examples/DVBAdapter/ULEdec.cc +++ b/Examples/DVBAdapter/ULEdec.cc @@ -52,10 +52,10 @@ ULEdec::ULEdec(unsigned short adapter, unsigned short device) pes_filter.pes_type = DMX_PES_OTHER; pes_filter.flags = DMX_IMMEDIATE_START; demuxHandle.protocol().setPESFilter( &pes_filter ); - + senf::Scheduler::instance().add( dvrHandle, senf::membind(&ULEdec::handleEvent, this)); - + this->receiver_state = Idle; this->priv_sndu_type_1 = false; } @@ -65,7 +65,7 @@ void ULEdec::handleEvent(senf::Scheduler::EventId event) senf::TransportPacket ts_packet ( senf::TransportPacket::create(188, senf::noinit)); dvrHandle.read( ts_packet.data() ); - + // Check TS error conditions: sync_byte, transport_error_indicator, scrambling_control. if ( (ts_packet->sync_byte() != senf::TransportPacketType::SYNC_BYTE) || (ts_packet->transport_error_indicator() == true) || @@ -75,7 +75,7 @@ void ULEdec::handleEvent(senf::Scheduler::EventId event) // drop partly decoded SNDU, reset state, resync on PUSI. return; } - + handleTSPacket(ts_packet); } diff --git a/Examples/DVBAdapter/ULEdec.hh b/Examples/DVBAdapter/ULEdec.hh index 60f757b..87bf9f3 100644 --- a/Examples/DVBAdapter/ULEdec.hh +++ b/Examples/DVBAdapter/ULEdec.hh @@ -35,17 +35,17 @@ public: private: typedef senf::PacketData::iterator iterator; - + enum ReceiverState { Idle, Reassembly }; - + senf::DVBDemuxPESHandle demuxHandle; senf::DVBDvrHandle dvrHandle; - + senf::SNDUPacket snduPacket; - + ReceiverState receiver_state; unsigned char priv_tscc; bool priv_sndu_type_1; @@ -54,20 +54,20 @@ private: void handleEvent(senf::Scheduler::EventId event); void handleTSPacket(senf::TransportPacket tsPacket); void handleSNDUPacket(); - + iterator readNewSNDUPacket(iterator i, const iterator i_end); iterator readContSNDUPacket(iterator i, const iterator i_end); iterator readRawSNDUPacketData(iterator i, iterator const i_end); - - inline bool isSDNUPacketComplete(); + + inline bool isSDNUPacketComplete(); inline iterator::difference_type snduPacketBytesLeft(); - + }; struct ULEdecException : public senf::Exception { - ULEdecException(std::string const & what) + ULEdecException(std::string const & what) : senf::Exception(what) {} }; diff --git a/Examples/MCSniffer/MCSniffer.cc b/Examples/MCSniffer/MCSniffer.cc index b82dc2a..02fab93 100644 --- a/Examples/MCSniffer/MCSniffer.cc +++ b/Examples/MCSniffer/MCSniffer.cc @@ -72,16 +72,16 @@ private: int main(int argc, char const * argv[]) -{ +{ try { std::ofstream f1 ("233.132.152.1.txt"); std::ofstream f2 ("233.132.152.2.txt"); - + MCSniffer sniffer1 ( senf::INet4Address::from_string("233.132.152.1"), f1); MCSniffer sniffer2 ( senf::INet4Address::from_string("233.132.152.2"), f2); - + senf::scheduler::process(); } catch (std::exception const & ex) { @@ -90,7 +90,7 @@ int main(int argc, char const * argv[]) return 0; } - + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "MCSniffer.mpp" diff --git a/Examples/MultiMCLoop/MultiMCLoop.cc b/Examples/MultiMCLoop/MultiMCLoop.cc index cba9bb9..08521b7 100644 --- a/Examples/MultiMCLoop/MultiMCLoop.cc +++ b/Examples/MultiMCLoop/MultiMCLoop.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -52,10 +52,10 @@ public: MCReader(unsigned n, std::string const & name, UDPSocket::Address const & group); }; -prefix_ MCReader::MCReader(unsigned n, std::string const & name_, +prefix_ MCReader::MCReader(unsigned n, std::string const & name_, UDPSocket::Address const & group) : name (name_), socket (), - event (name, senf::membind(&MCReader::handler, this), socket, + event (name, senf::membind(&MCReader::handler, this), socket, senf::scheduler::FdEvent::EV_READ) { socket.protocol().reuseaddr(true); @@ -81,9 +81,9 @@ class MCWriter unsigned count; void handler(); - + public: - MCWriter(std::string const & name, UDPSocket::Address const & group, + MCWriter(std::string const & name, UDPSocket::Address const & group, senf::ClockService::clock_type interval); }; @@ -117,7 +117,7 @@ public: struct SystemException : public senf::Exception { SystemException() : senf::Exception("IfSetup::SystemException") {} }; - + }; prefix_ IfSetup::IfSetup(std::string const & iface_) @@ -159,7 +159,7 @@ int main(int argc, char * argv[]) try { boost::scoped_ptr setup ( (argc != 2 || std::string(argv[1]) != "-n") ? new IfSetup("dummy0") : 0); - + senf::scheduler::SignalEvent sigint (SIGINT, &sigintHandler); UDPSocket::Address g1 ("225.1:43434"); diff --git a/Examples/RateStuffer/Mainpage.dox b/Examples/RateStuffer/Mainpage.dox index fb70e0f..cf8b437 100644 --- a/Examples/RateStuffer/Mainpage.dox +++ b/Examples/RateStuffer/Mainpage.dox @@ -27,7 +27,7 @@ using namespace senf::ppi::module; This example application implements a simple PPI application: It will read UDP packets from an input port and will forward them to another port at a fixed packet rate. If the input stream does not provide enough packets, empty UDP packets will be sent instead. - + \section run Running the example Running the example is a little bit more complicated since we need to provide example UDP @@ -38,7 +38,7 @@ using namespace senf::ppi::module;
     # nc -u -l -p 44345
     
- + The next command starts the \c ratestuffer
     # cd .../Examples/RateStuffer
@@ -137,8 +137,8 @@ using namespace senf::ppi::module;
 
     \skip class
     \until rateFilter
-    
-    First the needed modules are declared. We have 
+
+    First the needed modules are declared. We have
     - the \a barrier to discard incoming packets sent to fast
     - the \a queue to receive incoming packets and create throttling notifications
     - the \a generator to create the stuffing packets
@@ -154,7 +154,7 @@ using namespace senf::ppi::module;
 
     The constructor now initializes all the local objects. We pass the template \a packet to the \a
     generator and set the timing \a interval of the \a rateFilter.
-    
+
     The \a input and \a output connector references are bound to the corresponding connectors we
     want to expose: \a input to the \a barrier's \a input and \a output to the \a rateFilter's \a
     output.
@@ -187,7 +187,7 @@ using namespace senf::ppi::module;
     \until udpSink
 
     The \ref senf::ppi::connect() calls setup the necessary connections.
-    
+
     The module setup is complete, \ref senf::ppi::run() is called to enter the event loop.
 
     \until }
diff --git a/Examples/RateStuffer/ratestuffer.cc b/Examples/RateStuffer/ratestuffer.cc
index b1d8694..6f6a634 100644
--- a/Examples/RateStuffer/ratestuffer.cc
+++ b/Examples/RateStuffer/ratestuffer.cc
@@ -59,7 +59,7 @@ private:
 };
 
 RateFilter::RateFilter(senf::ClockService::clock_type interval)
-    : timer(interval) 
+    : timer(interval)
 {
     route(input,timer);
     route(timer,output);
@@ -85,7 +85,7 @@ public:
     connector::PassiveInput<> & input;
     connector::ActiveOutput<> & output;
 
-    RateStuffer(senf::ClockService::clock_type interval, 
+    RateStuffer(senf::ClockService::clock_type interval,
                 senf::Packet packet,
                 unsigned high = 1,
                 unsigned low  = 0)
@@ -105,7 +105,7 @@ public:
         queue.qdisc(ppi::ThresholdQueueing(high,low));
     }
 };
-        
+
 // ////////////////////////////////////////////////////////////////////////
 // ////////////////////////////////////////////////////////////////////////
 
@@ -132,7 +132,7 @@ int main(int argc, char * argv[])
         senf::INet4SocketAddress("localhost:44345"));
 
     module::ActiveSocketSource<>  udpSource ( inputSocket );
-    RateStuffer                   stuffer   ( 1000000000ul, 
+    RateStuffer                   stuffer   ( 1000000000ul,
                                               senf::DataPacket::create(std::string("\n")),
                                               2u, 1u );
     module::PassiveSocketSink<>   udpSink   ( outputSocket );
diff --git a/Examples/Sniffer/Mainpage.dox b/Examples/Sniffer/Mainpage.dox
index 5d59420..bc69f29 100644
--- a/Examples/Sniffer/Mainpage.dox
+++ b/Examples/Sniffer/Mainpage.dox
@@ -46,8 +46,8 @@
     \until #include 
 
     The example includes two implementations, one using blocking calls and a while loop, the other
-    using the senf::Scheduler for asynchronous event notification. They are implemented in 
-    \c loop_main() and \c scheduler_main(). They will be documented below. For now, we skip these 
+    using the senf::Scheduler for asynchronous event notification. They are implemented in
+    \c loop_main() and \c scheduler_main(). They will be documented below. For now, we skip these
     implementations and go straight to the \c main() function
 
     \skip int main(
@@ -73,7 +73,7 @@
     backtrace of the exception origin in the debugger.
 
     We now create a packet socket and bind it to the interface given as second command line argument.
-    A packet socket is a linux specific type of socket which returns ethernet packets directly from 
+    A packet socket is a linux specific type of socket which returns ethernet packets directly from
     the network wire. By uncommenting the last line, you may switch the interface into promiscuous mode.
 
     \until //
@@ -88,7 +88,7 @@
     \until sock.read
 
     \doc the following section is obsolete!
-    
+
     Lets digest this line step by step: We declare a variable named \c packet as a smart pointer to
     an \c EthernetPacket instance. \c ptr is a typedef member of all Packet classes for the
     corresponding smart pointer type. We then initialize this pointer with a call to the static \c
diff --git a/Examples/UDPClientServer/Mainpage.dox b/Examples/UDPClientServer/Mainpage.dox
index 5d83982..49043d8 100644
--- a/Examples/UDPClientServer/Mainpage.dox
+++ b/Examples/UDPClientServer/Mainpage.dox
@@ -73,8 +73,8 @@
     \until }
 
     Calling the Schedulers  \link senf::Scheduler::process process()\endlink  method will
-    start the event loop. This call does not return (ok, it does return in special cases if 
-    \c senf::Scheduler::terminate() is called which does not apply here). The Callback Function is 
+    start the event loop. This call does not return (ok, it does return in special cases if
+    \c senf::Scheduler::terminate() is called which does not apply here). The Callback Function is
     the \c readFromClient() Function, which is declared as private here and will be called whenever
     an event on the socket is encountered. The scheduler passes the event ID to the function.
 
diff --git a/Examples/psi2tsModule/psi2ts.cc b/Examples/psi2tsModule/psi2ts.cc
index 6878c38..55366cf 100644
--- a/Examples/psi2tsModule/psi2ts.cc
+++ b/Examples/psi2tsModule/psi2ts.cc
@@ -77,9 +77,9 @@ prefix_ void Psi2TsModule::onRequest()
                 0xff
         );
         tsPacket.finalize();
-        
+
         output.write( tsPacket);
-        
+
         advance_max( begin, 184, sec_end);
         advance_max( end,   184, sec_end);
     } while (begin != end);
diff --git a/Examples/psi2tsModule/psi2ts.hh b/Examples/psi2tsModule/psi2ts.hh
index 141bfda..a93edb1 100644
--- a/Examples/psi2tsModule/psi2ts.hh
+++ b/Examples/psi2tsModule/psi2ts.hh
@@ -41,12 +41,12 @@ class Psi2TsModule
 {
     SENF_PPI_MODULE(Psi2TsModule);
 
-public: 
+public:
     senf::ppi::connector::PassiveInput<> input;
     senf::ppi::connector::ActiveOutput output;
     Psi2TsModule(unsigned pid, senf::ClockService::clock_type timout=0);
     void onRequest();
-    
+
 private:
     enum state {IDLE, PROC, WAIT};
     typedef senf::PacketData::iterator iterator;
diff --git a/Examples/psi2tsModule/psi2ts.test.cc b/Examples/psi2tsModule/psi2ts.test.cc
index 434cf5f..69daf0a 100644
--- a/Examples/psi2tsModule/psi2ts.test.cc
+++ b/Examples/psi2tsModule/psi2ts.test.cc
@@ -48,7 +48,7 @@ void check_transportpacket_header(senf::TransportPacket tsPacket, bool pusi, uns
     BOOST_CHECK_EQUAL( tsPacket->continuity_counter(),        counter                                );
     if (pusi)
         BOOST_CHECK_EQUAL( tsPacket->pointer_field(),         0x0u                                   );
-        
+
 }
 
 template
@@ -56,7 +56,7 @@ bool equal_elements(InputIterator first, InputIterator last, const T& value)
 {
     return std::find_if( first, last, boost::lambda::_1 != value) == last;
 }
-        
+
 
 SENF_AUTO_UNIT_TEST(one_section_to_one_transportpacket)
 {
@@ -64,28 +64,28 @@ SENF_AUTO_UNIT_TEST(one_section_to_one_transportpacket)
     senf::ppi::module::debug::PassiveSink sink;
     unsigned PID = 42;
     Psi2TsModule psi2ts (PID);
-    
+
     senf::ppi::connect( source, psi2ts);
     senf::ppi::connect( psi2ts, sink);
     senf::ppi::init();
-    
+
     std::string sec_data ( "psi2ts_test: one_section_to_one_transportpacket");
     senf::Packet sec_packet (senf::DataPacket::create(sec_data));
     sec_packet.finalize();
-    
+
     source.submit(sec_packet);
     BOOST_CHECK_EQUAL( sink.size(), 1u);
 
     senf::TransportPacket ts_packet = sink.pop_front().as();
     check_transportpacket_header( ts_packet, true, PID, 1);
     senf::PacketData & ts_payload_data = ts_packet.next().data();
-    BOOST_CHECK_EQUAL_COLLECTIONS( 
-            ts_payload_data.begin(), 
+    BOOST_CHECK_EQUAL_COLLECTIONS(
+            ts_payload_data.begin(),
             boost::next( ts_payload_data.begin(), sec_data.size()),
             sec_data.begin(),
             sec_data.end());
     BOOST_CHECK( equal_elements(
-            boost::next( ts_payload_data.begin(), ts_payload_data.size()), 
+            boost::next( ts_payload_data.begin(), ts_payload_data.size()),
             ts_payload_data.end(),
             0xffu));
 }
@@ -96,17 +96,17 @@ SENF_AUTO_UNIT_TEST(one_section_to_two_transportpackets)
     senf::ppi::module::debug::PassiveSink sink;
     unsigned PID = 42;
     Psi2TsModule psi2ts (PID);
-    
+
     senf::ppi::connect( source, psi2ts);
     senf::ppi::connect( psi2ts, sink);
     senf::ppi::init();
-    
+
     std::string sec_data ( 183, 0x42);
     std::string sec_data2 ( "psi2ts_test: one_section_to_two_transportpackets");
     sec_data.append( sec_data2);
     senf::Packet sec_packet (senf::DataPacket::create(sec_data));
     sec_packet.finalize();
-    
+
     source.submit( sec_packet);
     BOOST_CHECK_EQUAL( sink.size(), 2u);
 
@@ -115,17 +115,17 @@ SENF_AUTO_UNIT_TEST(one_section_to_two_transportpackets)
     senf::PacketData & ts_payload_data1 = ts_packet.next().data();
 
     BOOST_CHECK( equal_elements( ts_payload_data1.begin(), ts_payload_data1.end(), 0x42));
-    
+
     ts_packet = sink.pop_front().as();
     check_transportpacket_header( ts_packet, false, PID, 2);
     senf::PacketData & ts_payload_data2 = ts_packet.next().data();
-    BOOST_CHECK_EQUAL_COLLECTIONS( 
-            ts_payload_data2.begin(), 
+    BOOST_CHECK_EQUAL_COLLECTIONS(
+            ts_payload_data2.begin(),
             boost::next( ts_payload_data2.begin(), sec_data2.size()),
             sec_data2.begin(),
             sec_data2.end());
     BOOST_CHECK( equal_elements(
-            boost::next( ts_payload_data2.begin(), sec_data2.size()), 
+            boost::next( ts_payload_data2.begin(), sec_data2.size()),
             ts_payload_data2.end(),
             0xffu));
 }
@@ -136,15 +136,15 @@ SENF_AUTO_UNIT_TEST(many_sections_to_many_transportpackets)
     senf::ppi::module::debug::PassiveSink sink;
     unsigned PID = 42;
     Psi2TsModule psi2ts (PID);
-    
+
     senf::ppi::connect( source, psi2ts);
     senf::ppi::connect( psi2ts, sink);
     senf::ppi::init();
-    
+
     std::string sec_data ( "many_sections_to_many_transportpackets");
     senf::Packet sec_packet (senf::DataPacket::create(sec_data));
     sec_packet.finalize();
-    
+
     unsigned NUMBER_OF_SECTIONS = 42u;
     for (unsigned i=1; i<=NUMBER_OF_SECTIONS; i++) {
         source.submit( sec_packet);
@@ -153,7 +153,7 @@ SENF_AUTO_UNIT_TEST(many_sections_to_many_transportpackets)
 
     for (unsigned i=1; i<=NUMBER_OF_SECTIONS; i++) {
         senf::TransportPacket ts_packet = sink.pop_front().as();
-        check_transportpacket_header( ts_packet, true, PID, i%16);    
+        check_transportpacket_header( ts_packet, true, PID, i%16);
     }
 }
 
diff --git a/HowTos/NewPacket/Mainpage.dox b/HowTos/NewPacket/Mainpage.dox
index 0547543..4da44fe 100644
--- a/HowTos/NewPacket/Mainpage.dox
+++ b/HowTos/NewPacket/Mainpage.dox
@@ -20,10 +20,10 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-/** \mainpage Defining and using a new 'libPacket' Packet Type 
+/** \mainpage Defining and using a new 'libPacket' Packet Type
 
     This howto will introduce the facilities needed to define a new packet type. As example, the
-    \c GREPacket type is defined. 
+    \c GREPacket type is defined.
 
     \autotoc
 
@@ -50,7 +50,7 @@
     \li It implements packet invariants
 
     To define a new packet type, we need to implement two classes which together provide all this
-    information: 
+    information:
 
     \li a \e parser (a class derived from senf::PacketParserBase). This class defines the data
         fields of the packet header and may also provide additional packet specific functionality.
@@ -151,11 +151,11 @@
     SENF_PARSER_BITFIELD  ( version,         3, unsigned );
     SENF_PARSER_BITFIELD  ( protocolType,   16, unsigned );
     \endcode
-    
+
     This is a correct \c GREPacket header definition, but there is room for a small optimization:
     Since the \a protocolType field is exactly 2 bytes wide and is aligned on a byte boundary, we
     can define it as a UInt16 field (instead of a bitfield):
-    
+
     \code
     SENF_PARSER_BITFIELD  ( checksumPresent,  1, bool     );
     SENF_PARSER_SKIP_BITS (                  12           );
@@ -189,13 +189,13 @@
     suitable for a single optional field as well as for an optional contiguous sequence of fields.
 
     In our GRE example, there are two fields which need to be enabled/disabled en bloc. We first
-    define an auxiliary sub-parser which combines the two fields.    
+    define an auxiliary sub-parser which combines the two fields.
 
     \code
     struct GREPacketParser_OptFields : public senf::PacketParserBase
     {
     #   include SENF_FIXED_PARSER()
-        
+
         // typedef checksum_t uint16_t; XXX defined automatically???
 
         SENF_PARSER_FIELD ( checksum, senf::UInt16Parser );
@@ -239,7 +239,7 @@
     p.protocolType()                       = 0x86dd;
     p.optionalFields().get<1>().checksum() = 12345u;
     \endcode
-    
+
     This code has two problems:
     \li accessing the checksum field is quite unwieldy
     \li changing the checksumPresent() value will break the parser
@@ -248,7 +248,7 @@
     the selector (here \a checksumPresent) is changed, since the variant parser must ensure that the
     header data stays consistent. Whenever the checksumPresent field is enabled, the variant parser
     needs to insert additional 4 bytes of data. And it must remove those bytes whenever the
-    checksumPresent field is disabled. 
+    checksumPresent field is disabled.
 
     \subsection howto_newpacket_parser_fixvariant Fixing access by providing custom accessor members
 
@@ -270,7 +270,7 @@
     sub-parsers.
 
     In this case however, we still want to allow the user to change the field value, albeit not
-    directly. We will need to go through the collection parser, in this case the variant. 
+    directly. We will need to go through the collection parser, in this case the variant.
 
     The syntax for accessing a variant is quite cumbersome. Therefore we adjust the variant
     definition to generate a more usable interface:
@@ -302,7 +302,7 @@
     only access \a checksum() if the \a checksumPresent() field is set. Otherwise, the behavior is
     undefined (in debug builds, the parser will terminate the application with an assert).
 
-    
+
     \subsection howto_newpacket_parser_add Providing additional functionality
 
     We have now implemented parsing all the header fields. However, often packets would benefit from
@@ -313,9 +313,9 @@
     \code
     #include 
 
-    checksum_t::checksum_t::value_type calculateChecksum() const 
+    checksum_t::checksum_t::value_type calculateChecksum() const
     {
-        if (!checksumEnabled()) 
+        if (!checksumEnabled())
             return 0;
 
         senf::IpChecksum cs;
@@ -330,7 +330,7 @@
 
     This code just implements what is defined in the RFC: The checksum covers the complete GRE
     packet including it's header with the checksum field temporarily set to 0. Instead of really
-    changing the checksum field we manually pass the correct data to \a cs. 
+    changing the checksum field we manually pass the correct data to \a cs.
 
     We use the special i(offset) helper to get iterators \a offset number
     of bytes into the data. This helper has the additional benefit of range-checking the returned
@@ -351,7 +351,7 @@
 
     \code
     #include 
-    
+
     struct GREPacketParser_OptFields : public senf::PacketParserBase
     {
     #   include SENF_FIXED_PARSER()
@@ -384,10 +384,10 @@
     // In the implementation (.cc) file:
 
     #include 
-    
+
     GREPacketParser::checksum_t::value_type GREPacketParser::calculateChecksum() const
     {
-        if (!checksumEnabled()) 
+        if (!checksumEnabled())
             return 0;
 
         validate(6);
@@ -426,7 +426,7 @@
         typedef senf::PacketTypeMixin mixin;
         typedef senf::ConcretePacket packet;
         typedef senf::GREPacketParser parser;
-    
+
         using mixin::nextPacketRange;
         using mixin::nextPacketType;
         using mixin::init;
@@ -449,7 +449,7 @@
 
     The next block of statements imports all the default implementations provided by the mixin
     class:
-    
+
     \li \a nextPacketRange provides information about where the next packet lives within the GRE
         packet.
     \li \a nextPacketType provides the type of the next packet from information in the GRE packet.
@@ -457,7 +457,7 @@
         GREPacketParser::init.
     \li \a initSize is called to find the size of an empty (newly create) GRE packet. This is also
         provided by GREPacketParser.
-    
+
     With these default implementations provided by the mixin, only a few additional members are
     needed to complete the \c GREPacketType: \a nextPacketKey, \a finalize, and \a dump.
 
@@ -526,7 +526,7 @@
     \endcode
 
     But wait -- what is \c GREPacket ? This question is answered a few section further down.
-    
+
     The last thing we need to do is, we need to set the \a protocolType() field to the correct value
     when packets are newly created or changed. This is done within \a finalize:
 
@@ -546,7 +546,7 @@
     have to be updated to be correct. This is the responsibility of the \a finalize() member.
 
     \code
-    static void finalize(packet p) 
+    static void finalize(packet p)
     {
         p->protocolType() << key(p.next(senf::nothrow));
         if (p->checksumPresent())
@@ -570,7 +570,7 @@
     For diagnostic purposes, every packet should provide a meaningful \a dump() member which writes
     out the complete packet. This member is simple to implement and is often very helpful when
     tracking down problems.
-    
+
     \code
     #include 
 
@@ -584,14 +584,14 @@
                                                      << p->protocolType() << "\n";
         if (p->checksumPresent())
             os << "  checksum                     : 0x" << std::hex << std::setw(4)
-                                                        << std::setfill('0') << p->checksum() << "\n"; 
+                                                        << std::setfill('0') << p->checksum() << "\n";
     }
     \endcode
-    
+
     This member is quite straight forward. We should try to adhere to the formating standard shown
     above: The first line should be the type of packet/header being dumped followed by one line for
     each protocol field. The colon's should be aligned at column 33 with the field name indented by
-    2 spaces. 
+    2 spaces.
 
     The \c boost::ios_all_saver is just used to ensure, that the stream formatting state is restored
     correctly at the end of the method. An instance of this type will save the stream state when
@@ -613,24 +613,24 @@
         typedef senf::PacketTypeMixin mixin;
         typedef senf::ConcretePacket packet;
         typedef senf::GREPacketParser parser;
-    
+
         using mixin::nextPacketRange;
         using mixin::nextPacketType;
         using mixin::init;
         using mixin::initSize;
 
         static key_t nextPacketKey(packet p) { return p->protocolType(); }
-    
+
         static void finalize(packet p) {
-            p->protocolType() << key(p.next(senf::nothrow)); 
+            p->protocolType() << key(p.next(senf::nothrow));
             if (p->checksumPresent()) p->checksum() << p->calculateChecksum();
        }
-    
+
         static void dump(packet p, std::ostream & os);
     };
 
     typedef GREPacketType::packet GREPacket;
-    
+
     // In the implementation (.cc) file:
 
     #include 
@@ -649,7 +649,7 @@
                                                      << p->protocolType() << "\n";
         if (p->checksumPresent())
             os << "  checksum                     : 0x" << std::hex << std::setw(4)
-                                                        << std::setfill('0') << p->checksum() << "\n"; 
+                                                        << std::setfill('0') << p->checksum() << "\n";
     }
     \endcode
 
@@ -666,7 +666,7 @@
     needs to obey to be considered valid. If the packet is not valid it cannot be parsed and should
     be dropped. We can't drop it here but if the packet is invalid, we certainly must refrain from
     trying to parser any payload since we cannot assume the packet to have the format we assume our
-    GRE packet to have. 
+    GRE packet to have.
 
     There are two conditions defined in the RFC which render a GRE packet invalid: If one of the \a
     reserved0() fields first 5 bits is set or if the version is not 0. We will add a \a valid()
@@ -716,7 +716,7 @@
 
     factory_t nextPacketType(packet p) { return p->valid() ? lookup(p->protocolType()) : no_factory(); }
     \endcode
-    
+
     As we see, this is still quite simple. \c factory_t is provided by senf::PacketTypeBase. For our
     purpose it is an opaque type which somehow enables the packet library to create a new packet of
     a specified packet type. The \c factory_t has a special value, \c no_factory() which stands for
@@ -733,7 +733,7 @@
     senf::EtherTypes registry ? Here one way to do this:
 
     \code
-    factory_t nextPacketType(packet p) { 
+    factory_t nextPacketType(packet p) {
         if (p->valid()) {
             if (p->protocolType() == 0x6558)  return senf::EthernetPacket::factory();
             else                              return lookup(p->protocolType());
@@ -775,7 +775,7 @@
     #define HH_GREPacket_
 
     #include 
-    
+
     struct GREPacketParser_OptFields : public senf::PacketParserBase
     {
     #   include SENF_FIXED_PARSER()
@@ -815,24 +815,24 @@
         typedef senf::PacketTypeMixin mixin;
         typedef senf::ConcretePacket packet;
         typedef senf::GREPacketParser parser;
-    
+
         using mixin::nextPacketRange;
         using mixin::init;
         using mixin::initSize;
 
-        factory_t nextPacketType(packet p) 
+        factory_t nextPacketType(packet p)
             { return p->valid() ? lookup(p->protocolType()) : no_factory(); }
-    
+
         static void finalize(packet p) {
             p->protocolType() << key(p.next(senf::nothrow));
             if (p->checksumPresent()) p->checksum() << p->calculateChecksum();
         }
-    
+
         static void dump(packet p, std::ostream & os);
     };
 
     typedef GREPacketType::packet GREPacket;
-    
+
     #endif
     \endcode
 
@@ -849,7 +849,7 @@
 
     GREPacketParser::checksum_t::checksum_t::value_type GREPacketParser::calculateChecksum() const
     {
-        if (!checksumEnabled()) 
+        if (!checksumEnabled())
             return 0;
 
         validate(6);
@@ -872,7 +872,7 @@
                                                      << p->protocolType() << "\n";
         if (p->checksumPresent())
             os << "  checksum                     : 0x" << std::hex << std::setw(4)
-                                                        << std::setfill('0') << p->checksum() << "\n"; 
+                                                        << std::setfill('0') << p->checksum() << "\n";
     }
     \endcode
 
@@ -934,7 +934,7 @@
 
         senf::TapSocketHandle tap ("tap0");
         senf::ConnectedRawV6ClientSocketHandle osock (47u, senf::INet6SocketAddress(argv[1]));
-    
+
         while (true) {
             senf::EthernetPacket eth (senf::EthernetPacket::create(senf::noinit));
             isock.read(eth.data(),0u);
@@ -945,7 +945,7 @@
     }
     \endcode
 
-    
+
     \section howto_newpacket_further Further reading
 
     Lets start with references to the important API's (Use the List of all members link to
@@ -966,7 +966,7 @@
     When implementing new packet's, the following information will be helpful:
 
     
-    
+
     
@@ -975,10 +975,10 @@
     use it.
-    
+
     
-    
+
     
senf::PacketTypeBase here you find a description of the members which need to be implemented to provide a 'packet type'. Most of these members will normally be provided by the mixin helper.
\ref packetparser This section describes the packet parser facility.
\link packetparsermacros Packet parser macros\endlink A complete list and documentation of all the packet parser macros.
\ref parseint, \n \ref parsecollection There are several lists of available reusable packet parsers. However, these lists are not complete as there are other protocol specific reusable parsers (without claiming to be exhaustive: senf::INet4AddressParser, diff --git a/doclib/Mainpage.dox b/doclib/Mainpage.dox index 7a73b31..12fe04c 100644 --- a/doclib/Mainpage.dox +++ b/doclib/Mainpage.dox @@ -50,7 +50,7 @@ \section senfutil_overview Building Projects using SENF - When building projects using %senf, SENFSCons has a very simple helper module + When building projects using %senf, SENFSCons has a very simple helper module \ref senf_senfutil "senfutil.py" to make the building of libraries utilizing %senf simpler. \see \ref senf_senfutil @@ -88,7 +88,7 @@ CXXFLAGS_final = [ '-O2' ], CXXFLAGS_normal = [ '-O0', '-g' ], CXXFLAGS_debug = [ '$CXXFLAGS_normal' ], - + LINKFLAGS_normal = [ '-Wl,-S' ], LOGLEVELS_debug = [ 'senf::log::Debug||VERBOSE' ], @@ -103,7 +103,7 @@ # Build objects from sources objects = env.Object(sources) - + # Build main binary env.Default( env.Program( target='example', source=objects + ['main.cc'] ) ) @@ -146,7 +146,7 @@ where \e optional_stream and \e optional_area are optional fully scoped C++ names (e.g. \c senf::log::Debug) and \e level is the loglevel. There must be \e no whitespace in a single specification, multiple specifications are either specified using an array or separated with - whitespace. + whitespace. \section senf_senfutil_default Default options @@ -203,11 +203,11 @@ # Build main target, e.g. a Binary with additional sources which are not part of the unit test env.Program('example', objects+extra_sources) - + # Build unit tests including additional test sources env.BoostUnitTest('test', objects+tests) \endcode - + It is important to exclude the \c main function from the unit-test build since the boost unit test library provides it's own. @@ -227,9 +227,9 @@ The \c senfutil.Doxygen utility autogenerates a \c Doxyfile. - The utility will search for a SENF documentation in the \c senfdoc and \c %senf subdirectories + The utility will search for a SENF documentation in the \c senfdoc and \c %senf subdirectories as well as via the senfutil module directory and some other standard locations. If SENF - documentation is found, the SENF tagfiles will automatically be added. Links will be resolved + documentation is found, the SENF tagfiles will automatically be added. Links will be resolved to the documentation found. \c senfutil.Doxygen takes some additional optional keyword arguments: @@ -333,7 +333,7 @@ in the \c %senf directory. This assumes, that you want to build the library with your default - gcc and requires the boost libraries to be available in the system include paths. If this is + gcc and requires the boost libraries to be available in the system include paths. If this is not the case, you can take a look at SConfig.template file. Copy this file to SConfig and comment out all the variables you don't want to change (The \e values in the template file are just arbitrary examples). @@ -488,7 +488,7 @@ \ref senf_setup \section senf_conventions Coding Conventions - + Here we have laid down the coding conventions used throughout the SENF framework. Please ad here to these conventions when changing or adding code. If you use emacs, you can use the C++ IDE for emacs from http://g0dil.de which greatly simplifies following these conventions. @@ -501,7 +501,7 @@ \par Rationale: This simplifies finding the implementation/header for a given class and also reduces the size of each single file. - + The implementation is divided into a number of different files: @@ -521,7 +521,7 @@ - + - + @@ -162,7 +162,7 @@ namespace senf { \par Finalize action: \copydetails finalize() - + \ingroup protocolbundle_default */ struct IPv4PacketType @@ -180,18 +180,18 @@ namespace senf { using mixin::initSize; using mixin::init; - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->protocol(); } - + /** \brief Dump given IPv4Packet in readable form to given output stream */ - static void dump(packet p, std::ostream & os); - + static void dump(packet p, std::ostream & os); + static void finalize(packet p); ///< Finalize packet. - /**< \li set \ref IPv4PacketParser::length() "length" + /**< \li set \ref IPv4PacketParser::length() "length" from payload size - \li set \ref IPv4PacketParser::protocol() "protocol" + \li set \ref IPv4PacketParser::protocol() "protocol" from type of next packet if found in \ref IpTypes - \li calculate and set + \li calculate and set \ref IPv4PacketParser::checksum() "checksum" */ }; diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptions.hh b/senf/Packets/DefaultBundle/IPv6ExtOptions.hh index 8fb5fdd..0ed194e 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptions.hh +++ b/senf/Packets/DefaultBundle/IPv6ExtOptions.hh @@ -56,7 +56,7 @@ namespace senf { SENF_PARSER_BITFIELD ( optionType, 5, unsigned ); SENF_PARSER_FIELD ( length, UInt8Parser ); SENF_PARSER_FINALIZE ( IPv6OptionParser ); - + typedef GenericTLVParserRegistry Registry; }; diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.hh b/senf/Packets/DefaultBundle/IPv6Extensions.hh index bf41e88..913d09a 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.hh +++ b/senf/Packets/DefaultBundle/IPv6Extensions.hh @@ -38,7 +38,7 @@ namespace senf { /** \brief Parse in IPv6 fragment extension header - + Parser implementing the IPv6 fragment extension. The fields implemented are: \image html IPv6FragmentPacket.png @@ -66,10 +66,10 @@ namespace senf { \par Fields: \ref IPv6FragmentPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -92,16 +92,16 @@ namespace senf { using mixin::initSize; using mixin::init; - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->nextHeader(); } - + /** \brief Dump given IPv6FragmentPacket in readable form to given output stream */ - static void dump(packet p, std::ostream & os); + static void dump(packet p, std::ostream & os); static void finalize(packet p); }; - /** \brief IPv6 fragment extension packet typedef + /** \brief IPv6 fragment extension packet typedef \ingroup protocolbundle_default */ typedef ConcretePacket IPv6FragmentPacket; @@ -128,11 +128,11 @@ namespace senf { | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | - + + + + | | - + Address[1] + + + Address[1] | | - + + + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . @@ -140,32 +140,32 @@ namespace senf { . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | - + + + + | | - + Address[n] + + + Address[n] | | - + + + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ # include SENF_PARSER() - + SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); SENF_PARSER_FIELD ( headerLength, UInt8Parser ); SENF_PARSER_FIELD ( routingType, UInt8Parser ); //set to Zero for minimal implementation SENF_PARSER_FIELD_RO ( segmentsLeft, UInt8Parser ); SENF_PARSER_FIELD ( reserved, UInt32Parser ); //set to zero by RFC SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser ); - + SENF_PARSER_FINALIZE ( IPv6RoutingPacketParser ); - + //provisionary, since only type 0 is implemented - SENF_PARSER_INIT() { + SENF_PARSER_INIT() { routingType() = 0u; - reserved() = 0u; + reserved() = 0u; } }; - + /** \brief IPv6 routing extension \par Packet type (typedef): @@ -173,10 +173,10 @@ namespace senf { \par Fields: \ref IPv6RoutingPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -193,29 +193,29 @@ namespace senf { typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 routing extension packet */ typedef IPv6RoutingPacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - - static key_t nextPacketKey(packet p) + + static key_t nextPacketKey(packet p) { return p->nextHeader(); } - + /** \brief Dump given IPv6RoutingPacket in readable form to given output stream */ - static void dump(packet p, std::ostream & os); - + static void dump(packet p, std::ostream & os); + static void finalize(packet p); }; - + /** \brief IPv6 routing extension packet typedef \ingroup protocolbundle_default */ typedef ConcretePacket IPv6RoutingPacket; - + // ===================================================================================================== - + /** \brief Parse in IPv6 Hop-By-Hop extension header Parser implementing the IPv6 routing Header extension. The fields implemented are: @@ -224,10 +224,10 @@ namespace senf { \see IPv6ExtensionType_HopByHop \n RFC 2460 */ - struct IPv6HopByHopOptionsPacketParser : public PacketParserBase + struct IPv6HopByHopOptionsPacketParser : public PacketParserBase { # include SENF_PARSER() - + SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser ); @@ -240,7 +240,7 @@ namespace senf { SENF_PARSER_FINALIZE ( IPv6HopByHopOptionsPacketParser ); }; - + /** \brief IPv6 Hop-By-Hop extension \par Packet type (typedef): @@ -248,10 +248,10 @@ namespace senf { \par Fields: \ref IPv6HopByHopOptionsPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -268,38 +268,38 @@ namespace senf { typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 Hop-By-Hop extension packet */ typedef IPv6HopByHopOptionsPacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - + static key_t nextPacketKey(packet p) { return p->nextHeader(); } - + /** \brief Dump given IPv6HopByHopOptionsPacket in readable form to given output stream */ - static void dump(packet p, std::ostream & os); - + static void dump(packet p, std::ostream & os); + static void finalize(packet p); }; - + /** \brief IPv6 routing Hop-By-Hop packet typedef \ingroup protocolbundle_default */ typedef ConcretePacket IPv6HopByHopOptionsPacket; - + // ===================================================================================================== - + /** \brief Parse in IPv6 Destination Options extension header - Parser implementing the IPv6 Destination Options Header extension. + Parser implementing the IPv6 Destination Options Header extension. The fields implemented are: \image html IPv6DestinationOptionsPacket.png \see IPv6ExtensionType_Destination \n RFC 2460 - */ - struct IPv6DestinationOptionsPacketParser : public PacketParserBase + */ + struct IPv6DestinationOptionsPacketParser : public PacketParserBase { # include SENF_PARSER() SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); @@ -313,7 +313,7 @@ namespace senf { SENF_PARSER_FINALIZE ( IPv6DestinationOptionsPacketParser ); }; - + /** \brief IPv6 Destination Options extension \par Packet type (typedef): @@ -321,10 +321,10 @@ namespace senf { \par Fields: \ref IPv6DestinationOptionsPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -341,25 +341,25 @@ namespace senf { typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 Destination Options extension packet */ typedef IPv6DestinationOptionsPacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - - static key_t nextPacketKey(packet p) + + static key_t nextPacketKey(packet p) { return p->nextHeader(); } /** \brief Dump given IPv6DestinationOptionsPacket in readable form to given output stream */ - static void dump(packet p, std::ostream & os); - + static void dump(packet p, std::ostream & os); + static void finalize(packet p); }; - + /** \brief IPv6 routing Destination Options packet typedef \ingroup protocolbundle_default */ typedef ConcretePacket IPv6DestinationOptionsPacket; - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.test.cc b/senf/Packets/DefaultBundle/IPv6Extensions.test.cc index 7b6791c..f7ec069 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.test.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.test.cc @@ -73,9 +73,9 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_fragment) BOOST_CHECK_EQUAL( pFragment_packet->version(), 6u ); BOOST_CHECK_EQUAL( pFragment_packet->length(), 20u ); BOOST_CHECK_EQUAL( pFragment_packet->nextHeader(), 44u ); - BOOST_CHECK_EQUAL( pFragment_packet->source().value(), + BOOST_CHECK_EQUAL( pFragment_packet->source().value(), senf::INet6Address::from_string("2001::1") ); - BOOST_CHECK_EQUAL( pFragment_packet->destination().value(), + BOOST_CHECK_EQUAL( pFragment_packet->destination().value(), senf::INet6Address::from_string("2001::2") ); std::ostringstream oss (std::ostringstream::out); @@ -108,11 +108,11 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_routing) { unsigned char Routing_packetData[] = { // IP header - 0x60, 0x30, 0x00, 0x00, + 0x60, 0x30, 0x00, 0x00, 0x00, 0x10, // payload Length 0x2b, // next Header (43 = Routing Header) 0xff, // Hop Limit - 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x02, 0xff, 0xfe, 0x00, 0x02, 0x00, // Src Addr 0x35, 0x55, 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, // Dest. Addr @@ -128,17 +128,17 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_routing) 0xa3, 0xd3, // checksum (incorrect in wireshark capture file, should be 0xa3c4) 0x00, 0x00, 0x00, 0x00 }; - + senf::IPv6Packet pRouting_packet (senf::IPv6Packet::create(Routing_packetData)); BOOST_CHECK_EQUAL( pRouting_packet->version(), 6u ); BOOST_CHECK_EQUAL( pRouting_packet->length(), 16u ); BOOST_CHECK_EQUAL( pRouting_packet->nextHeader(), 43u ); - BOOST_CHECK_EQUAL( pRouting_packet->source().value(), + BOOST_CHECK_EQUAL( pRouting_packet->source().value(), senf::INet6Address::from_string("fe80::201:2ff:fe00:200") ); - BOOST_CHECK_EQUAL( pRouting_packet->destination().value(), + BOOST_CHECK_EQUAL( pRouting_packet->destination().value(), senf::INet6Address::from_string("3555:5555:6666:6666:7777:7777:8888:8888")); - + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pRouting_packet.dump( oss)); @@ -150,7 +150,7 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_routing) BOOST_CHECK_EQUAL( pRouting_extension->headerLength(), 0x00 ); BOOST_CHECK_EQUAL( pRouting_extension->routingType(), 0x00 ); BOOST_CHECK_EQUAL( pRouting_extension->segmentsLeft(), 0x00); - + BOOST_CHECK_EQUAL( pRouting_extension->reserved(), 0u); BOOST_REQUIRE( pRouting_extension.next().is() ); @@ -168,9 +168,9 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse) 0x00, 0x24, // payload length 0x00, // next header: IPv6 hop-by-hop option (0) 0x01, // hop limit (1) - 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x19, 0xb9, 0xff, 0xfe, 0xeb, 0xb2, 0x26, // IPv6 Source address - 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, // IPv6 Destination address ff02::16 // HopByHop option 0x3a, // next Header (ICMPv6) @@ -191,7 +191,7 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse) BOOST_CHECK_EQUAL( pHop_packet->version(), 6u ); BOOST_CHECK_EQUAL( pHop_packet->length(), 36u ); BOOST_CHECK_EQUAL( pHop_packet->nextHeader(), 0u ); - BOOST_CHECK_EQUAL( pHop_packet->source().value(), + BOOST_CHECK_EQUAL( pHop_packet->source().value(), senf::INet6Address::from_string("fe80::219:b9ff:feeb:b226") ); BOOST_CHECK_EQUAL( pHop_packet->destination().value(), senf::INet6Address::from_string("ff02::16") ); @@ -237,9 +237,9 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_create) 0x00, 0x24, // payload length 0x00, // next header: IPv6 hop-by-hop option (0) 0x01, // hop limit (1) - 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // IPv6 Source address + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // IPv6 Source address 0x02, 0x19, 0xb9, 0xff, 0xfe, 0xeb, 0xb2, 0x26, // (fe80::219:b9ff:feeb:b226) - 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // IPv6 Destination address + 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // IPv6 Destination address 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, // (ff02::16) // HopByHop option 0x3a, // next Header (ICMPv6) @@ -280,7 +280,7 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_create) { senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optC(pext->options() ); { - senf::IPv6GenericOptionParser opt ( + senf::IPv6GenericOptionParser opt ( optC.push_back_space().init()); opt.altAction() = 0u; opt.changeFlag() = 0u; @@ -316,33 +316,33 @@ namespace { SENF_PARSER_FIELD ( extendedType, senf::UInt8Parser ); SENF_PARSER_FIELD ( checksum, senf::UInt32Parser ); SENF_PARSER_FINALIZE ( IPv6ChecksumOptionParser ); - + SENF_PARSER_INIT() { optionType() = typeId; length() = 5u; - extendedType() = extendedTypeId; + extendedType() = extendedTypeId; } - + static const boost::uint8_t typeId = 0x0d; static const boost::uint8_t extendedTypeId = 0x4d; }; } SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_create_SN) -{ +{ senf::IPv6HopByHopOptionsPacket p ( senf::IPv6HopByHopOptionsPacket::create() ); p->nextHeader() = 0x3a; { senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optC (p->options() ); { - IPv6ChecksumOptionParser opt ( + IPv6ChecksumOptionParser opt ( optC.push_back_space().init()); opt.checksum() = 0x01234567u; } } - unsigned char data[] = { - 0x3a, 0x01, // Hop-By-Hop Header (nextHeader, length) + unsigned char data[] = { + 0x3a, 0x01, // Hop-By-Hop Header (nextHeader, length) 0x0d, 0x05, // option type, length // option value: extendedType, checksum 0x4d, 0x01, 0x23, 0x45, 0x67, @@ -350,29 +350,29 @@ SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_create_SN) 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 }; SENF_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), - p.data().begin(), p.data().end() ); + p.data().begin(), p.data().end() ); } SENF_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse_SN) { - unsigned char data[] = { - 0x3a, 0x01, // Hop-By-Hop Header (nextHeader, length) + unsigned char data[] = { + 0x3a, 0x01, // Hop-By-Hop Header (nextHeader, length) 0x0d, 0x05, // option type, length // option value: slfNetType, checksum 0x4d, 0x01, 0x23, 0x45, 0x67, // padding (PadN option: type, length, 0-padding) 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + senf::IPv6HopByHopOptionsPacket p ( senf::IPv6HopByHopOptionsPacket::create(data) ); BOOST_CHECK_EQUAL( p->nextHeader(), 0x3a); - + { typedef senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optContainer_t; optContainer_t optC (p->options() ); optContainer_t::iterator listIter (optC.begin()); - + BOOST_CHECK_EQUAL( listIter->optionType(), 0x0d); BOOST_CHECK( listIter->is()); IPv6ChecksumOptionParser opt ( listIter->as()); diff --git a/senf/Packets/DefaultBundle/IPv6Packet.cc b/senf/Packets/DefaultBundle/IPv6Packet.cc index 2049b42..40bb523 100644 --- a/senf/Packets/DefaultBundle/IPv6Packet.cc +++ b/senf/Packets/DefaultBundle/IPv6Packet.cc @@ -45,9 +45,9 @@ prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os) boost::io::ios_all_saver ias(os); os << "Internet protocol Version 6:\n" << senf::fieldName("version") << unsigned(p->version()) << "\n" - << senf::fieldName("traffic class") + << senf::fieldName("traffic class") << "0x" << std::hex << std::setw(2) << std::setfill('0') << unsigned(p->trafficClass()) << "\n" - << senf::fieldName("flow label") + << senf::fieldName("flow label") << "0x" << std::hex << std::setw(5) << std::setfill('0') << unsigned(p->flowLabel()) << "\n" << senf::fieldName("payload length") << std::dec << unsigned(p->length()) << "\n" << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n" diff --git a/senf/Packets/DefaultBundle/IPv6Packet.hh b/senf/Packets/DefaultBundle/IPv6Packet.hh index 251dfa7..ef8663d 100644 --- a/senf/Packets/DefaultBundle/IPv6Packet.hh +++ b/senf/Packets/DefaultBundle/IPv6Packet.hh @@ -37,7 +37,7 @@ namespace senf { /** \brief Parse an IPv6 address - + \see INet6Address */ struct INet6AddressParser : public PacketParserBase @@ -53,7 +53,7 @@ namespace senf { void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); } operator value_type() const { return value(); } byte & operator[](size_type index) const { return *boost::next(i(),index); } - INet6AddressParser const & operator= (value_type const & other) + INet6AddressParser const & operator= (value_type const & other) { value(other); return *this; } }; @@ -88,7 +88,7 @@ namespace senf { \par Packet type (typedef): \ref IPv6Packet - + \par Fields: \ref IPv6PacketParser @@ -114,7 +114,7 @@ namespace senf { \ref IPv6PacketParser::destination() "Destination Address"
\c .hC public header
\c .cciC++ implementation of inline non-template functions and members
\c .ctiC++ implementation of inline template functions and members
\c .mppSpecial include file used for external iteration by the @@ -562,7 +562,7 @@ \li When defining simple exception classes, the 'what()' member may be defined inline if it returns a string constant. \li It may be OK to use inline implementations for one-line implementations in internal - headers. + headers. \li The Packet library allows inline implementations for the definition of parsers since doing so outside the declaration just gets to verbose and parsers definitions are quite length but very simple and straight forward. diff --git a/senf/PPI.hh b/senf/PPI.hh index 7e26d3f..cd04617 100644 --- a/senf/PPI.hh +++ b/senf/PPI.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2007 +// Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund diff --git a/senf/PPI/ActiveFeeder.test.cc b/senf/PPI/ActiveFeeder.test.cc index 54d0472..8ef1a70 100644 --- a/senf/PPI/ActiveFeeder.test.cc +++ b/senf/PPI/ActiveFeeder.test.cc @@ -43,7 +43,7 @@ namespace ppi = senf::ppi; namespace module = senf::ppi::module; namespace scheduler = senf::scheduler; -namespace { +namespace { void run(senf::ClockService::clock_type t) { scheduler::TimerEvent timeout( "test-timeout", &scheduler::terminate, scheduler::now() + t); @@ -63,9 +63,9 @@ SENF_AUTO_UNIT_TEST(activeFeeder) ppi::connect( source, feeder ); ppi::connect( feeder, sink ); - senf::ClockService::clock_type start (senf::ClockService::now()); + senf::ClockService::clock_type start (senf::ClockService::now()); run( senf::ClockService::seconds(1)); - std::cerr << "\nActiveFeeder: " + std::cerr << "\nActiveFeeder: " << (sink.size()*1e9)/(senf::ClockService::now()-start) << " packets/s" << std::endl; BOOST_CHECK( sink.size() > 0); diff --git a/senf/PPI/AnnotationRouter.ct b/senf/PPI/AnnotationRouter.ct index 0e1bbef..e3f898f 100644 --- a/senf/PPI/AnnotationRouter.ct +++ b/senf/PPI/AnnotationRouter.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -44,7 +44,7 @@ prefix_ AnnotationType senf::ppi::module::AnnotationRouter:: connectorSetup(connector::ActiveOutput<> & conn, AnnotationType const & key) { if (this->connectors().find(key) != this->connectors().end()) - throw DuplicateKeyException(key); + throw DuplicateKeyException(key); route(input, conn); return key; } diff --git a/senf/PPI/AnnotationRouter.hh b/senf/PPI/AnnotationRouter.hh index 6f4300c..fa4fbc5 100644 --- a/senf/PPI/AnnotationRouter.hh +++ b/senf/PPI/AnnotationRouter.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -62,10 +62,10 @@ namespace module { { senf::MACAddress mac; - bool operator< (TargetInterface const & other) + bool operator< (TargetInterface const & other) { return mac < other.mac; } - TargetInterface(senf::MACAddress const & m) + TargetInterface(senf::MACAddress const & m) : mac (m) {} }; @@ -91,11 +91,11 @@ namespace module { \ingroup routing_modules \todo Call Module::v_init() on every connection change and remove disconnected connections - from the container + from the container */ template - class AnnotationRouter - : public Module, + class AnnotationRouter + : public Module, public MultiConnectorMixin< AnnotationRouter, connector::ActiveOutput<>, AnnotationType > @@ -108,7 +108,7 @@ namespace module { AnnotationRouter(); struct DuplicateKeyException : public senf::Exception - { DuplicateKeyException(AnnotationType const & key) + { DuplicateKeyException(AnnotationType const & key) : senf::Exception("Duplicate senf::ppi::module::AnnotationRouter routing key ") { append( senf::str(key)); } }; diff --git a/senf/PPI/AnnotationRouter.test.cc b/senf/PPI/AnnotationRouter.test.cc index 28de963..4cbd566 100644 --- a/senf/PPI/AnnotationRouter.test.cc +++ b/senf/PPI/AnnotationRouter.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -67,12 +67,12 @@ SENF_AUTO_UNIT_TEST(annotationRouter) debug::PassiveSink sink2; AnnotationRouter router; - + ppi::connect(source, router); ppi::connect(router, 1, sink1); ppi::connect(router, 2, sink2); - - BOOST_CHECK_THROW( connect(router, 2, sink2), + + BOOST_CHECK_THROW( connect(router, 2, sink2), module::AnnotationRouter::DuplicateKeyException); ppi::init(); @@ -98,7 +98,7 @@ SENF_AUTO_UNIT_TEST(annotationRouter) senf::ppi::connect(router, 1, sink1); senf::ppi::init(); source.submit(p1); - + BOOST_CHECK_EQUAL( sink1.size(), 2u ); BOOST_CHECK_EQUAL( sink2.size(), 1u ); } diff --git a/senf/PPI/CloneSource.test.cc b/senf/PPI/CloneSource.test.cc index a54ea31..28c7f9b 100644 --- a/senf/PPI/CloneSource.test.cc +++ b/senf/PPI/CloneSource.test.cc @@ -52,7 +52,7 @@ SENF_AUTO_UNIT_TEST(cloneSource) BOOST_CHECK( sink.request() != p ); BOOST_CHECK( sink.request().data()[0] == p.data()[0] ); BOOST_CHECK( sink.request().data()[0] == p.data()[0] ); - + data[0] = 0xcd; senf::Packet p2 (senf::DataPacket::create(data)); source.replacePacket( p2); diff --git a/senf/PPI/Connectors.cc b/senf/PPI/Connectors.cc index 04ce2bd..bdcf581 100644 --- a/senf/PPI/Connectors.cc +++ b/senf/PPI/Connectors.cc @@ -42,7 +42,7 @@ prefix_ void senf::ppi::connector::Connector::connect(Connector & target) { // The connector is not registered -> route() or noroute() statement missing - SENF_ASSERT( module_ && + SENF_ASSERT( module_ && "senf::ppi::connector::Connector::connect(): (source) " "Missing route() or noroute()" ); // The connector is already connected @@ -58,14 +58,14 @@ prefix_ void senf::ppi::connector::Connector::connect(Connector & target) "senf::ppi::connector::Connector::connect(): (target) " "duplicate connection" ); if (! (packetTypeID() == typeid(void) || - target.packetTypeID() == typeid(void) || + target.packetTypeID() == typeid(void) || packetTypeID() == target.packetTypeID()) ) - throw IncompatibleConnectorsException() - << ": " << prettyName(packetTypeID()) + throw IncompatibleConnectorsException() + << ": " << prettyName(packetTypeID()) << " [in module " << prettyName(typeid(*module_)) << "] " << ", " << prettyName(target.packetTypeID()) << " [in module " << prettyName(typeid(*target.module_)) << "]"; - + peer_ = & target; target.peer_ = this; @@ -84,8 +84,8 @@ prefix_ void senf::ppi::connector::Connector::trace(Packet const & p, char const return; SENF_LOG_BLOCK(({ std::string type (prettyName(p.typeId().id())); - log << "PPI packet trace: " << label << " 0x" << std::hex << p.id() << " " - << type.substr(21, type.size()-22) << " on " << & module() << " " + log << "PPI packet trace: " << label << " 0x" << std::hex << p.id() << " " + << type.substr(21, type.size()-22) << " on " << & module() << " " << prettyName(typeid(module())) << " connector 0x" << this << "\n"; if (traceState_ == TRACE_CONTENTS) p.dump(log); @@ -98,14 +98,14 @@ prefix_ void senf::ppi::connector::Connector::throttleTrace(char const * label, if (traceState_ == NO_TRACING) return; SENF_LOG_BLOCK(({ - log << "PPI throttling trace: " << label << " " << type << " on " << & module() + log << "PPI throttling trace: " << label << " " << type << " on " << & module() << " " << prettyName(typeid(module())) << " connector 0x" << this << "\n"; })); } namespace senf { namespace ppi { namespace connector { - SENF_CONSOLE_REGISTER_ENUM_MEMBER( + SENF_CONSOLE_REGISTER_ENUM_MEMBER( Connector, TraceState, (NO_TRACING)(TRACE_IDS)(TRACE_CONTENTS) ); }}} @@ -218,7 +218,7 @@ prefix_ void senf::ppi::connector::PassiveConnector::v_unthrottleEvent() prefix_ void senf::ppi::connector::PassiveConnector::notifyUnthrottle() { - if (std::find_if(routes_.begin(), routes_.end(), + if (std::find_if(routes_.begin(), routes_.end(), boost::bind(&ForwardingRoute::throttled, _1)) == routes_.end()) { remoteThrottled_ = false; if (!nativeThrottled_) @@ -323,7 +323,7 @@ prefix_ void senf::ppi::connector::GenericActiveInput::v_requestEvent() // senf::ppi::connector::GenericPassiveInput //////////////////////////////////////// -// private members +// private members prefix_ void senf::ppi::connector::GenericPassiveInput::v_enqueueEvent() { diff --git a/senf/PPI/Connectors.cci b/senf/PPI/Connectors.cci index 3f9ceee..cebc539 100644 --- a/senf/PPI/Connectors.cci +++ b/senf/PPI/Connectors.cci @@ -155,7 +155,7 @@ prefix_ void senf::ppi::connector::PassiveConnector::unregisterRoute(ForwardingR routes_.erase(i); } -// public members +// public members prefix_ bool senf::ppi::connector::PassiveConnector::nativeThrottled() const @@ -263,7 +263,7 @@ prefix_ senf::Packet senf::ppi::connector::InputConnector::peek() const { // Cannot peek() head of empty queue - SENF_ASSERT( ! queue_.empty() && + SENF_ASSERT( ! queue_.empty() && "senf::ppi::connector::InputConnector: cannot call peek() on empty queue" ); return queue_.back(); } diff --git a/senf/PPI/Connectors.hh b/senf/PPI/Connectors.hh index 0dfe9cf..cd6e1e1 100644 --- a/senf/PPI/Connectors.hh +++ b/senf/PPI/Connectors.hh @@ -63,8 +63,8 @@ namespace connector { We therefore have 4 connector types each of which is parameterized by the type of packet traversing the connector: \li senf::ppi::connector::ActiveInput - \li senf::ppi::connector::ActiveOutput - \li senf::ppi::connector::PassiveInput + \li senf::ppi::connector::ActiveOutput + \li senf::ppi::connector::PassiveInput \li senf::ppi::connector::PassiveOutput. Connectors are declared as module data members and are then externally connected to other @@ -115,7 +115,7 @@ namespace connector { senf::ppi::connector::ActiveInputJack input; senf::ppi::connector::ActiveOutputJack output; - MyGroup() + MyGroup() : queue (), analyzer (), input (queue.input), output (analyzer.output) { senf::ppi::connect(queue, analyzer); @@ -186,10 +186,10 @@ namespace connector { void throttleTrace(char const * label, char const * type); void unregisterConnector(); - + private: virtual std::type_info const & packetTypeID(); - + virtual void v_disconnected() const; void setModule(module::Module & module); @@ -348,7 +348,7 @@ namespace connector { typedef std::vector NotifyRoutes; NotifyRoutes notifyRoutes_; - bool throttled_; + bool throttled_; friend class senf::ppi::ForwardingRoute; friend class PassiveConnector; @@ -568,12 +568,12 @@ namespace connector { #else /** \brief Connector actively reading packets - + \tparam PacketType Type of packet to read. Defaults to senf::Packet The %ActiveInput %connector template reads data actively from a connected %module. This - class is completely implemented via it's base-class, GenericActiveInput, the only - difference is that read packets are returned as \a PacketType instead of generic + class is completely implemented via it's base-class, GenericActiveInput, the only + difference is that read packets are returned as \a PacketType instead of generic senf::Packet references. \see GenericActiveInput \n @@ -595,7 +595,7 @@ namespace connector { \tparam PacketType Type of packet to read. Defaults to senf::Packet The %PassiveInput %connector template receives packets sent to it from a connected - %module. This class is completely implemented via it's base-class, GenericPassiveInput, + %module. This class is completely implemented via it's base-class, GenericPassiveInput, the only difference is that read packets are returned as \a PacketType instead of generic senf::Packet references. @@ -617,7 +617,7 @@ namespace connector { \tparam PacketType Type of packet to send. Defaults to senf::Packet - The %ActiveOutput %connector template sends data actively to a connected %module. This + The %ActiveOutput %connector template sends data actively to a connected %module. This class is completely implemented via it's base-class, GenericActiveOutput, the only difference is that it only sends packets of type \a PacketType. @@ -636,9 +636,9 @@ namespace connector { \tparam PacketType Type of packet to send. Defaults to senf::Packet - The %PassiveOutput %connector template provides data passively to a connected %module - whenever signaled. This class is completely implemented via it's base-class, - GenericPassiveOutput, the only difference is that it only sends packets of type + The %PassiveOutput %connector template provides data passively to a connected %module + whenever signaled. This class is completely implemented via it's base-class, + GenericPassiveOutput, the only difference is that it only sends packets of type \a PacketType. \see GenericPassiveOutput \n diff --git a/senf/PPI/Connectors.ih b/senf/PPI/Connectors.ih index 1a40ceb..2c37b33 100644 --- a/senf/PPI/Connectors.ih +++ b/senf/PPI/Connectors.ih @@ -40,7 +40,7 @@ namespace detail { { public: typedef PacketType Type; - + Type operator()(); Type read(); }; @@ -50,7 +50,7 @@ namespace detail { { public: typedef PacketType Type; - + void operator()(Type p); void write(Type p); }; diff --git a/senf/PPI/Connectors.test.cc b/senf/PPI/Connectors.test.cc index fe386d8..7482a1a 100644 --- a/senf/PPI/Connectors.test.cc +++ b/senf/PPI/Connectors.test.cc @@ -75,7 +75,7 @@ SENF_AUTO_UNIT_TEST(passiveConnector) target.input.throttle(); BOOST_CHECK( target.input.throttled() ); BOOST_CHECK( target.input.nativeThrottled() ); - + target.input.unthrottle(); BOOST_CHECK( ! target.input.throttled() ); BOOST_CHECK( ! target.input.nativeThrottled() ); @@ -84,9 +84,9 @@ SENF_AUTO_UNIT_TEST(passiveConnector) } namespace { - + bool called = false; - + void handler() { called = true; } } @@ -136,7 +136,7 @@ SENF_AUTO_UNIT_TEST(inputConnector) // peek() is implicitly tested within the Active/PassiveSink implementation BOOST_CHECK_EQUAL ( & target.input.peer(), & source.output ); - + BOOST_CHECK( target.input.begin() == target.input.end() ); BOOST_CHECK_EQUAL( target.input.queueSize(), 0u ); BOOST_CHECK( target.input.empty() ); @@ -188,23 +188,23 @@ SENF_AUTO_UNIT_TEST(passiveInput) ppi::init(); BOOST_CHECK_EQUAL( & target.input.peer(), & source.output ); - + target.input.throttle(); senf::Packet p (senf::DataPacket::create()); source.submit(p); - + BOOST_CHECK_EQUAL( target.counter, 0u ); BOOST_CHECK( target.input ); BOOST_CHECK_EQUAL( target.input.queueSize(), 1u ); target.input.unthrottle(); BOOST_CHECK( target.input ); BOOST_CHECK_EQUAL( target.counter, 1u ); - + BOOST_CHECK( target.input() == p ); BOOST_CHECK( ! target.input ); - + source.submit(p); - + BOOST_CHECK_EQUAL( target.counter, 2u ); BOOST_CHECK( target.input.throttled() ); BOOST_CHECK( target.input() == p ); @@ -239,7 +239,7 @@ SENF_AUTO_UNIT_TEST(passiveOutput) source.submit(p); BOOST_CHECK( target.request() == p ); - + // connect() is tested indirectly via ppi::connect } @@ -275,7 +275,7 @@ SENF_AUTO_UNIT_TEST(activeOutput) ppi::connect(source,target); ppi::init(); - + BOOST_CHECK_EQUAL( & source.output.peer(), & target.input ); BOOST_CHECK( source.output ); target.input.throttle(); @@ -372,7 +372,7 @@ SENF_AUTO_UNIT_TEST(typedInput) senf::Packet p (senf::DataPacket::create()); source.submit(p); - + BOOST_CHECK( true ); } @@ -383,9 +383,9 @@ SENF_AUTO_UNIT_TEST(tyepdOutput) ppi::connect(source,target); ppi::init(); - + senf::IGNORE( target.request() ); - + BOOST_CHECK( true ); } @@ -394,13 +394,13 @@ SENF_AUTO_UNIT_TEST(connectorTest) { TypedPassiveInput<> input; TypedActiveOutput output; - BOOST_CHECK_THROW( ppi::connect(output, input), + BOOST_CHECK_THROW( ppi::connect(output, input), ppi::connector::IncompatibleConnectorsException ); } { TypedPassiveInput input; TypedActiveOutput<> output; - BOOST_CHECK_THROW( ppi::connect(output, input), + BOOST_CHECK_THROW( ppi::connect(output, input), ppi::connector::IncompatibleConnectorsException ); } { @@ -408,7 +408,7 @@ SENF_AUTO_UNIT_TEST(connectorTest) TypedActiveOutput<> output; SENF_CHECK_NO_THROW( ppi::connect(output, input) ); } - { + { TypedPassiveInput<> input; debug::ActiveSource output; SENF_CHECK_NO_THROW( ppi::connect(output, input) ); @@ -476,13 +476,13 @@ SENF_AUTO_UNIT_TEST(delayedConnect) ppi::connect(source, target); ppi::init(); - + BOOST_CHECK( source.output ); senf::Packet p (senf::DataPacket::create()); source.submit(p); - BOOST_CHECK( target.front() == p ); + BOOST_CHECK( target.front() == p ); BOOST_CHECK_EQUAL( target.size(), 1u ); } @@ -498,7 +498,7 @@ SENF_AUTO_UNIT_TEST(delayedConnect) ppi::connect(source, target); ppi::init(); - + BOOST_CHECK( ! source.output ); target.unthrottle(); BOOST_CHECK( source.output ); @@ -520,10 +520,10 @@ SENF_AUTO_UNIT_TEST(disconnect) source.submit(p); BOOST_CHECK( target.input ); - + target.input.disconnect(); ppi::init(); - + BOOST_CHECK( ! target.input ); } { diff --git a/senf/PPI/DebugModules.cc b/senf/PPI/DebugModules.cc index 2826166..0da4b61 100644 --- a/senf/PPI/DebugModules.cc +++ b/senf/PPI/DebugModules.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/DebugModules.hh b/senf/PPI/DebugModules.hh index 760a4af..d6503f2 100644 --- a/senf/PPI/DebugModules.hh +++ b/senf/PPI/DebugModules.hh @@ -186,7 +186,7 @@ namespace debug { private: void request(); - + Queue packets_; }; diff --git a/senf/PPI/DebugModules.test.cc b/senf/PPI/DebugModules.test.cc index cda1687..12a060e 100644 --- a/senf/PPI/DebugModules.test.cc +++ b/senf/PPI/DebugModules.test.cc @@ -53,7 +53,7 @@ SENF_AUTO_UNIT_TEST(debugModules) ppi::connect(source, sink); ppi::init(); - + senf::PacketData::byte data[] = { 0x13u, 0x24u, 0x35u }; senf::Packet p (senf::DataPacket::create(data)); @@ -64,7 +64,7 @@ SENF_AUTO_UNIT_TEST(debugModules) BOOST_CHECK( ! sink.input.throttled() ); BOOST_CHECK_EQUAL( sink.size(), 1u ); BOOST_CHECK( ! sink.empty() ); - BOOST_CHECK_EQUAL( + BOOST_CHECK_EQUAL( debug::PassiveSink::size_type(std::distance(sink.begin(),sink.end())), sink.size() ); BOOST_CHECK( *sink.begin() == p ); @@ -87,7 +87,7 @@ SENF_AUTO_UNIT_TEST(debugModules) senf::Packet p (senf::DataPacket::create(data)); source.submit(p); - + BOOST_CHECK_EQUAL( source.size(), 1u ); BOOST_CHECK_EQUAL( sink.request(), p ); BOOST_CHECK_EQUAL( source.size(), 0u ); @@ -140,7 +140,7 @@ SENF_AUTO_UNIT_TEST(logSink) senf::PacketData::byte data[] = { 0x13u, 0x24u, 0x35u }; source.submit( senf::DataPacket::create(data) ); senf::ppi::run(); - + BOOST_CHECK( ! logTarget.str().empty() ); } diff --git a/senf/PPI/DiscardSink.test.cc b/senf/PPI/DiscardSink.test.cc index bb8569b..551842c 100644 --- a/senf/PPI/DiscardSink.test.cc +++ b/senf/PPI/DiscardSink.test.cc @@ -51,7 +51,7 @@ SENF_AUTO_UNIT_TEST(discardSink) source.submit(p); source.submit(p); - + BOOST_CHECK( true ); } diff --git a/senf/PPI/Duplicators.cc b/senf/PPI/Duplicators.cc index dfbfaf9..10e42b1 100644 --- a/senf/PPI/Duplicators.cc +++ b/senf/PPI/Duplicators.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/Duplicators.cci b/senf/PPI/Duplicators.cci index f57c2f6..7a86dea 100644 --- a/senf/PPI/Duplicators.cci +++ b/senf/PPI/Duplicators.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/Duplicators.hh b/senf/PPI/Duplicators.hh index 1f58c73..9c2d76e 100644 --- a/senf/PPI/Duplicators.hh +++ b/senf/PPI/Duplicators.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -46,7 +46,7 @@ namespace module { Since ActiveDuplicator allows any number of incoming packet streams, the input connectors are dynamically managed. A special senf::ppi::connect() overload is used to dynamically - create the needed input connectors. This hides this extra functionality from the user. + create the needed input connectors. This hides this extra functionality from the user. \code senf::ppi::module::ActiveDuplicator dup; diff --git a/senf/PPI/Duplicators.test.cc b/senf/PPI/Duplicators.test.cc index ade8028..bb81596 100644 --- a/senf/PPI/Duplicators.test.cc +++ b/senf/PPI/Duplicators.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/EventManager.cc b/senf/PPI/EventManager.cc index 0b6a482..60a56ca 100644 --- a/senf/PPI/EventManager.cc +++ b/senf/PPI/EventManager.cc @@ -52,10 +52,10 @@ prefix_ void senf::ppi::EventManager::destroyEvent(EventDescriptor & event) { using boost::lambda::_1; namespace l = boost::lambda; - + SENF_ASSERT( std::find_if(registrations_.begin(), registrations_.end(), - l::bind(&detail::EventBindingBase::descriptor_,_1) == &event) + l::bind(&detail::EventBindingBase::descriptor_,_1) == &event) == registrations_.end()); } diff --git a/senf/PPI/Events.cc b/senf/PPI/Events.cc index f74a329..546bd13 100644 --- a/senf/PPI/Events.cc +++ b/senf/PPI/Events.cc @@ -50,7 +50,7 @@ prefix_ void senf::ppi::EventDescriptor::notifyUnthrottle() for (; i != i_end; ++i) if ((*i)->throttled()) break; - if (i != i_end) + if (i != i_end) return; throttled_ = false; enabled(true); diff --git a/senf/PPI/Events.hh b/senf/PPI/Events.hh index 1025db5..55a0e94 100644 --- a/senf/PPI/Events.hh +++ b/senf/PPI/Events.hh @@ -38,7 +38,7 @@ namespace senf { namespace ppi { namespace detail { class EventBindingBase; } - + /** \defgroup event_group Events Events provide notification of events outside the PPI framework: I/O activity, Timers @@ -49,13 +49,13 @@ namespace ppi { All events are derived from EventImplementation which is based on EventDescriptor. \see EventImplementation \n - \ref ppi_events + \ref ppi_events */ // Implementation: The concrete EventDescriptor implementation will need to set things up so // some callback (within the EventDescriptor implementation) will be called when the event // happens. This setup happens in 'v_enable()'. This internal handler sets up an EventType - // instance if needed and calls 'callback()'. + // instance if needed and calls 'callback()'. // // 'callback()' will access the EventBinding wrapper to find the user-callback to signal. It // will do any needed internal processing, call that user callback and clean up afterwards. @@ -65,7 +65,7 @@ namespace ppi { The EventDescriptor base-class provides an interface to control events. \see \ref ppi_events - */ + */ class EventDescriptor { public: @@ -100,7 +100,7 @@ namespace ppi { friend class ForwardingRoute; friend class detail::EventBindingBase; }; - + /** \brief Internal: Callback forwarders */ template @@ -121,7 +121,7 @@ namespace ppi { private: detail::EventBinding & binding(); }; - + #ifndef DOXYGEN template @@ -139,7 +139,7 @@ namespace ppi { /** \brief Event implementation base class - EventImplementation provides the base-class for all Event implementations. + EventImplementation provides the base-class for all Event implementations. \code class SomeEvent : public EventImplementation { @@ -157,7 +157,7 @@ namespace ppi { void cb() { // Build event argument - SomeEventArg arg (...); + SomeEventArg arg (...); // Call the event callback callback(arg); } @@ -176,7 +176,7 @@ namespace ppi { */ template class EventImplementation - : public EventDescriptor, + : public EventDescriptor, public EventImplementationHelper< EventType, EventImplementation > { public: @@ -185,7 +185,7 @@ namespace ppi { module::Module & module() const; ///< Module in which the event is registered EventManager & manager() const; ///< EventManager of the event - + protected: EventImplementation(); diff --git a/senf/PPI/IOEvent.cci b/senf/PPI/IOEvent.cci index 54b1c86..73a7658 100644 --- a/senf/PPI/IOEvent.cci +++ b/senf/PPI/IOEvent.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -31,7 +31,7 @@ ///////////////////////////////cci.p/////////////////////////////////////// prefix_ senf::ppi::IOEvent::IOEvent() - : fd_ (-1), + : fd_ (-1), event_ ("senf::ppi::IOEvent", boost::bind(&IOEvent::cb,this,_1)) {} diff --git a/senf/PPI/IOEvent.ct b/senf/PPI/IOEvent.ct index e33c06f..e7837c1 100644 --- a/senf/PPI/IOEvent.ct +++ b/senf/PPI/IOEvent.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/IOEvent.cti b/senf/PPI/IOEvent.cti index 1b160e0..907e42d 100644 --- a/senf/PPI/IOEvent.cti +++ b/senf/PPI/IOEvent.cti @@ -36,7 +36,7 @@ template prefix_ senf::ppi::IOEvent::IOEvent(Handle handle, unsigned events) - : fd_ (-1), event_ ("senf::ppi::IOEvent", boost::bind(&IOEvent::cb,this,_1)) + : fd_ (-1), event_ ("senf::ppi::IOEvent", boost::bind(&IOEvent::cb,this,_1)) { set(handle,events); } diff --git a/senf/PPI/IOEvent.hh b/senf/PPI/IOEvent.hh index 32c699f..a314fd9 100644 --- a/senf/PPI/IOEvent.hh +++ b/senf/PPI/IOEvent.hh @@ -54,7 +54,7 @@ namespace ppi { type of event is specified using the \a events mask with values from EventFlags. There are two types of flags: - + \li Event flags (\ref Read, \ref Prio, \ref Write) specify the type of event. The callback will be called whenever one of the specified events occurs on the filehandle \li Error flags (\ref Hup, \ref Err) specify some type of error condition on the @@ -76,7 +76,7 @@ namespace ppi { // This is stupid, however there is no way to import the Scheduler::EventId enum together // with the enumeration symbols - enum EventFlags { + enum EventFlags { Read = scheduler::FdEvent::EV_READ /**< FileHandle is readable */ , Prio = scheduler::FdEvent::EV_PRIO /**< FileHandle priority data is readable */ , Write = scheduler::FdEvent::EV_WRITE /**< FileHandle is writable */ @@ -112,14 +112,14 @@ namespace ppi { private: virtual void v_enable(); virtual void v_disable(); - + void cb(int event); int fd_; scheduler::FdEvent event_; }; - + }} ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/PPI/IdleEvent.hh b/senf/PPI/IdleEvent.hh index 128dcba..1e189a3 100644 --- a/senf/PPI/IdleEvent.hh +++ b/senf/PPI/IdleEvent.hh @@ -39,7 +39,7 @@ namespace ppi { An IdleEvent is signaled continually and repeatedly while enabled. It will consume 100% of available CPU resources. The resource usage is controlled by adequate event throttling. - + \ingroup event_group */ class IdleEvent @@ -55,7 +55,7 @@ namespace ppi { virtual void v_disable(); void cb(); - + scheduler::TimerEvent timer_; }; diff --git a/senf/PPI/IntervalTimer.hh b/senf/PPI/IntervalTimer.hh index 8c5b203..35e357f 100644 --- a/senf/PPI/IntervalTimer.hh +++ b/senf/PPI/IntervalTimer.hh @@ -67,7 +67,7 @@ namespace ppi { explicit IntervalTimer(ClockService::clock_type interval, unsigned eventsPerInterval=1); IntervalTimer(); - + ///@} /////////////////////////////////////////////////////////////////////////// diff --git a/senf/PPI/Jack.cci b/senf/PPI/Jack.cci index f40a3e9..4df9356 100644 --- a/senf/PPI/Jack.cci +++ b/senf/PPI/Jack.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -118,12 +118,12 @@ senf::ppi::connector::GenericPassiveOutputJack::reset(GenericPassiveOutput & out prefix_ senf::ppi::connector::ActiveInputJack:: ActiveInputJack(GenericActiveInput & input) - : GenericActiveInputJack (input) + : GenericActiveInputJack (input) {} prefix_ senf::ppi::connector::ActiveInputJack:: ActiveInputJack(GenericActiveInputJack input) - : GenericActiveInputJack (input.connector()) + : GenericActiveInputJack (input.connector()) {} prefix_ void senf::ppi::connector::ActiveInputJack::reset(GenericActiveInput & input) @@ -138,12 +138,12 @@ prefix_ void senf::ppi::connector::ActiveInputJack::reset(GenericA prefix_ senf::ppi::connector::ActiveOutputJack:: ActiveOutputJack(GenericActiveOutput & output) - : GenericActiveOutputJack (output) + : GenericActiveOutputJack (output) {} prefix_ senf::ppi::connector::ActiveOutputJack:: ActiveOutputJack(GenericActiveOutputJack & output) - : GenericActiveOutputJack (output.connector()) + : GenericActiveOutputJack (output.connector()) {} prefix_ void senf::ppi::connector::ActiveOutputJack::reset(GenericActiveOutput & output) @@ -159,12 +159,12 @@ senf::ppi::connector::ActiveOutputJack::reset(GenericActiveOutputJ prefix_ senf::ppi::connector::PassiveInputJack:: PassiveInputJack(GenericPassiveInput & input) - : GenericPassiveInputJack (input) + : GenericPassiveInputJack (input) {} prefix_ senf::ppi::connector::PassiveInputJack:: PassiveInputJack(GenericPassiveInputJack & input) - : GenericPassiveInputJack (input.connector()) + : GenericPassiveInputJack (input.connector()) {} prefix_ void senf::ppi::connector::PassiveInputJack::reset(GenericPassiveInput & input) @@ -180,12 +180,12 @@ senf::ppi::connector::PassiveInputJack::reset(GenericPassiveInputJ prefix_ senf::ppi::connector::PassiveOutputJack:: PassiveOutputJack(GenericPassiveOutput & output) - : GenericPassiveOutputJack (output) + : GenericPassiveOutputJack (output) {} prefix_ senf::ppi::connector::PassiveOutputJack:: PassiveOutputJack(GenericPassiveOutputJack & output) - : GenericPassiveOutputJack (output.connector()) + : GenericPassiveOutputJack (output.connector()) {} prefix_ void diff --git a/senf/PPI/Jack.cti b/senf/PPI/Jack.cti index bdd3eca..bc6d0ca 100644 --- a/senf/PPI/Jack.cti +++ b/senf/PPI/Jack.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/Jack.hh b/senf/PPI/Jack.hh index 9d57186..deda179 100644 --- a/senf/PPI/Jack.hh +++ b/senf/PPI/Jack.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,7 +45,7 @@ namespace connector { : private boost::noncopyable, private ppi::detail::DisableStandardConnect {}; - /** \brief Jack referencing an ActiveInput + /** \brief Jack referencing an ActiveInput \see \ref ppi_jacks */ class GenericActiveInputJack : public Jack @@ -95,7 +95,7 @@ namespace connector { private: GenericPassiveInput * input_; }; - + /** \brief Jack referencing a PassiveOutput \see \ref ppi_jacks */ class GenericPassiveOutputJack @@ -122,13 +122,13 @@ namespace connector { public: explicit ActiveInputJack(ActiveInput & input); explicit ActiveInputJack(ActiveInput<> & input); - + explicit ActiveInputJack(ActiveInputJack & input); explicit ActiveInputJack(ActiveInputJack<> & input); void reset(ActiveInput & input); void reset(ActiveInput<> & input); - + void reset(ActiveInputJack & input); void reset(ActiveInputJack<> & input); }; @@ -274,19 +274,19 @@ namespace connector { void connect(T & source, connector::GenericPassiveInputJack & target, typename boost::disable_if< boost::is_base_of >::type * = 0); - void connect(connector::GenericActiveOutputJack & source, + void connect(connector::GenericActiveOutputJack & source, connector::GenericPassiveInputJack & target); - void connect(connector::GenericPassiveOutputJack & source, + void connect(connector::GenericPassiveOutputJack & source, connector::GenericActiveInputJack & target); - void connect(connector::GenericActiveOutputJack & source, + void connect(connector::GenericActiveOutputJack & source, connector::GenericPassiveInput & target); - void connect(connector::GenericPassiveOutputJack & source, + void connect(connector::GenericPassiveOutputJack & source, connector::GenericActiveInput & target); - void connect(connector::GenericActiveOutput & source, + void connect(connector::GenericActiveOutput & source, connector::GenericPassiveInputJack & target); - void connect(connector::GenericPassiveOutput & source, + void connect(connector::GenericPassiveOutput & source, connector::GenericActiveInputJack & target); #endif diff --git a/senf/PPI/Jack.test.cc b/senf/PPI/Jack.test.cc index 828a965..a85beca 100644 --- a/senf/PPI/Jack.test.cc +++ b/senf/PPI/Jack.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ namespace { - class ActiveDummyForward + class ActiveDummyForward : public senf::ppi::module::Module { SENF_PPI_MODULE(ActiveDummyForward); @@ -55,7 +55,7 @@ namespace { { ++n; output(input()); } }; - class PassiveDummyForward + class PassiveDummyForward : public senf::ppi::module::Module { SENF_PPI_MODULE(PassiveDummyForward); @@ -98,7 +98,7 @@ namespace { PassiveGroup() : input (forward1.input), output (forward1.output) {} - + void flip() { input.reset(forward2.input); @@ -120,9 +120,9 @@ SENF_AUTO_UNIT_TEST(jacks) senf::ppi::connect(source, group); senf::ppi::connect(group, sink); - + senf::ppi::init(); - + { senf::Packet p (senf::DataPacket::create()); source.submit(p); @@ -132,7 +132,7 @@ SENF_AUTO_UNIT_TEST(jacks) group.flip(); senf::ppi::init(); - + { senf::Packet p (senf::DataPacket::create()); source.submit(p); @@ -143,7 +143,7 @@ SENF_AUTO_UNIT_TEST(jacks) BOOST_CHECK_EQUAL( group.forward1.n, 1u ); BOOST_CHECK_EQUAL( group.forward2.n, 1u ); } - + { PassiveGroup group; senf::ppi::module::debug::ActiveSource source; diff --git a/senf/PPI/Joins.cc b/senf/PPI/Joins.cc index 653149a..9338347 100644 --- a/senf/PPI/Joins.cc +++ b/senf/PPI/Joins.cc @@ -85,12 +85,12 @@ senf::ppi::module::PriorityJoin::connectorSetup(PriorityJoin::ConnectorType & co if (priority < 0) { priority = connectors().size() + priority; - if (priority < 0) + if (priority < 0) priority = 0; } if (priority >= int(connectors().size())-1) return; - + connectors().insert(connectors().begin()+priority, connectors().pop_back().release()); } diff --git a/senf/PPI/Joins.test.cc b/senf/PPI/Joins.test.cc index 89ce8a8..993e2a7 100644 --- a/senf/PPI/Joins.test.cc +++ b/senf/PPI/Joins.test.cc @@ -74,7 +74,7 @@ SENF_AUTO_UNIT_TEST(passiveJoin) sink.input.throttle(); BOOST_CHECK( ! source1 ); BOOST_CHECK( ! source2 ); - + source1.submit(p); source2.submit(p); BOOST_CHECK_EQUAL( sink.size(), 2u ); @@ -105,7 +105,7 @@ SENF_AUTO_UNIT_TEST(priorityJoin) senf::Packet p1 (senf::DataPacket::create()); senf::Packet p2 (senf::DataPacket::create()); - + source1.submit(p1); BOOST_CHECK( sink ); source2.submit(p2); @@ -128,10 +128,10 @@ SENF_AUTO_UNIT_TEST(priorityJoin) ppi::connect(source3, join, 0); ppi::connect(source4, join, -2); // Ordering now: source3, source1, source4, source2 - + senf::Packet p3 (senf::DataPacket::create()); senf::Packet p4 (senf::DataPacket::create()); - + source4.submit(p4); source3.submit(p3); source2.submit(p2); diff --git a/senf/PPI/Mainpage.dox b/senf/PPI/Mainpage.dox index 1675621..51ddf52 100644 --- a/senf/PPI/Mainpage.dox +++ b/senf/PPI/Mainpage.dox @@ -216,10 +216,10 @@ It is possible to connect two active or passive connectors with each other using a special adaptor module (senf::ppi::module::PassiveQueue or senf::ppi::module::ActiveFeeder respectively). - + Additionally, the connectors must be type-compatible: Either one (or both) of the connectors must be untyped (they accept arbitrary senf::Packet's, the optional tempalte argument is empty), - or they both accept the same type of packet. This check is performed at runtime. + or they both accept the same type of packet. This check is performed at runtime. To complete our simplified example: Lets connect senf::ppi::module::ActiveSocketReader and senf::ppi::module::PassiveSocketWriter to our example module: diff --git a/senf/PPI/Module.cci b/senf/PPI/Module.cci index 73865c2..b54093f 100644 --- a/senf/PPI/Module.cci +++ b/senf/PPI/Module.cci @@ -58,7 +58,7 @@ prefix_ senf::ppi::ModuleManager & senf::ppi::module::Module::moduleManager() prefix_ void senf::ppi::module::Module::registerConnector(connector::Connector & connector) { - if (std::find(connectorRegistry_.begin(), connectorRegistry_.end(), &connector) + if (std::find(connectorRegistry_.begin(), connectorRegistry_.end(), &connector) == connectorRegistry_.end()) { connectorRegistry_.push_back(&connector); connector.setModule(*this); diff --git a/senf/PPI/Module.hh b/senf/PPI/Module.hh index 73f5385..522db53 100644 --- a/senf/PPI/Module.hh +++ b/senf/PPI/Module.hh @@ -21,7 +21,7 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief Module public header + \brief Module public header */ #ifndef HH_SENF_PPI_Module_ @@ -47,13 +47,13 @@ namespace module { /** \namespace senf::ppi::module \brief PPI Modules - + The modules build the PPI core. The PPI provides a set of general purpose infrastructure modules. For concrete applications, additional application specific processing modules need to be implemented. \section module_impl Implementing Modules - + All modules derive from senf::ppi::module::Module. See this class for a documentation on how to write new modules. @@ -88,7 +88,7 @@ namespace module { senf::ppi::Module is the base-class of all PPI modules. It provides the module implementation with interfaces to several PPI facilities: - + \li Connector management \li Flow management (routing) \li Event handling @@ -111,8 +111,8 @@ namespace module { senf::ppi::connector::PassiveInput<> input; senf::ppi::connector::ActiveOutput<> output; - SomeModule(senf::FileHandle h) - : handle ( h ), + SomeModule(senf::FileHandle h) + : handle ( h ), event ( handle, senf::ppi::IOEvent::Read ) { // Set up routing. If some connector is not routed you need to explicitly state this @@ -186,7 +186,7 @@ namespace module { #ifndef DOXYGEN template - Route & route(Source & source, Target & target); + Route & route(Source & source, Target & target); #else Route & route(connector::InputConnector & input, connector::OutputConnector & output); @@ -213,7 +213,7 @@ namespace module { incoming data (connector or event) \param[in] output Data target, object which controls outgoing data (connector or event) - \returns Route instance describing this route + \returns Route instance describing this route \see \ref ppi_throttling \note The real implementation is not provided by three overloads but by a single template member */ @@ -230,7 +230,7 @@ namespace module { event is signaled.). This event routing allows to automatically - enable/disable the event on throttling notifications. + enable/disable the event on throttling notifications. \see \ref route() */ @@ -245,7 +245,7 @@ namespace module { generated whenever the event is signaled). This event routing allows to automatically - enable/disable the event on throttling notifications. + enable/disable the event on throttling notifications. \see \ref route() */ #endif @@ -258,7 +258,7 @@ namespace module { information for terminal connectors. See the route() documentation for more on routing - + \param[in] connector Terminal connector to declare */ #ifndef DOXYGEN @@ -282,7 +282,7 @@ namespace module { \param[in] target The handler to call whenever the event is signaled - \param[in] descriptor The type of event to register + \param[in] descriptor The type of event to register \note The real implementation has the second arguments type as an additional template parameter. */ #endif @@ -301,7 +301,7 @@ namespace module { virtual void v_init(); ///< Called after module setup /**< This member is called directly before the PPI (resumes) execution. It is called after connections have been - setup before entering the PPI main loop. + setup before entering the PPI main loop. You may overload this member. Your overload should always call the base-class implementation. */ @@ -310,11 +310,11 @@ namespace module { public: #endif void destroy(); - + private: EventManager & eventManager() const; ModuleManager & moduleManager() const; - + void registerConnector(connector::Connector & connector); void unregisterConnector(connector::Connector & connector); void unregisterEvent(EventDescriptor & event); @@ -336,7 +336,7 @@ namespace module { /** \brief Define PPI Module - Every module must begin by using this macro. + Every module must begin by using this macro. \see senf::ppi::module::Module */ diff --git a/senf/PPI/Module.test.cc b/senf/PPI/Module.test.cc index 537970a..44f2bab 100644 --- a/senf/PPI/Module.test.cc +++ b/senf/PPI/Module.test.cc @@ -87,7 +87,7 @@ namespace { void timeout() { senf::scheduler::terminate(); } - + class InitTest : public ppi::module::Module { SENF_PPI_MODULE(InitTest); @@ -114,7 +114,7 @@ namespace { SENF_AUTO_UNIT_TEST(delayedInit) { MakeInit maker; - senf::scheduler::TimerEvent timer ( + senf::scheduler::TimerEvent timer ( "delayedInit timer", senf::membind(&MakeInit::make, &maker), senf::ClockService::now() + senf::ClockService::milliseconds(250) ); diff --git a/senf/PPI/ModuleManager.cc b/senf/PPI/ModuleManager.cc index 66190d4..2bc9295 100644 --- a/senf/PPI/ModuleManager.cc +++ b/senf/PPI/ModuleManager.cc @@ -70,7 +70,7 @@ prefix_ void senf::ppi::ModuleManager::run() // private members prefix_ senf::ppi::ModuleManager::ModuleManager() - : running_(false), terminate_(false), + : running_(false), terminate_(false), initRunner_ ("senf::ppi::init", membind(&ModuleManager::init, this), scheduler::EventHook::PRE, false) { diff --git a/senf/PPI/ModuleManager.cci b/senf/PPI/ModuleManager.cci index a71d72a..3ec07f4 100644 --- a/senf/PPI/ModuleManager.cci +++ b/senf/PPI/ModuleManager.cci @@ -55,7 +55,7 @@ prefix_ void senf::ppi::ModuleManager::registerInitializable(Initializable & i) initQueue_.push_back(&i); initRunner_.enable(); // This call ensures, that the senf::ppi::init() handler is called as next handler - // after this handler returns (this works since the senf::ppi::init() handler is registered as + // after this handler returns (this works since the senf::ppi::init() handler is registered as // PRE hook and thus has very high priority) senf::scheduler::yield(); } diff --git a/senf/PPI/MonitorModule.ct b/senf/PPI/MonitorModule.ct index 1945293..6e3efce 100644 --- a/senf/PPI/MonitorModule.ct +++ b/senf/PPI/MonitorModule.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/MonitorModule.cti b/senf/PPI/MonitorModule.cti index e2f101a..335bcca 100644 --- a/senf/PPI/MonitorModule.cti +++ b/senf/PPI/MonitorModule.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/MonitorModule.hh b/senf/PPI/MonitorModule.hh index 74e7600..ad99c18 100644 --- a/senf/PPI/MonitorModule.hh +++ b/senf/PPI/MonitorModule.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -39,13 +39,13 @@ namespace module { /** \brief Base class providing simple monitor %module support - A monitor %module is a \ref senf::ppi::module::Module "module" which needs information - about traversing packets but does not really act on the packets. Because of this, it is - \e optional to connect the output: If the output is not connected, the packets will be + A monitor %module is a \ref senf::ppi::module::Module "module" which needs information + about traversing packets but does not really act on the packets. Because of this, it is + \e optional to connect the output: If the output is not connected, the packets will be silently dropped. This allows to add monitor modules either into an existing chain or add them using an - ActiveDuplicator. + ActiveDuplicator. To write a monitor %module, derive from senf::ppi::module::MonitorModule instead of senf::ppi::module and implement v_handlePacket(): @@ -89,7 +89,7 @@ namespace module { void throttle(); void unthrottle(); }; - + }}} diff --git a/senf/PPI/MonitorModule.test.cc b/senf/PPI/MonitorModule.test.cc index 74a3246..d0e55ad 100644 --- a/senf/PPI/MonitorModule.test.cc +++ b/senf/PPI/MonitorModule.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - + class PacketCounter : public senf::ppi::module::MonitorModule<> { SENF_PPI_MODULE(PacketCounter); @@ -54,12 +54,12 @@ SENF_AUTO_UNIT_TEST(monitorModulePassthrough) senf::ppi::module::debug::ActiveSource source; senf::ppi::module::debug::PassiveSink sink; PacketCounter counter; - + senf::ppi::connect(source, counter); senf::ppi::connect(counter, sink); senf::ppi::init(); - + senf::Packet p (senf::DataPacket::create()); BOOST_CHECK_EQUAL( counter.count, 0u ); @@ -83,7 +83,7 @@ SENF_AUTO_UNIT_TEST(monitorModuleNoPassthrough) senf::ppi::init(); senf::Packet p (senf::DataPacket::create()); - + BOOST_CHECK_EQUAL( counter.count, 0u ); source.submit(p); BOOST_CHECK_EQUAL( counter.count, 1u ); @@ -100,7 +100,7 @@ SENF_AUTO_UNIT_TEST(monitorModuleDynamicConnect) senf::ppi::init(); senf::Packet p (senf::DataPacket::create()); - + BOOST_CHECK_EQUAL( counter.count, 0u ); source.submit(p); BOOST_CHECK_EQUAL( counter.count, 1u ); @@ -125,7 +125,7 @@ SENF_AUTO_UNIT_TEST(monitorModuleDynamicConnect) BOOST_CHECK( source ); source.submit(p); BOOST_CHECK_EQUAL( counter.count, 3u ); - + } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/PPI/MultiConnectorMixin.ct b/senf/PPI/MultiConnectorMixin.ct index fc01c1a..f38ff8b 100644 --- a/senf/PPI/MultiConnectorMixin.ct +++ b/senf/PPI/MultiConnectorMixin.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/MultiConnectorMixin.cti b/senf/PPI/MultiConnectorMixin.cti index fdaa92a..463ba58 100644 --- a/senf/PPI/MultiConnectorMixin.cti +++ b/senf/PPI/MultiConnectorMixin.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/PPI/MultiConnectorMixin.hh b/senf/PPI/MultiConnectorMixin.hh index 34a784f..13d2ff8 100644 --- a/senf/PPI/MultiConnectorMixin.hh +++ b/senf/PPI/MultiConnectorMixin.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -44,7 +44,7 @@ namespace senf { namespace ppi { - + #ifdef DOXYGEN // For exposition only. @@ -62,7 +62,7 @@ namespace ppi { template MultiConnectorSource::ConnectorType & connect( MultiConnectorSource & source, A1 const & a1, Target & target); - + /** \brief Connect arbitrary source to MultiConnector target Additional implementations with 0..SENF_MULTI_CONNECTOR_MAX_ARGS arguments. @@ -99,7 +99,7 @@ namespace module { This mixin provides a module with support for a runtime configurable number of input or output connectors. \code - class MyModule + class MyModule : public senf::ppi::module::Module, public senf::ppi::module::MultiConnectorMixin< MyModule, senf::ppi::connector::ActiveInput<> > @@ -116,7 +116,7 @@ namespace module { route(input, output); input.onThrottle(&MyModule::doThrottle); } - + // Optional void connectorDestroy(senf::ppi::connector::ActiveInput const & input) { @@ -124,7 +124,7 @@ namespace module { } void doThrottle() - { + { // ... } @@ -180,7 +180,7 @@ namespace module { allocate a new connector \code MyModule muModule; - + senf::ppi::connect(someModule, myModule); \endcode Some modules will expect additional arguments to be passed (see below) @@ -214,7 +214,7 @@ namespace module { Implementing \c connectorDestroy now is \e mandatory. The signature is changed to take a pointer as argument \code - class MyModule + class MyModule : public senf::ppi::module::Module, public senf::ppi::module::MultiConnectorMixin< MyModule, senf::ppi::connector::ActiveInput<>, void, void > @@ -249,12 +249,12 @@ namespace module { successfully, otherwise your code will break. */ - template ::type> - class MultiConnectorMixin + class MultiConnectorMixin : private detail::MultiConnectorSelectBase::type { public: @@ -286,7 +286,7 @@ namespace module { friend class detail::MultiConnectorMixinAccess; friend class detail::MultiConnectorWrapper; - + ContainerType_ connectors_; }; @@ -300,7 +300,7 @@ namespace module { { public: typedef ConnectorType_ ConnectorType; - + protected: typedef ContainerType_ ContainerType; @@ -320,14 +320,14 @@ namespace module { # include BOOST_PP_ITERATE() void disconnected(ConnectorType_ const & c); - + friend class detail::MultiConnectorMixinAccess; friend class detail::MultiConnectorWrapper; ContainerType_ connectors_; }; - template class MultiConnectorMixin : private detail::MultiConnectorSelectBase::type @@ -352,7 +352,7 @@ namespace module { }; #endif - + }}} ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/PPI/MultiConnectorMixin.ih b/senf/PPI/MultiConnectorMixin.ih index e6f3d1c..9d4a7f5 100644 --- a/senf/PPI/MultiConnectorMixin.ih +++ b/senf/PPI/MultiConnectorMixin.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -46,9 +46,9 @@ namespace detail { }; template - struct MultiConnectorDefaultContainer - { - typedef boost::ptr_map type; + struct MultiConnectorDefaultContainer + { + typedef boost::ptr_map type; }; template @@ -62,8 +62,8 @@ namespace detail { #ifndef DOXYGEN template - struct MultiConnectorDefaultContainer - { + struct MultiConnectorDefaultContainer + { typedef boost::ptr_vector type; }; @@ -71,19 +71,19 @@ namespace detail { template struct MultiConnectorSelectBase - : public boost::mpl::if_< + : public boost::mpl::if_< boost::is_base_of, ppi::detail::DisableStandardInput, ppi::detail::DisableStandardOutput > {}; template senf::mpl::rv<0> isMulticonnector(...); template senf::mpl::rv<1> isMulticonnector( - typename boost::enable_if, + typename boost::enable_if, int>::type); template senf::mpl::rv<2> isMulticonnector( - typename boost::enable_if, + typename boost::enable_if, int>::type); template diff --git a/senf/PPI/MultiConnectorMixin.mpp b/senf/PPI/MultiConnectorMixin.mpp index 8000c67..0de3682 100644 --- a/senf/PPI/MultiConnectorMixin.mpp +++ b/senf/PPI/MultiConnectorMixin.mpp @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -29,11 +29,11 @@ // Custom includes #include #include -#include +#include #include #include #include -#include +#include #include #include #include @@ -140,7 +140,7 @@ connect(Source & source mpp_FnParamsKomma(), Target & target mpp_FnParamsKomma2( // senf::ppi::module::detail::MultiConnectorMixinAccess member declaration 1..MAX_ARGS template -static typename Module::ConnectorType & +static typename Module::ConnectorType & newConnector(Module & module mpp_FnParamsKomma()); // //////////////////////////////////////////////////////////////////////// @@ -228,7 +228,7 @@ senf::ppi::connect(Source & source, Target & target mpp_FnParamsKomma()) // senf::ppi::module::detail::MultiConnectorMixinAccess members template -typename Module::ConnectorType & +typename Module::ConnectorType & senf::ppi::module::detail::MultiConnectorMixinAccess::newConnector( Module & module mpp_FnParamsKomma()) { @@ -280,13 +280,13 @@ senf::ppi::connect(Source & source mpp_FnParamsKomma(), Target & target mpp_FnPa #undef mpp_TplParamsKomma #undef mpp_TplParams_ #undef mpp_TplParams - + // //////////////////////////////////////////////////////////////////////// /* (save-excursion (re-search-backward "^// Undefine local Macros") (forward-line 1) (delete-region (point) (progn (search-forward "// ////") (forward-line -1) (point))) (insert "\n") (let ((b (point)) - (e (progn (insert (save-excursion (re-search-backward + (e (progn (insert (save-excursion (re-search-backward "^// Local Macros") (search-forward "#define") (beginning-of-line) (buffer-substring (point) (progn (search-forward "// ////") (search-backward "#define") (forward-line 1) (point))))) (point)))) diff --git a/senf/PPI/MultiConnectorMixin.test.cc b/senf/PPI/MultiConnectorMixin.test.cc index eac542c..4847285 100644 --- a/senf/PPI/MultiConnectorMixin.test.cc +++ b/senf/PPI/MultiConnectorMixin.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -94,7 +94,7 @@ namespace { UserContainerModule() { - noroute(input); + noroute(input); input.onRequest(&UserContainerModule::request); } @@ -111,7 +111,7 @@ namespace { void connectorDestroy(ConnectorType const * c) { Connectors::iterator i ( - std::find_if(connectors_.begin(), connectors_.end(), + std::find_if(connectors_.begin(), connectors_.end(), boost::bind(&Connectors::value_type::get,_1) == c)); if (i != connectors_.end()) connectors_.erase(i); @@ -126,10 +126,10 @@ namespace { } Connectors connectors_; - + friend class module::MultiConnectorMixin, void, void>; }; - + struct IntAnnotation { int value; bool operator<(IntAnnotation const & other) const { return value < other.value; } @@ -202,13 +202,13 @@ SENF_AUTO_UNIT_TEST(multiConnectorMixin_multipleModules) module::PassiveJoin join2; module::AnnotationRouter router; UserContainerModule module; - + ppi::connect(source, join1); ppi::connect(join1, router); ppi::connect(router, 1, join2); ppi::connect(join2, module); ppi::connect(module, sink); - + senf::Packet p (senf::DataPacket::create()); p.annotation().value = 1; diff --git a/senf/PPI/Queueing.cc b/senf/PPI/Queueing.cc index 1240626..0b7c773 100644 --- a/senf/PPI/Queueing.cc +++ b/senf/PPI/Queueing.cc @@ -39,7 +39,7 @@ prefix_ void senf::ppi::ThresholdQueueing::update(connector::GenericPassiveInput & input, Event event) { switch (event) { - case ENQUEUE: + case ENQUEUE: if (input.queueSize() >= high_) input.throttle(); break; diff --git a/senf/PPI/Queueing.hh b/senf/PPI/Queueing.hh index 5ed6a9f..233d9a5 100644 --- a/senf/PPI/Queueing.hh +++ b/senf/PPI/Queueing.hh @@ -58,14 +58,14 @@ namespace ppi { virtual ~QueueingDiscipline(); enum Event { ENQUEUE, DEQUEUE }; ///< Possible queueing events - + virtual void update(connector::GenericPassiveInput & input, Event event) = 0; ///< Calculate new queueing state /**< Whenever the queue is manipulated, this member is called to calculate the new throttling state. The member must call \a input's \c throttle() or \c unthrottle() member to set the new throttling state. - + \param[in] input Connector holding the queue \param[in] event Type of event triggering the update */ }; @@ -74,7 +74,7 @@ namespace ppi { The ThresholdQueueing QueueingDiscipline is a simple queueing discipline which throttles the input as soon the number of packets in the queue reaches the \a high threshold. The input - will be unthrottled when the number of packets drops to the \a low threshold. + will be unthrottled when the number of packets drops to the \a low threshold. The default queueing discipline is ThresholdQueueing(1,0). */ diff --git a/senf/PPI/RateAnalyzer.cc b/senf/PPI/RateAnalyzer.cc index 3b84d7a..2094a35 100644 --- a/senf/PPI/RateAnalyzer.cc +++ b/senf/PPI/RateAnalyzer.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -41,7 +41,7 @@ prefix_ senf::ppi::module::RateAnalyzer::RateAnalyzer() prefix_ void senf::ppi::module::RateAnalyzer::startStatistics(senf::ClockService::clock_type interval) { timer_.interval(interval); - factor_ = double(senf::ClockService::in_nanoseconds(interval)) / + factor_ = double(senf::ClockService::in_nanoseconds(interval)) / double(senf::ClockService::in_nanoseconds( senf::ClockService::seconds(1))); } diff --git a/senf/PPI/RateAnalyzer.hh b/senf/PPI/RateAnalyzer.hh index ed85b33..b19fd76 100644 --- a/senf/PPI/RateAnalyzer.hh +++ b/senf/PPI/RateAnalyzer.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -54,7 +54,7 @@ namespace module { senf::RateAnalyzer analyzer; senf::Statistics packets; senf::Statistics packetSize; - + analyzer.signals.packetsPerSecond.connect(packets); analyzer.signals.bytesPerPacket.connect(packetSize); @@ -75,7 +75,7 @@ namespace module { ///\{ RateAnalyzer(); - + ///\} /////////////////////////////////////////////////////////////////////////// // Statistics signals diff --git a/senf/PPI/RateAnalyzer.test.cc b/senf/PPI/RateAnalyzer.test.cc index 27caa4d..5cad705 100644 --- a/senf/PPI/RateAnalyzer.test.cc +++ b/senf/PPI/RateAnalyzer.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -38,7 +38,7 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - + unsigned calls (0u); float ppss[] = { 13.333333f, 20.f, 13.333333f, 20.f, 13.333333f, 20.f }; @@ -58,7 +58,7 @@ namespace { if (calls >= sizeof(ppss) / sizeof(ppss[0])) senf::scheduler::terminate(); } - + void collectBPS(float bytesPerSecond) { bps += bytesPerSecond; @@ -91,7 +91,7 @@ SENF_AUTO_UNIT_TEST(rateAnalyzer) senf::ppi::connect(filter, analyzer); senf::ppi::run(); - + BOOST_CHECK_EQUAL( calls, 6u ); pps /= calls; diff --git a/senf/PPI/RateFilter.cc b/senf/PPI/RateFilter.cc index 953bba7..63cdcbe 100644 --- a/senf/PPI/RateFilter.cc +++ b/senf/PPI/RateFilter.cc @@ -33,7 +33,7 @@ ///////////////////////////////cc.p//////////////////////////////////////// senf::ppi::module::RateFilter::RateFilter(senf::ClockService::clock_type interval) - : timer_(interval) + : timer_(interval) { route(input, timer_); route(timer_, output); diff --git a/senf/PPI/RateFilter.hh b/senf/PPI/RateFilter.hh index dca0fbd..cedea96 100644 --- a/senf/PPI/RateFilter.hh +++ b/senf/PPI/RateFilter.hh @@ -47,7 +47,7 @@ public: RateFilter(senf::ClockService::clock_type interval); void interval(senf::ClockService::clock_type interval); senf::ClockService::clock_type interval() const; - + connector::ActiveInput<> input; connector::ActiveOutput<> output; diff --git a/senf/PPI/RateFilter.test.cc b/senf/PPI/RateFilter.test.cc index 2f8e1bd..35ec9bc 100644 --- a/senf/PPI/RateFilter.test.cc +++ b/senf/PPI/RateFilter.test.cc @@ -49,19 +49,19 @@ SENF_AUTO_UNIT_TEST(rateFilter) module::RateFilter rateFilter ( senf::ClockService::milliseconds(100) ); debug::PassiveSource source; debug::PassiveSink sink; - + ppi::connect(source, rateFilter); ppi::connect(rateFilter, sink); - + std::string data ("TEST"); senf::Packet p (senf::DataPacket::create(data)); for (int i=0; i<10; i++) - source.submit(p); - + source.submit(p); + senf::scheduler::TimerEvent timer ( "rateFilter test timer", &timeout, senf::ClockService::now() + senf::ClockService::milliseconds(250)); - + senf::ppi::run(); BOOST_CHECK_EQUAL( rateFilter.interval(), senf::ClockService::milliseconds(100) ); @@ -90,24 +90,24 @@ SENF_AUTO_UNIT_TEST(rateFilter_changeInterval) module::RateFilter rateFilter ( senf::ClockService::milliseconds(100) ); debug::PassiveSource source; debug::PassiveSink sink; - + ppi::connect(source, rateFilter); ppi::connect(rateFilter, sink); - + std::string data ("TEST"); senf::Packet p (senf::DataPacket::create(data)); for (int i=0; i<10; i++) - source.submit(p); - + source.submit(p); + senf::scheduler::TimerEvent timeoutTimer ( "rateFilter test timer", &timeout, senf::ClockService::now() + senf::ClockService::milliseconds(675)); - + RateFilter_IntervalChanger intervalChanger (rateFilter); - senf::scheduler::TimerEvent timer ( "RateFilter_IntervalChanger timer", + senf::scheduler::TimerEvent timer ( "RateFilter_IntervalChanger timer", senf::membind(&RateFilter_IntervalChanger::changeInterval, intervalChanger), senf::ClockService::now() + senf::ClockService::milliseconds(250)); - + senf::ppi::run(); BOOST_CHECK_EQUAL( rateFilter.interval(), senf::ClockService::milliseconds(200) ); diff --git a/senf/PPI/Route.hh b/senf/PPI/Route.hh index 7977031..9838826 100644 --- a/senf/PPI/Route.hh +++ b/senf/PPI/Route.hh @@ -88,7 +88,7 @@ namespace ppi { forwarded from active to passive connectors. This may be disabled by setting the authoThrottling state to \c false. - + Routing from/to an event to/from a passive connector will automatically create throttling notifications on the connector whenever the event is disabled. Routing @@ -102,7 +102,7 @@ namespace ppi { /**< This member checks only the automatic throttling state. If autoThrottling() is \c false, this member will always return \c false. */ - + protected: ForwardingRoute(module::Module & module); @@ -137,7 +137,7 @@ namespace senf { namespace ppi { /** \brief Route descriptor - + Route instances are created by Module::route statements. The Route class provides an interface to manipulate the flow processing. @@ -158,7 +158,7 @@ namespace ppi { private: typedef detail::RouteImplementation Base; typedef detail::RouteImplementation Implementation; - + Route(module::Module & module, Source & source, Target & target); friend class module::Module; diff --git a/senf/PPI/Route.ih b/senf/PPI/Route.ih index 901cf92..61d2ed8 100644 --- a/senf/PPI/Route.ih +++ b/senf/PPI/Route.ih @@ -47,7 +47,7 @@ namespace detail { struct RoutingTraitsImplementation { BOOST_STATIC_ASSERT((boost::is_base_of::value)); - + static bool const event = false; static bool const notifySource = boost::is_base_of< @@ -59,7 +59,7 @@ namespace detail { connector::InputConnector, Connector>::value; static bool const dataTarget = boost::is_base_of< connector::OutputConnector, Connector>::value; - + typedef Connector type; }; @@ -88,12 +88,12 @@ namespace detail { // for Events template struct RoutingTraits - : public RoutingTraitsImplementation::value> {}; - // This is the generic route implementation for all routes. It just provides access to the + // This is the generic route implementation for all routes. It just provides access to the // source and target. template class BaseRouteImplementation @@ -140,7 +140,7 @@ namespace detail { : public BaseRouteImplementation { typedef BaseRouteImplementation Base; - + protected: ForwardingRouteImplementation(module::Module & module, Source & source, Target & target); ~ForwardingRouteImplementation(); @@ -161,7 +161,7 @@ namespace detail { }; // This helper class finds the base-class suitable for a specific route. Routes are classified - // into two groups: + // into two groups: // 1) A forwarding routes is a routed which forwards notifications from a notifySource to a // notifyTarget. Forwarding routes are implemneted using ForwardingRouteImplementation // 2) Non-forwarding routes don't forward notifications. They are implemented directly @@ -174,14 +174,14 @@ namespace detail { static bool const isForwarding = (srcTrait::notifySource && trgTrait::notifyTarget) || (srcTrait::notifyTarget && trgTrait::notifySource); - + typedef typename boost::mpl::if_c< - isForwarding, - ForwardingRouteImplementation, + isForwarding, + ForwardingRouteImplementation, BaseRouteImplementation >::type base; }; - // RouteImplementation2 has two purposes: + // RouteImplementation2 has two purposes: // 1) Ensure, that routing is always from a data source to a data target // 2) To find the correct base-class. This is delegated to RouteImplementationBase template @@ -190,7 +190,7 @@ namespace detail { { typedef typename RouteImplementationBase::base Base; - BOOST_STATIC_ASSERT( RoutingTraits::dataSource && + BOOST_STATIC_ASSERT( RoutingTraits::dataSource && RoutingTraits::dataTarget ); protected: diff --git a/senf/PPI/Route.test.cc b/senf/PPI/Route.test.cc index c0f7407..684c8c8 100644 --- a/senf/PPI/Route.test.cc +++ b/senf/PPI/Route.test.cc @@ -65,7 +65,7 @@ namespace { ppi::DebugEvent event; ppi::ForwardingRoute * rt; - + RouteTester() : events(0), throttles(0) { route( activeIn, activeOut ); // non-forwarding rt = & route( activeIn, passiveOut ); // forward throttling @@ -99,7 +99,7 @@ namespace { void throttleRequest() { ++ throttles; } - + void unthrottleRequest() { -- throttles; } @@ -145,9 +145,9 @@ SENF_AUTO_UNIT_TEST(route) passiveSink.input.unthrottle(); BOOST_CHECK( activeSource ); BOOST_CHECK( tester.event.enabled() ); - + // Now throttle the passive source by exhausting the queue - + BOOST_CHECK( p1 == activeSink.request() ); BOOST_CHECK( passiveSource.output.throttled() ); BOOST_CHECK( ! tester.activeIn ); @@ -155,7 +155,7 @@ SENF_AUTO_UNIT_TEST(route) BOOST_CHECK( tester.passiveOut.throttled() ); BOOST_CHECK( ! activeSink ); BOOST_CHECK( ! tester.event.enabled() ); - + passiveSource.submit(p1); BOOST_CHECK( activeSink ); BOOST_CHECK( tester.event.enabled() ); @@ -185,7 +185,7 @@ namespace { void timeout() { senf::scheduler::terminate(); } - + // just a helper class for the test struct ModuleConnector { module::PriorityJoin & join_; @@ -197,7 +197,7 @@ namespace { } boost::scoped_ptr queue; }; - + class TestSink : public module::Module { SENF_PPI_MODULE(TestSink); @@ -220,23 +220,23 @@ SENF_AUTO_UNIT_TEST(connect_runtime) module::ActiveFeeder feeder; module::PriorityJoin join; module::CloneSource source1 (senf::DataPacket::create()); - + ppi::connect( source1, join); ppi::connect( join, feeder); ppi::connect( feeder, sink); - + ModuleConnector moduleConnector ( join); - senf::scheduler::TimerEvent timer ( + senf::scheduler::TimerEvent timer ( "connect_runtime timer", senf::membind(&ModuleConnector::connect, &moduleConnector), senf::ClockService::now() + senf::ClockService::milliseconds(250)); - + senf::scheduler::TimerEvent timeoutTimer ( "connect_runtime test timeoutTimer", &timeout, senf::ClockService::now() + senf::ClockService::milliseconds(500)); - + senf::ppi::run(); - + BOOST_CHECK( true ); } diff --git a/senf/PPI/Setup.hh b/senf/PPI/Setup.hh index 7b2c07a..62ecd23 100644 --- a/senf/PPI/Setup.hh +++ b/senf/PPI/Setup.hh @@ -37,7 +37,7 @@ namespace senf { namespace ppi { -namespace detail { +namespace detail { struct DisableStandardInput {}; struct DisableStandardOutput {}; struct DisableStandardConnect : public DisableStandardInput, public DisableStandardOutput {}; @@ -65,7 +65,7 @@ namespace detail { \throws connector::IncompatibleConnectorsException if the two connectors are not type compatible. - + \see \ref ppi_connections */ void connect(connector::OutputConnector & source, connector::InputConnector & target, ...); @@ -77,7 +77,7 @@ namespace detail { #endif -#ifndef DOXYGEN +#ifndef DOXYGEN template void connect(T & source, C & target, @@ -99,7 +99,7 @@ namespace detail { typename boost::disable_if< boost::is_base_of >:: type * = 0); #endif - + /** \brief Start the network Calling senf::ppi::run() will start processing the network. The main event loop is managed @@ -116,7 +116,7 @@ namespace detail { void run(); /** \brief Manually initialize the network - + For debugging purposes, it is sometimes simpler to not use senf::ppi::run() but instead drive the network via explicit calls using the debug modules. However, it is still necessary to initialize the network. This operation is performed by senf::ppi::init(). diff --git a/senf/PPI/SocketSink.cc b/senf/PPI/SocketSink.cc index 9e39494..bd7b42e 100644 --- a/senf/PPI/SocketSink.cc +++ b/senf/PPI/SocketSink.cc @@ -54,7 +54,7 @@ prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::destination(senf::INet4Soc protocolId_ = dest.port(); } -prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::operator()(Handle handle, +prefix_ void senf::ppi::IPv4SourceForcingDgramWriter::operator()(Handle handle, Packet const & packet) { sendtoandfrom( @@ -133,7 +133,7 @@ prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::destination(senf::INet6Soc protocolId_ = dest.port(); } -prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::operator()(Handle handle, +prefix_ void senf::ppi::IPv6SourceForcingDgramWriter::operator()(Handle handle, Packet const & packet) { sendtoandfrom( diff --git a/senf/PPI/SocketSink.cci b/senf/PPI/SocketSink.cci index 3eb851e..c4f4802 100644 --- a/senf/PPI/SocketSink.cci +++ b/senf/PPI/SocketSink.cci @@ -33,7 +33,7 @@ /////////////////////////////////////////////////////////////////////////// // senf::ppi::ConnectedDgramWriter -prefix_ void senf::ppi::ConnectedDgramWriter::operator()(Handle handle, +prefix_ void senf::ppi::ConnectedDgramWriter::operator()(Handle handle, Packet const & packet) { handle.write(packet.data()); diff --git a/senf/PPI/SocketSource.hh b/senf/PPI/SocketSource.hh index 9000ed6..4ae8e8e 100644 --- a/senf/PPI/SocketSource.hh +++ b/senf/PPI/SocketSource.hh @@ -46,7 +46,7 @@ namespace ppi { This read helper will read a datagram from a datagram socket. This datagram will then be interpreted as a packet of type \a Packet as defined in the packet library. \a Packet - defaults to DataPacket (type DataPacketType), which will place the data uninterpreted + defaults to DataPacket (type DataPacketType), which will place the data uninterpreted into a packet data structure. */ template @@ -105,7 +105,7 @@ namespace module { \ingroup io_modules */ template > - class ActiveSocketSource + class ActiveSocketSource : public Module { SENF_PPI_MODULE(ActiveSocketSource); @@ -113,9 +113,9 @@ namespace module { public: typedef typename Reader::Handle Handle; ///< Handle type requested by the reader - connector::ActiveOutput output; + connector::ActiveOutput output; ///< Output connector to which the data received is written - + ActiveSocketSource(); ///< Create non-connected reader /**< The reader will be disabled until a socket is set \pre Requires \a Reader to be default constructible */ @@ -139,10 +139,10 @@ namespace module { void handle(Handle handle); ///< Set handle /**< Assigning an empty or in-valid() handle will disable the module until a new, valid handle is assigned. */ - + private: void read(); - + Handle handle_; IOEvent event_; Reader reader_; diff --git a/senf/PPI/SocketSource.test.cc b/senf/PPI/SocketSource.test.cc index 0b207c4..459a9a5 100644 --- a/senf/PPI/SocketSource.test.cc +++ b/senf/PPI/SocketSource.test.cc @@ -88,7 +88,7 @@ SENF_AUTO_UNIT_TEST(socketSource) BOOST_REQUIRE( ! sink.empty() ); BOOST_CHECK_EQUAL( sink.front().data().size(), data.size() ); - BOOST_CHECK( std::equal( sink.front().data().begin(), sink.front().data().end(), + BOOST_CHECK( std::equal( sink.front().data().begin(), sink.front().data().end(), data.begin()) ); } diff --git a/senf/PPI/ThrottleBarrier.hh b/senf/PPI/ThrottleBarrier.hh index 4addc83..80eab91 100644 --- a/senf/PPI/ThrottleBarrier.hh +++ b/senf/PPI/ThrottleBarrier.hh @@ -51,7 +51,7 @@ namespace module { { SENF_PPI_MODULE(ThrottleBarrier); public: - + connector::PassiveInput<> input; connector::ActiveOutput<> output; diff --git a/senf/PPI/detail/Callback.hh b/senf/PPI/detail/Callback.hh index edecc0b..015c20f 100644 --- a/senf/PPI/detail/Callback.hh +++ b/senf/PPI/detail/Callback.hh @@ -54,7 +54,7 @@ namespace detail { struct Callback { typedef boost::function type; - + template static type make(void (FnClass::* memfn )(), Owner & owner); template @@ -71,7 +71,7 @@ namespace detail { struct Callback { typedef boost::function type; - + template static type make(void (FnClass::* memfn )(), Owner & owner); template diff --git a/senf/PPI/detail/EventBinding.hh b/senf/PPI/detail/EventBinding.hh index 15a4318..7cbbeaf 100644 --- a/senf/PPI/detail/EventBinding.hh +++ b/senf/PPI/detail/EventBinding.hh @@ -46,9 +46,9 @@ namespace detail { EventManager & manager() const; module::Module & module() const; - + protected: - EventBindingBase(EventManager & manager, module::Module & module, + EventBindingBase(EventManager & manager, module::Module & module, EventDescriptor & descriptor); void eventTime(ClockService::clock_type time); @@ -72,7 +72,7 @@ namespace detail { void callback(EventArg event, ClockService::clock_type time); void callback(EventArg event); - + private: Self & self(); }; @@ -85,7 +85,7 @@ namespace detail { public: void callback(ClockService::clock_type time); void callback(); - + private: Self & self(); }; @@ -95,7 +95,7 @@ namespace detail { /** \brief Internal: Association Event - Module - Handler, event type specific */ template class EventBinding - : public EventBindingBase, + : public EventBindingBase, public EventBindingHelper > { public: diff --git a/senf/PPI/predecl.hh b/senf/PPI/predecl.hh index 0296cfd..0e96631 100644 --- a/senf/PPI/predecl.hh +++ b/senf/PPI/predecl.hh @@ -66,8 +66,8 @@ namespace ppi { #endif - namespace module { - class Module; + namespace module { + class Module; namespace detail { template class RouteHelper; } diff --git a/senf/Packets.hh b/senf/Packets.hh index dae0112..e24677b 100644 --- a/senf/Packets.hh +++ b/senf/Packets.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2007 +// Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund diff --git a/senf/Packets/80211Bundle/InformationElements.cc b/senf/Packets/80211Bundle/InformationElements.cc index c356509..bd47a1e 100644 --- a/senf/Packets/80211Bundle/InformationElements.cc +++ b/senf/Packets/80211Bundle/InformationElements.cc @@ -37,7 +37,7 @@ SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANPowerConstraintInfoElementParser ); SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANSupportedRatesInfoElementParser ); -prefix_ void senf::WLANPowerConstraintInfoElementParser::dump(std::ostream & os) +prefix_ void senf::WLANPowerConstraintInfoElementParser::dump(std::ostream & os) const { os << " WLAN PowerConstraint Information Element\n" @@ -46,7 +46,7 @@ prefix_ void senf::WLANPowerConstraintInfoElementParser::dump(std::ostream & os) << " value: " << unsigned(value()) << "\n"; } -prefix_ void senf::WLANSSIDInfoElementParser::dump(std::ostream & os) +prefix_ void senf::WLANSSIDInfoElementParser::dump(std::ostream & os) const { os << " WLAN SSID Information Element\n" @@ -55,7 +55,7 @@ prefix_ void senf::WLANSSIDInfoElementParser::dump(std::ostream & os) << " value: " << value() << "\n"; } -prefix_ void senf::WLANSupportedRatesInfoElementParser::dump(std::ostream & os) +prefix_ void senf::WLANSupportedRatesInfoElementParser::dump(std::ostream & os) const { os << " WLAN SupportedRates Information Element\n" diff --git a/senf/Packets/80211Bundle/InformationElements.hh b/senf/Packets/80211Bundle/InformationElements.hh index 31e506f..d8bce47 100644 --- a/senf/Packets/80211Bundle/InformationElements.hh +++ b/senf/Packets/80211Bundle/InformationElements.hh @@ -41,12 +41,12 @@ namespace senf { SENF_PARSER_FIELD ( type, UInt8Parser ); SENF_PARSER_FIELD ( length, UInt8Parser ); SENF_PARSER_FINALIZE ( WLANInfoElementParser ); - + typedef GenericTLVParserRegistry Registry; }; typedef GenericTLVParserBase WLANGenericInfoElementParser; - + struct WLANSSIDInfoElementParser : public WLANInfoElementParser { @@ -56,33 +56,33 @@ namespace senf { SENF_PARSER_GOTO ( length ); SENF_PARSER_FIELD ( value, StringParser ); SENF_PARSER_FINALIZE ( WLANSSIDInfoElementParser ); - + SENF_PARSER_INIT() { type() = typeId; - } + } static const type_t::value_type typeId = 0x00u; - + void dump(std::ostream & os) const; }; - + struct WLANSupportedRatesInfoElementParser : public WLANInfoElementParser { # include SENF_PARSER() SENF_PARSER_INHERIT ( WLANInfoElementParser ); - // we just skip the value here. If somebody needs the information he has to implement - // this strange information element hisself. + // we just skip the value here. If somebody needs the information he has to implement + // this strange information element hisself. SENF_PARSER_SKIP ( length(), 0 ); SENF_PARSER_FINALIZE ( WLANSupportedRatesInfoElementParser ); - + SENF_PARSER_INIT() { type() = typeId; - } + } static const type_t::value_type typeId = 0x01u; - + void dump(std::ostream & os) const; }; - + struct WLANPowerConstraintInfoElementParser : public WLANInfoElementParser { @@ -90,13 +90,13 @@ namespace senf { SENF_PARSER_INHERIT ( WLANInfoElementParser ); SENF_PARSER_FIELD ( value, UInt8Parser ); SENF_PARSER_FINALIZE ( WLANPowerConstraintInfoElementParser ); - + SENF_PARSER_INIT() { type() = typeId; length() = 1; - } + } static const type_t::value_type typeId = 0x20u; - + void dump(std::ostream & os) const; }; } diff --git a/senf/Packets/80211Bundle/RadiotapPacket.cc b/senf/Packets/80211Bundle/RadiotapPacket.cc index 7fd01cf..474f4b0 100644 --- a/senf/Packets/80211Bundle/RadiotapPacket.cc +++ b/senf/Packets/80211Bundle/RadiotapPacket.cc @@ -51,7 +51,7 @@ prefix_ void senf::RadiotapPacketType::dump(packet p, std::ostream &os) DUMP_OPTIONAL_FIELD( fhss, unsigned, "FHSS" ); DUMP_OPTIONAL_FIELD( dbmAntennaSignal, signed, "antenna signal (dBm)" ); DUMP_OPTIONAL_FIELD( dbmAntennaNoise, signed, "antenna noise (dBm)" ); - DUMP_OPTIONAL_FIELD( lockQuality, unsigned, "lock quality" ); + DUMP_OPTIONAL_FIELD( lockQuality, unsigned, "lock quality" ); DUMP_OPTIONAL_FIELD( txAttenuation, unsigned, "tx attenuation" ); DUMP_OPTIONAL_FIELD( dbTxAttenuation, unsigned, "tx attenuation (dB)" ); DUMP_OPTIONAL_FIELD( dbmTxAttenuation, signed, "tx attenuation (dBm)" ); @@ -81,8 +81,8 @@ senf::RadiotapPacketType::nextPacketRange(packet p) { size_type h (senf::bytes(p.parser())); size_type t (p->flagsPresent() && p->flags().fcsAtEnd() ? 4 : 0); - return p.size() < h+t - ? no_range() + return p.size() < h+t + ? no_range() : optional_range( range(p.data().begin() + h, p.data().end() - t) ); } diff --git a/senf/Packets/80211Bundle/RadiotapPacket.hh b/senf/Packets/80211Bundle/RadiotapPacket.hh index b84ea55..40f3def 100644 --- a/senf/Packets/80211Bundle/RadiotapPacket.hh +++ b/senf/Packets/80211Bundle/RadiotapPacket.hh @@ -208,9 +208,9 @@ namespace senf { \par Fields: \ref RadiotapPacketParser \image html RadiotapPacket.png - + \see http://www.radiotap.org/ - + \ingroup protocolbundle_80211 */ struct RadiotapPacketType diff --git a/senf/Packets/80211Bundle/RadiotapPacket.test.cc b/senf/Packets/80211Bundle/RadiotapPacket.test.cc index 0ebcdf1..bd20348 100644 --- a/senf/Packets/80211Bundle/RadiotapPacket.test.cc +++ b/senf/Packets/80211Bundle/RadiotapPacket.test.cc @@ -37,7 +37,7 @@ SENF_AUTO_UNIT_TEST(RadiotapPacket_packet) 0x00 ,0x00 ,0x1a ,0x00, 0x6f, 0x18, 0x00, 0x00, 0x02, 0xe6, 0x8a, 0xdf, 0x12, 0x00, 0x00, 0x00, 0x12, 0x0c, 0xc8, 0x14, 0x40, 0x01, 0xc3, 0xa0, - 0x02, 0x23, + 0x02, 0x23, 0x00, 0x00, 0x00, 0x00, }; senf::RadiotapPacket p (senf::RadiotapPacket::create(data)); @@ -159,7 +159,7 @@ SENF_AUTO_UNIT_TEST(RadiotapPacket_packet_ath9k) { /* radiotap packet from ath9k with atheros card*/ unsigned char data[] = { - 0x00, 0x00, 0x20, 0x00, 0x6f, 0x48, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x6f, 0x48, 0x00, 0x00, 0x87, 0xbb, 0x91, 0x7c, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x85, 0x09, 0x80, 0x04, 0xb2, 0xa1, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x1a, 0xf7, 0x94, diff --git a/senf/Packets/80211Bundle/WLANBeaconPacket.cc b/senf/Packets/80211Bundle/WLANBeaconPacket.cc index 4bd4d15..c0698f9 100644 --- a/senf/Packets/80211Bundle/WLANBeaconPacket.cc +++ b/senf/Packets/80211Bundle/WLANBeaconPacket.cc @@ -34,7 +34,7 @@ prefix_ void senf::WLANBeaconPacketType::dump(packet p, std::ostream &os) { - boost::io::ios_all_saver ias(os); + boost::io::ios_all_saver ias(os); os << "WLAN beacon frame:\n" << senf::fieldName("timestamp") << unsigned( p->timestamp()) << "\n" << senf::fieldName("beaconInterval") << unsigned( p->beaconInterval()) << "\n"; diff --git a/senf/Packets/80211Bundle/WLANBeaconPacket.hh b/senf/Packets/80211Bundle/WLANBeaconPacket.hh index d82ed1a..72158a3 100644 --- a/senf/Packets/80211Bundle/WLANBeaconPacket.hh +++ b/senf/Packets/80211Bundle/WLANBeaconPacket.hh @@ -43,15 +43,15 @@ namespace senf { SENF_PARSER_FIELD( ssidIE, WLANSSIDInfoElementParser ); WLANSSIDInfoElementParser::value_t ssid() const { return ssidIE().value(); } - + SENF_PARSER_FIELD( supportedRatesIE, WLANSupportedRatesInfoElementParser ); - + SENF_PARSER_LIST ( ieList, packetSize(), WLANGenericInfoElementParser ); - + SENF_PARSER_FINALIZE( WLANBeaconPacketParser ); }; - + /** \brief WLAN Beacon frame packet \par Packet type (typedef): diff --git a/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc b/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc index 8c8d8fd..659552a 100644 --- a/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc +++ b/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc @@ -58,11 +58,11 @@ SENF_AUTO_UNIT_TEST(WLANBeaconPacket_parse) BOOST_CHECK_EQUAL( p->ssidIE().length(), 5); BOOST_CHECK_EQUAL( p->ssidIE().value().value(), "boxC1"); BOOST_CHECK_EQUAL( p->ssid().value(), "boxC1"); - + typedef senf::WLANBeaconPacket::Parser::ieList_t::container ieListContainer_t; ieListContainer_t ieListContainer (p->ieList()); BOOST_CHECK_EQUAL( ieListContainer.size(), 5); - + ieListContainer_t::iterator i ( ieListContainer.begin()); BOOST_CHECK_EQUAL( i->type(), 0x03); //DS parameter set ++i; @@ -79,7 +79,7 @@ SENF_AUTO_UNIT_TEST(WLANBeaconPacket_parse) BOOST_CHECK_EQUAL( i->type(), 0xdd); //vendor specific BOOST_CHECK_EQUAL( i->length(), 0x18); BOOST_CHECK_EQUAL( boost::size(i->value()), 0x18); - + unsigned char value[] = { 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x88, 0x00, 0x02, 0xa3, 0x00, 0x00, 0x27, 0xa4, 0x00, 0x00, @@ -87,7 +87,7 @@ SENF_AUTO_UNIT_TEST(WLANBeaconPacket_parse) }; SENF_CHECK_EQUAL_COLLECTIONS( value, value+sizeof(value), boost::begin(i->value()), boost::end(i->value()) ); - + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( p.dump( oss )); } @@ -98,15 +98,15 @@ SENF_AUTO_UNIT_TEST(WLANBeaconPacket_create) p->timestamp() << 0x0000009C4CAA303AuLL; p->beaconInterval() << 100u; p->ssidIE().value() << "boxC1"; - + typedef senf::WLANBeaconPacket::Parser::ieList_t::container ieListContainer_t; ieListContainer_t ieListContainer (p->ieList()); senf::WLANPowerConstraintInfoElementParser ie ( ieListContainer.push_back_space().init() ); - ie.value() << 0x42; - + ie.value() << 0x42; + p.finalizeThis(); - + unsigned char data[] = { 0x3a, 0x30, 0xaa, 0x4c, 0x9c, 0x00, 0x00, 0x00, //timestamp 0x64, 0x00, //beacon interval diff --git a/senf/Packets/80211Bundle/WLANPacket.cc b/senf/Packets/80211Bundle/WLANPacket.cc index 5e9fd03..141dcd1 100644 --- a/senf/Packets/80211Bundle/WLANPacket.cc +++ b/senf/Packets/80211Bundle/WLANPacket.cc @@ -48,7 +48,7 @@ namespace { if ( p.order() ) os << " order"; if ( !(p.toDS() || p.fromDS() || p.moreFrag() || p.retry() || p.pwrMgt() || - p.moreData() || p.protectedFrame() || p.order()) ) + p.moreData() || p.protectedFrame() || p.order()) ) os << " none"; os << "\n" << " duration : " << unsigned(p.duration()) << "\n"; @@ -95,9 +95,9 @@ prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::destinationAddr { switch (dsBits()) { case 0 : - case 2 : + case 2 : return addr1(); - default: + default: return addr3(); } } @@ -111,7 +111,7 @@ prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::sourceAddress() return addr2(); // TODO wds frames // case 3 : return addr4(); - default: + default: return addr3(); } } diff --git a/senf/Packets/80211Bundle/WLANPacket.hh b/senf/Packets/80211Bundle/WLANPacket.hh index b5c2de9..ddbe46c 100644 --- a/senf/Packets/80211Bundle/WLANPacket.hh +++ b/senf/Packets/80211Bundle/WLANPacket.hh @@ -93,7 +93,7 @@ namespace senf boost::uint16_t sequenceNumber() const { return (uint16_t)(seqNumber_2()) << 4 | seqNumber_1(); }; - + void sequenceNumber(boost::uint16_t sn); }; @@ -215,7 +215,7 @@ namespace senf boost::uint16_t sequenceNumber() const { return (uint16_t)(seqNumber_2()) << 4 | seqNumber_1(); }; - + void sequenceNumber(boost::uint16_t sn); // TODO fourth address field in case of WDS @@ -267,9 +267,9 @@ namespace senf using mixin::initSize; using mixin::nextPacketRange; - static factory_t nextPacketType(packet p) { - return p->subtype() == 0 || p->subtype() == 8 - ? LlcSnapPacket::factory() + static factory_t nextPacketType(packet p) { + return p->subtype() == 0 || p->subtype() == 8 + ? LlcSnapPacket::factory() : no_factory(); } diff --git a/senf/Packets/80211Bundle/WLANPacket.test.cc b/senf/Packets/80211Bundle/WLANPacket.test.cc index c59427e..08e7c80 100644 --- a/senf/Packets/80211Bundle/WLANPacket.test.cc +++ b/senf/Packets/80211Bundle/WLANPacket.test.cc @@ -87,7 +87,7 @@ SENF_AUTO_UNIT_TEST(WLANPacket_dataFrame_create) SENF_CHECK_NO_THROW( p->bssid() = senf::MACAddress::from_string("00:1a:4d:3e:c7:5c") ); SENF_CHECK_NO_THROW(p->sequenceNumber(4095u)); - + BOOST_CHECK_EQUAL( p->type(), 2u ); BOOST_CHECK_EQUAL( p->sequenceNumber(), 4095u ); } @@ -115,7 +115,7 @@ SENF_AUTO_UNIT_TEST(WLANPacket_beaconFrame_packet) 0xa3, 0x40, 0x00, 0x27, 0xa4, 0x00, 0x00, 0x42, 0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00, 0xa0, 0x00, 0xdd, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x01, - 0x00, 0x24, 0xff, 0x7f, + 0x00, 0x24, 0xff, 0x7f, }; senf::WLANPacket_MgtFrame p (senf::WLANPacket_MgtFrame::create(data)); @@ -173,8 +173,8 @@ SENF_AUTO_UNIT_TEST(WLANPacket_mgtFrame_create) SENF_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_packet) { unsigned char data[] = { - 0xd4, 0x00, 0x00, 0x00, - 0x00, 0x0b, 0x6b, 0x57, 0x06, 0xb0, + 0xd4, 0x00, 0x00, 0x00, + 0x00, 0x0b, 0x6b, 0x57, 0x06, 0xb0, 0x4f, 0xda, // What is this ? }; @@ -204,7 +204,7 @@ SENF_AUTO_UNIT_TEST(WLANPacket_ctrlFrame_create) senf::WLANPacket_CtrlFrame p (senf::WLANPacket_CtrlFrame::create()) ; p->receiverAddress() = senf::MACAddress::from_string("00:1a:4d:3e:c7:5c"); p->set_ack(); - + BOOST_CHECK_EQUAL( p->type(), 1u); BOOST_CHECK_EQUAL( p->subtype(), 13u); } diff --git a/senf/Packets/80221Bundle/MIHPacket.cc b/senf/Packets/80221Bundle/MIHPacket.cc index e7fba5c..e3f4389 100644 --- a/senf/Packets/80221Bundle/MIHPacket.cc +++ b/senf/Packets/80221Bundle/MIHPacket.cc @@ -51,9 +51,9 @@ prefix_ void senf::MIHPacketType::dump(packet p, std::ostream &os) << senf::fieldName(" more fragments") << p->moreFragment() << "\n" << senf::fieldName(" fragment number") << p->fragmentNr() << "\n" << senf::fieldName(" message ID (MID)") << unsigned( p->messageId()) << "\n" - << senf::fieldName(" sid") << unsigned( p->sid()) << "\n" + << senf::fieldName(" sid") << unsigned( p->sid()) << "\n" << senf::fieldName(" opcode") << unsigned( p->opcode()) << "\n" - << senf::fieldName(" aid") << unsigned( p->aid()) << "\n" + << senf::fieldName(" aid") << unsigned( p->aid()) << "\n" << senf::fieldName(" transaction id") << unsigned( p->transactionId()) << "\n" << senf::fieldName(" payload length") << unsigned( p->payloadLength()) << "\n"; p->src_mihfId().dump( os); diff --git a/senf/Packets/80221Bundle/MIHPacket.hh b/senf/Packets/80221Bundle/MIHPacket.hh index e051bfb..227d7cd 100644 --- a/senf/Packets/80221Bundle/MIHPacket.hh +++ b/senf/Packets/80221Bundle/MIHPacket.hh @@ -43,8 +43,8 @@ namespace senf { # define SENF_MIH_PACKET_REGISTRY_REGISTER( packet ) \ SENF_PACKET_REGISTRY_REGISTER( \ senf::MIHMessageRegistry, packet::type::MESSAGE_ID, packet ) - - + + /** \brief Parse a MIH packet Parser implementing the MIH header. The fields implemented are: @@ -70,13 +70,13 @@ namespace senf { SENF_PARSER_BITFIELD ( sid, 4, unsigned ); SENF_PARSER_BITFIELD ( opcode, 2, unsigned ); SENF_PARSER_BITFIELD ( aid, 10, unsigned ); - + SENF_PARSER_SKIP_BITS ( 4 ); SENF_PARSER_BITFIELD ( transactionId, 12, unsigned ); SENF_PARSER_FIELD_RO ( payloadLength, UInt16Parser ); - + SENF_PARSER_GOTO_OFFSET( 8, 8); // just to limit the offset calculation - + // Source MIHF Id SENF_PARSER_FIELD ( src_mihfId, MIHFSrcIdTLVParser ); // Destination MIHF Id diff --git a/senf/Packets/80221Bundle/MIHPacket.test.cc b/senf/Packets/80221Bundle/MIHPacket.test.cc index 0218893..fbfdd18 100644 --- a/senf/Packets/80221Bundle/MIHPacket.test.cc +++ b/senf/Packets/80221Bundle/MIHPacket.test.cc @@ -43,7 +43,7 @@ SENF_AUTO_UNIT_TEST(MIHPacket_msgId) mihPacket->sid() = 4; mihPacket->opcode() = 3; mihPacket->aid() = 42; - BOOST_CHECK_EQUAL( mihPacket->messageId(), 0x4c2a ); + BOOST_CHECK_EQUAL( mihPacket->messageId(), 0x4c2a ); } SENF_AUTO_UNIT_TEST(MIHPacket_create_eth) @@ -65,7 +65,7 @@ SENF_AUTO_UNIT_TEST(MIHPacket_create_string) mihPacket->src_mihfId().value( "senf@berlios.de"); mihPacket->dst_mihfId().value( "test"); mihPacket.finalizeThis(); - + unsigned char data[] = { // MIH header 0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 0x00, 0x19, @@ -90,9 +90,9 @@ SENF_AUTO_UNIT_TEST(MIHPacket_create_string) mihPacket->dst_mihfId().maxIdLength(128); mihPacket->dst_mihfId().value( std::string(128, 'x')); mihPacket.finalizeThis(); - // packet size is now MIH header (8 bytes) + src MIHIFId TLV (18 bytes) + - // dst MIHIFId TLV (1 byte type + 2 byte TLV length + 1 byte id length + 128 id value) - BOOST_CHECK_EQUAL( mihPacket.size(), unsigned(8 + 18 + 1+2+1+128)); + // packet size is now MIH header (8 bytes) + src MIHIFId TLV (18 bytes) + + // dst MIHIFId TLV (1 byte type + 2 byte TLV length + 1 byte id length + 128 id value) + BOOST_CHECK_EQUAL( mihPacket.size(), unsigned(8 + 18 + 1+2+1+128)); BOOST_CHECK_EQUAL( mihPacket->payloadLength(), 18 + 1+2+1+128); BOOST_CHECK_EQUAL( mihPacket->dst_mihfId().length(), 1+128); BOOST_CHECK_EQUAL( senf::bytes(mihPacket->dst_mihfId()), 1+2+1+128); @@ -101,9 +101,9 @@ SENF_AUTO_UNIT_TEST(MIHPacket_create_string) mihPacket->dst_mihfId().maxIdLength(129); mihPacket->dst_mihfId().value( std::string(129, 'x')); mihPacket.finalizeThis(); - // packet size is now MIH header (8 bytes) + src MIHIFId TLV (18 bytes) + - // dst MIHIFId TLV (1 byte type + 2 byte TLV length + 2 byte id length + 128 id value) - BOOST_CHECK_EQUAL( mihPacket.size(), unsigned(8 + 18 + 1+2+2+129)); + // packet size is now MIH header (8 bytes) + src MIHIFId TLV (18 bytes) + + // dst MIHIFId TLV (1 byte type + 2 byte TLV length + 2 byte id length + 128 id value) + BOOST_CHECK_EQUAL( mihPacket.size(), unsigned(8 + 18 + 1+2+2+129)); BOOST_CHECK_EQUAL( mihPacket->payloadLength(), 18 + 1+2+2+129); BOOST_CHECK_EQUAL( mihPacket->dst_mihfId().length(), 2+129); BOOST_CHECK_EQUAL( senf::bytes(mihPacket->dst_mihfId()), 1+2+2+129); @@ -112,7 +112,7 @@ SENF_AUTO_UNIT_TEST(MIHPacket_create_string) mihPacket.finalizeThis(); SENF_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), mihPacket.data().begin(), mihPacket.data().end() ); - + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( mihPacket.dump( oss)); } @@ -269,7 +269,7 @@ SENF_AUTO_UNIT_TEST(MIHPayload_parse) BOOST_CHECK_EQUAL( tlv2.type(), 0x0c); BOOST_CHECK_EQUAL( tlv2.length(), 0x04u); BOOST_CHECK_EQUAL( tlv2.value().size(), 0x04); - + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( mihPayload.dump( oss)); } @@ -286,7 +286,7 @@ SENF_AUTO_UNIT_TEST(MIHPayload_create) MIHGenericPayloadPacket mihPayload (MIHGenericPayloadPacket::createAfter(mihPacket)); MIHGenericPayloadPacket::Parser::tlvList_t::container tlvListContainer ( mihPayload->tlvList() ); - + unsigned char tlv1_value[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 }; MIHGenericTLVParser tlv1 ( tlvListContainer.push_back_space()); @@ -324,7 +324,7 @@ SENF_AUTO_UNIT_TEST(MIHPayload_create) 0x1a, 0x2b, 0x3c, 0x4d // value }; SENF_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), - mihPacket.data().begin(), mihPacket.data().end() ); + mihPacket.data().begin(), mihPacket.data().end() ); } diff --git a/senf/Packets/80221Bundle/MIHTypes.cci b/senf/Packets/80221Bundle/MIHTypes.cci index 33b8cab..ef2662c 100644 --- a/senf/Packets/80221Bundle/MIHTypes.cci +++ b/senf/Packets/80221Bundle/MIHTypes.cci @@ -33,32 +33,32 @@ /////////////////////////////////////////////////////////////////////////// // MIHFId prefix_ senf::MIHFId::MIHFId() - : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 > ( boost::blank()) { } prefix_ senf::MIHFId::MIHFId(senf::MACAddress const & addr) - : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 > ( addr) { } prefix_ senf::MIHFId::MIHFId(senf::INet4Address const & addr) - : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 > ( addr) { } prefix_ senf::MIHFId::MIHFId(senf::INet6Address const & addr) - : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 > ( addr) { } prefix_ senf::MIHFId::MIHFId(std::string const & addr) - : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 > ( addr) { } prefix_ senf::MIHFId::MIHFId(senf::EUI64 const & addr) - : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + : boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 > ( addr) { } @@ -75,7 +75,7 @@ prefix_ bool senf::MIHFId::operator==(senf::MIHFId const & other) } prefix_ bool senf::MIHFId::operator<(senf::MIHFId const & other) - const + const { if (type() != other.type()) return type() < other.type(); return boost::apply_visitor( LessThanVisitor(), *this, other); diff --git a/senf/Packets/80221Bundle/MIHTypes.hh b/senf/Packets/80221Bundle/MIHTypes.hh index 64ae62b..bd8d174 100644 --- a/senf/Packets/80221Bundle/MIHTypes.hh +++ b/senf/Packets/80221Bundle/MIHTypes.hh @@ -39,8 +39,8 @@ namespace senf { - class MIHFId - : public boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, + class MIHFId + : public boost::variant< boost::blank, senf::MACAddress, senf::INet4Address, senf::INet6Address, std::string, senf::EUI64 >, public boost::less_than_comparable, public boost::equality_comparable @@ -49,18 +49,18 @@ namespace senf { static MIHFId const Multicast; ///< The multicast (empty) MIHF Id static MIHFId const None; ///< The multicast (empty) MIHF Id enum Type { Empty, MACAddress, INet4Address, INet6Address, String, EUI64 }; - + MIHFId(); ///< Create empty instance. - MIHFId(senf::MACAddress const & addr); ///< Construct id with given MACAddress + MIHFId(senf::MACAddress const & addr); ///< Construct id with given MACAddress MIHFId(senf::INet4Address const & addr); ///< Construct id with given INet4Address MIHFId(senf::INet6Address const & addr); ///< Construct id with given INet6Address MIHFId(std::string const & addr); ///< Construct id with given String MIHFId(senf::EUI64 const & addr); ///< Construct id with given EUI64 - + Type type() const; bool operator==(MIHFId const & other) const; - bool operator<(MIHFId const & other) const; - + bool operator<(MIHFId const & other) const; + private: struct GetTypeVisitor : public boost::static_visitor { Type operator()(boost::blank const &) const { return Empty; } diff --git a/senf/Packets/80221Bundle/TLVParser.cc b/senf/Packets/80221Bundle/TLVParser.cc index ca70a1c..b5c70ec 100644 --- a/senf/Packets/80221Bundle/TLVParser.cc +++ b/senf/Packets/80221Bundle/TLVParser.cc @@ -74,14 +74,14 @@ prefix_ void senf::MIHFIdTLVParser::maxIdLength(boost::uint8_t maxl) const { // the maximum length of a MIHF_ID is 253 octets (see F.3.11 in 802.21) - if (maxl > 253) + if (maxl > 253) throw std::length_error("maximum length of a MIHF_ID is 253 octets"); protect(), idLength_().capacity( maxl); maxLength( maxl + senf::bytes(idLength_())); } prefix_ senf::safe_data_iterator senf::MIHFIdTLVParser::resizeValueField( - MIHTLVLengthParser::value_type size) + MIHTLVLengthParser::value_type size) { MIHTLVLengthParser::value_type current_length ( idLength()); idLength_() << size; @@ -99,9 +99,9 @@ prefix_ void senf::MIHFIdTLVParser::value(std::string const & id) { size_type str_size (id.size()); // the maximum length of a MIHF_ID is 253 octets (see F.3.11 in 802.21) - if (str_size > 253) + if (str_size > 253) throw std::length_error("maximum length of a MIHF_ID is 253 octets"); - safe_data_iterator si = resizeValueField( str_size); + safe_data_iterator si = resizeValueField( str_size); std::copy( id.begin(), id.end(), si); } @@ -194,7 +194,7 @@ prefix_ void senf::MIHStatusTLVParser::dump(std::ostream & os) case Success: os << " (Success)" << std::endl; return; - case UnspecifiedFailure: + case UnspecifiedFailure: os << " (Unspecified Failure)" << std::endl; return; case Rejected: @@ -251,7 +251,7 @@ prefix_ void senf::MIHValidTimeIntervalTLVParser::dump(std::ostream & os) /////////////////////////////////////////////////////////////////////////// // senf::MIHTLVLengthParser -prefix_ senf::MIHTLVLengthParser::value_type senf::MIHTLVLengthParser::value() const +prefix_ senf::MIHTLVLengthParser::value_type senf::MIHTLVLengthParser::value() const { switch (bytes() ) { case 1: @@ -269,7 +269,7 @@ prefix_ senf::MIHTLVLengthParser::value_type senf::MIHTLVLengthParser::value() c }; } -prefix_ void senf::MIHTLVLengthParser::value(value_type const & v) +prefix_ void senf::MIHTLVLengthParser::value(value_type const & v) { switch (bytes() ) { case 1: @@ -310,19 +310,19 @@ prefix_ senf::MIHTLVLengthParser::value_type senf::MIHTLVLengthParser::capacity( case 4: return UInt24Parser::max_value + 128; case 5: - return UInt32Parser::max_value; + return UInt32Parser::max_value; default: throw( MIHTLVLengthException()); }; } -prefix_ senf::MIHTLVLengthParser const & senf::MIHTLVLengthParser::operator= (value_type other) +prefix_ senf::MIHTLVLengthParser const & senf::MIHTLVLengthParser::operator= (value_type other) { value(other); - return *this; + return *this; } -prefix_ void senf::MIHTLVLengthParser::init() const +prefix_ void senf::MIHTLVLengthParser::init() const { defaultInit(); extended_length_flag() = false; diff --git a/senf/Packets/80221Bundle/TLVParser.cci b/senf/Packets/80221Bundle/TLVParser.cci index 982b75f..359aae3 100644 --- a/senf/Packets/80221Bundle/TLVParser.cci +++ b/senf/Packets/80221Bundle/TLVParser.cci @@ -33,7 +33,7 @@ /////////////////////////////////////////////////////////////////////////// // MIHTLVLengthParser -prefix_ senf::MIHTLVLengthParser::size_type senf::MIHTLVLengthParser::bytes() const +prefix_ senf::MIHTLVLengthParser::size_type senf::MIHTLVLengthParser::bytes() const { return 1 + ( length_field()<=128 ? 0 : fixed_length_field()); } @@ -54,7 +54,7 @@ prefix_ bool senf::MIHFIdTLVParser::binaryNAIDecoder::operator()(boost::uint8_t /////////////////////////////////////////////////////////////////////////// // MIHFIdTLVParser -prefix_ senf::PacketParserBase::data_iterator senf::MIHFIdTLVParser::valueBegin() +prefix_ senf::PacketParserBase::data_iterator senf::MIHFIdTLVParser::valueBegin() const { return i( idValue_offset()); @@ -104,7 +104,7 @@ prefix_ senf::EUI64 senf::MIHFIdTLVParser::valueAsEUI64() return EUI64::from_data( getNAIDecodedIterator( valueBegin(), valueEnd())); } -prefix_ bool senf::MIHFIdTLVParser::valueEquals( std::string const &id) +prefix_ bool senf::MIHFIdTLVParser::valueEquals( std::string const &id) const { return id == valueAsString(); @@ -144,13 +144,13 @@ prefix_ bool senf::MIHFIdTLVParser::valueEquals( MIHFId const & id) /////////////////////////////////////////////////////////////////////////// // MIHBaseTLVParser -prefix_ void senf::MIHBaseTLVParser::maxLength(MIHTLVLengthParser::value_type maxl) +prefix_ void senf::MIHBaseTLVParser::maxLength(MIHTLVLengthParser::value_type maxl) const { protect(), length_().capacity(maxl); } -prefix_ void senf::MIHBaseTLVParser::finalize() +prefix_ void senf::MIHBaseTLVParser::finalize() { protect(), length_().finalize(); }; diff --git a/senf/Packets/80221Bundle/TLVParser.ct b/senf/Packets/80221Bundle/TLVParser.ct index 9302c1f..baa4bb1 100644 --- a/senf/Packets/80221Bundle/TLVParser.ct +++ b/senf/Packets/80221Bundle/TLVParser.ct @@ -36,13 +36,13 @@ prefix_ void senf::MIHListTLVParserMixin::finalize() { Self * self ( static_cast(this)); self->protect(), self->listSize_().finalize(); - typename Self::length_t::value_type size ( + typename Self::length_t::value_type size ( senf::bytes(self->listSize_()) + senf::bytes(self->value())); self->maxLength( size); self->length_() << size; } - + ///////////////////////////////ct.e//////////////////////////////////////// #undef prefix_ diff --git a/senf/Packets/80221Bundle/TLVParser.cti b/senf/Packets/80221Bundle/TLVParser.cti index cd5c69e..e39e559 100644 --- a/senf/Packets/80221Bundle/TLVParser.cti +++ b/senf/Packets/80221Bundle/TLVParser.cti @@ -37,7 +37,7 @@ prefix_ senf::MIHFIdTLVParser::binaryNAIEncoder::binaryNAIEncode {} template -prefix_ void senf::MIHFIdTLVParser::binaryNAIEncoder::operator()(boost::uint8_t v) +prefix_ void senf::MIHFIdTLVParser::binaryNAIEncoder::operator()(boost::uint8_t v) { *i_++ = '\\'; *i_++ = v; @@ -47,20 +47,20 @@ prefix_ void senf::MIHFIdTLVParser::binaryNAIEncoder::operator() // senf::MIHFIdTLVParser template -prefix_ boost::function_output_iterator > -senf::MIHFIdTLVParser::getNAIEncodedOutputIterator(OutputIterator i) +prefix_ boost::function_output_iterator > +senf::MIHFIdTLVParser::getNAIEncodedOutputIterator(OutputIterator i) { return boost::make_function_output_iterator(binaryNAIEncoder(i)); } template -prefix_ boost::filter_iterator -senf::MIHFIdTLVParser::getNAIDecodedIterator(Iterator begin, Iterator end) +prefix_ boost::filter_iterator +senf::MIHFIdTLVParser::getNAIDecodedIterator(Iterator begin, Iterator end) { return boost::make_filter_iterator(begin, end); } - + ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_ diff --git a/senf/Packets/80221Bundle/TLVParser.hh b/senf/Packets/80221Bundle/TLVParser.hh index f996881..5faf9eb 100644 --- a/senf/Packets/80221Bundle/TLVParser.hh +++ b/senf/Packets/80221Bundle/TLVParser.hh @@ -37,13 +37,13 @@ namespace senf { struct MIHTLVLengthException : public senf::Exception - { - MIHTLVLengthException() - : senf::Exception("MIHTLVLengthException") {} + { + MIHTLVLengthException() + : senf::Exception("MIHTLVLengthException") {} }; - - class MIHTLVLengthParser + + class MIHTLVLengthParser : public detail::packet::IntParserOps, public PacketParserBase { @@ -57,7 +57,7 @@ namespace senf { value_type value() const; void value(value_type const & v); - + MIHTLVLengthParser const & operator= (value_type other); size_type bytes() const; void init() const; @@ -72,35 +72,35 @@ namespace senf { void finalize(); void capacity(value_type v); value_type capacity() const; - + private: void resize_(size_type size); - }; - + }; + /** \brief Base class for MIH TLV parsers - + MIHBaseTLVParser is the abstract base class for MIH TLV parsers. It defines the - \ref type() field as an \ref senf::UInt8Parser and the \ref length() field as a - MIHTLVLengthParser. The length field is read-only. - - To create your own \c TLVParser you have to inherit from MIHBaseTLVParser (don't - forget \ref SENF_PARSER_INHERIT) and define the \c value field. In the following example - the value is a vector of MacAddresses: + \ref type() field as an \ref senf::UInt8Parser and the \ref length() field as a + MIHTLVLengthParser. The length field is read-only. + + To create your own \c TLVParser you have to inherit from MIHBaseTLVParser (don't + forget \ref SENF_PARSER_INHERIT) and define the \c value field. In the following example + the value is a vector of MacAddresses: \code struct MacAddressesTLVParser : public MIHBaseTLVParser { - # include SENF_PARSER() + # include SENF_PARSER() SENF_PARSER_INHERIT ( MIHBaseTLVParser ); SENF_PARSER_VECTOR ( value, bytes(length), senf::MACAddressParser ); SENF_PARSER_FINALIZE( MacAddressesTLVParser ); }; \endcode - - You have to adjust the maximum length value with the \ref maxLength function + + You have to adjust the maximum length value with the \ref maxLength function before the length value is set. The default maximum value is 128. So, in the above example adding more than 21 MACAddresses to the vector will throw a TLVLengthException if you don't call \c maxLength( \e some_value) before. - + \see MIHTLVLengthParser \n MIHGenericTLVParser \n */ @@ -111,27 +111,27 @@ namespace senf { SENF_PARSER_FIELD ( type, UInt8Parser ); SENF_PARSER_FIELD_RO ( length, MIHTLVLengthParser ); SENF_PARSER_FINALIZE ( MIHBaseTLVParser ); - + /** \brief shrink size of the TLV length field to minimum - + The size of the length field will be decreased to minimum necessary to hold the current length value. */ void finalize(); - + typedef GenericTLVParserRegistry Registry; - + protected: /** \brief set maximum value of TLV length field - + The size of the length field will be increased if necessary. \param v maximum value of length field */ void maxLength(MIHTLVLengthParser::value_type maxl) const; }; - - + + /** \brief Parser for a generic TLV packet */ struct MIHGenericTLVParser @@ -144,15 +144,15 @@ namespace senf { defaultInit(); maxLength( MIHTLVLengthParser::max_value); } - + using base::init; using base::maxLength; }; - - + + /** \brief Base class for list TLV parser - */ - struct MIHBaseListTLVParser + */ + struct MIHBaseListTLVParser : public MIHBaseTLVParser { # include SENF_PARSER() @@ -166,19 +166,19 @@ namespace senf { template struct MIHListTLVParserMixin { - void finalize(); + void finalize(); }; - - + + /** \brief Parse a MIHF_ID Note that the maximum length of a MIHF_ID is 253 octets (see F.3.11 in 802.21) We could set maxLength in init(), but for the most MIHF_IDs the default maximum length of 128 should be enough. - + \note you must call maxIdLength( 253) *before* setting MIHF_IDs values longer than 128. - + \see MIHFId */ class MIHFIdTLVParser : public MIHBaseTLVParser @@ -189,41 +189,41 @@ namespace senf { SENF_PARSER_LABEL ( idValue ); SENF_PARSER_SKIP ( idLength(), 0 ); SENF_PARSER_FINALIZE ( MIHFIdTLVParser ); - + public: ///\name Value setters ///@{ void value( MIHFId const & id); - + void value( std::string const & id ); void value( senf::MACAddress const & addr); void value( senf::INet4Address const & addr); void value( senf::INet6Address const & addr); - void value( senf::EUI64 const & addr); + void value( senf::EUI64 const & addr); ///@} ///\name Value getters ///@{ MIHFId valueAs( MIHFId::Type type) const; - + std::string valueAsString() const; senf::MACAddress valueAsMACAddress() const; senf::INet4Address valueAsINet4Address() const; senf::INet6Address valueAsINet6Address() const; senf::EUI64 valueAsEUI64() const; ///@} - + ///\name Value comparisons ///@{ bool valueEquals( MIHFId const & id) const; - + bool valueEquals( std::string const & id ) const; bool valueEquals( senf::MACAddress const & addr) const; bool valueEquals( senf::INet4Address const & addr) const; bool valueEquals( senf::INet6Address const & addr) const; bool valueEquals( senf::EUI64 const & addr) const; ///@} - + void dump(std::ostream & os) const; void maxIdLength(boost::uint8_t maxl) const; void finalize(); @@ -231,7 +231,7 @@ namespace senf { private: /// resize the packet after the length field to given size senf::safe_data_iterator resizeValueField(MIHTLVLengthParser::value_type size); - + data_iterator valueBegin() const; data_iterator valueEnd() const; @@ -241,9 +241,9 @@ namespace senf { void operator()(boost::uint8_t v); OutputIterator & i_; }; - + template - static boost::function_output_iterator > + static boost::function_output_iterator > getNAIEncodedOutputIterator(OutputIterator i); struct binaryNAIDecoder { @@ -251,11 +251,11 @@ namespace senf { bool operator()(boost::uint8_t v); bool readNextByte_; }; - + template - static boost::filter_iterator + static boost::filter_iterator getNAIDecodedIterator(Iterator begin, Iterator end); - + struct ValueSetterVisitor : public boost::static_visitor<> { MIHFIdTLVParser & parser; ValueSetterVisitor( MIHFIdTLVParser & p) : parser(p) {} @@ -267,7 +267,7 @@ namespace senf { parser.value( id); } }; - + struct ValueEqualsVisitor : public boost::static_visitor { MIHFIdTLVParser const & parser; ValueEqualsVisitor( MIHFIdTLVParser const & p) : parser(p) {} @@ -286,7 +286,7 @@ namespace senf { struct MIHFSrcIdTLVParser : public MIHFIdTLVParser { MIHFSrcIdTLVParser(data_iterator i, state_type s) : MIHFIdTLVParser(i,s) {} - + void init() const { defaultInit(); type() << typeId+0; @@ -294,13 +294,13 @@ namespace senf { static type_t::value_type const typeId = 1; void dump(std::ostream & os) const; }; - + /** \brief Parser for 802.21 destination MIHF_ID TLV */ struct MIHFDstIdTLVParser : public MIHFIdTLVParser { MIHFDstIdTLVParser(data_iterator i, state_type s) : MIHFIdTLVParser(i,s) {} - + void init() const { defaultInit(); type() << typeId+0; @@ -308,7 +308,7 @@ namespace senf { static type_t::value_type const typeId = 2; void dump(std::ostream & os) const; }; - + /** \brief Parser for 802.21 Status TLV */ struct MIHStatusTLVParser : public MIHBaseTLVParser @@ -317,7 +317,7 @@ namespace senf { SENF_PARSER_INHERIT ( MIHBaseTLVParser ); SENF_PARSER_FIELD ( value, UInt8Parser ); SENF_PARSER_FINALIZE( MIHStatusTLVParser ); - + SENF_PARSER_INIT() { defaultInit(); type() << typeId+0; @@ -325,36 +325,36 @@ namespace senf { } static type_t::value_type const typeId = 3; void dump(std::ostream & os) const; ///< dump string representation to given stream - - enum StatusCode { + + enum StatusCode { Success, UnspecifiedFailure, Rejected, AuthorizationFailure, NetworkError }; }; - + struct MIHRegisterReqCodeTLVParser : public MIHBaseTLVParser { # include SENF_PARSER() SENF_PARSER_INHERIT ( MIHBaseTLVParser ); SENF_PARSER_FIELD ( value, UInt8Parser ); SENF_PARSER_FINALIZE ( MIHRegisterReqCodeTLVParser ); - + SENF_PARSER_INIT() { defaultInit(); type() = typeId+0; length_() = 1; } - static type_t::value_type const typeId = 11; + static type_t::value_type const typeId = 11; void dump(std::ostream & os) const; ///< dump string representation to given stream - + enum RequestCode { Registration, ReRegistration }; }; - + struct MIHValidTimeIntervalTLVParser : public MIHBaseTLVParser { # include SENF_PARSER() SENF_PARSER_INHERIT ( MIHBaseTLVParser ); SENF_PARSER_FIELD ( value, UInt32Parser ); SENF_PARSER_FINALIZE ( MIHValidTimeIntervalTLVParser ); - + SENF_PARSER_INIT() { defaultInit(); type() = typeId+0; diff --git a/senf/Packets/80221Bundle/TLVParser.test.cc b/senf/Packets/80221Bundle/TLVParser.test.cc index 9c6d2c9..92788e5 100644 --- a/senf/Packets/80221Bundle/TLVParser.test.cc +++ b/senf/Packets/80221Bundle/TLVParser.test.cc @@ -75,19 +75,19 @@ SENF_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_extended_length) 0x01, // type 0x81, // first and last bit set => one byte length following 0x0A, // length (10 = 138 bytes value follows) - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, - 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, - 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, + 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, - 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, - 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, + 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, - 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, + 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89 }; PacketInterpreterBase::ptr p (PacketInterpreter::create(data)); @@ -207,7 +207,7 @@ SENF_AUTO_UNIT_TEST(TestMacAddressTLVPacket_create) 0x0c, // length 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67 // value }; - SENF_CHECK_EQUAL_COLLECTIONS( + SENF_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), tlvPacket.data().begin(), tlvPacket.data().end() ); } diff --git a/senf/Packets/ArrayParser.cti b/senf/Packets/ArrayParser.cti index c518389..012fbc2 100644 --- a/senf/Packets/ArrayParser.cti +++ b/senf/Packets/ArrayParser.cti @@ -89,7 +89,7 @@ ArrayParser_iterator(PacketParserBase::data_iterator const & i, PacketParserBase {} template -prefix_ ElementParser +prefix_ ElementParser senf::detail::ArrayParser_iterator::operator[](int i) const { @@ -107,7 +107,7 @@ senf::detail::ArrayParser_iterator::raw() // iterator_facade interface template -prefix_ ElementParser +prefix_ ElementParser senf::detail::ArrayParser_iterator::dereference() const { diff --git a/senf/Packets/AuxParser.cci b/senf/Packets/AuxParser.cci index b354214..454bf8d 100644 --- a/senf/Packets/AuxParser.cci +++ b/senf/Packets/AuxParser.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/AuxParser.cti b/senf/Packets/AuxParser.cti index e4f9832..cad2c32 100644 --- a/senf/Packets/AuxParser.cti +++ b/senf/Packets/AuxParser.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/AuxParser.hh b/senf/Packets/AuxParser.hh index cdba703..a3e68ba 100644 --- a/senf/Packets/AuxParser.hh +++ b/senf/Packets/AuxParser.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -51,7 +51,7 @@ namespace detail { typedef PrefixAuxParserPolicy ParserPolicy; static PacketParserBase::size_type const aux_bytes = P::fixed_bytes; - + typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; @@ -68,14 +68,14 @@ namespace detail { typedef FixedAuxParserPolicy ParserPolicy; static PacketParserBase::size_type const aux_bytes = 0; - + typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; }; template struct DynamicWrapperAuxParserPolicy; - + /** \brief Internal: Dynamic aux-parser policy Place auxiliary field at a variable distance before the container/collection @@ -90,7 +90,7 @@ namespace detail { DynamicAuxParserPolicy(P p); DynamicAuxParserPolicy(WrapperPolicy const & other); - + typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; @@ -112,7 +112,7 @@ namespace detail { static PacketParserBase::size_type const aux_bytes = 0; DynamicWrapperAuxParserPolicy(ParserPolicy const & other); - + typename P::value_type aux(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; void aux(typename P::value_type const & v, PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; PacketParserBase::data_iterator adjust(PacketParserBase::data_iterator i, PacketParserBase::state_type s) const; @@ -140,7 +140,7 @@ namespace detail { typedef TransformAuxParserPolicy ParserPolicy; static PacketParserBase::size_type const aux_bytes = Policy::aux_bytes; - + TransformAuxParserPolicy(); template TransformAuxParserPolicy(Arg const & arg); diff --git a/senf/Packets/AuxParser.test.cc b/senf/Packets/AuxParser.test.cc index 183ff89..241472e 100644 --- a/senf/Packets/AuxParser.test.cc +++ b/senf/Packets/AuxParser.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -89,7 +89,7 @@ SENF_AUTO_UNIT_TEST(vectorPacketSizeAuxPolicy_transformed) { UInt16VectorParser v (p.data().begin(), &p.data()); - + BOOST_REQUIRE_EQUAL( v.size(), p.data().size()/2 ); BOOST_CHECK_EQUAL( v[0], 0x1011u ); BOOST_CHECK_EQUAL( v[1], 0x1213u ); @@ -111,10 +111,10 @@ SENF_AUTO_UNIT_TEST(vectorPacketSizeAuxPolicy_transformed) w.erase(w.begin()+3, w.begin()+5); BOOST_CHECK_EQUAL( w.size(), p.data().size()/2 ); - senf::UInt16Parser::value_type data2[] = + senf::UInt16Parser::value_type data2[] = { 0x1011u, 0x0000u, 0x1213u, 0x2223u, 0x2425u }; - BOOST_CHECK_EQUAL_COLLECTIONS( w.begin(), w.end(), + BOOST_CHECK_EQUAL_COLLECTIONS( w.begin(), w.end(), data2, data2+sizeof(data2)/sizeof(data2[0]) ); } } @@ -154,10 +154,10 @@ SENF_AUTO_UNIT_TEST(listPacketSizeAuxPolicy) w.erase(boost::next(w.begin(),3), boost::next(w.begin(),5)); BOOST_CHECK_EQUAL( w.size(), p.data().size()/2 ); - senf::UInt16Parser::value_type data2[] = + senf::UInt16Parser::value_type data2[] = { 0x1011u, 0x0000u, 0x1213u, 0x2223u, 0x2425u }; - BOOST_CHECK_EQUAL_COLLECTIONS( w.begin(), w.end(), + BOOST_CHECK_EQUAL_COLLECTIONS( w.begin(), w.end(), data2, data2+sizeof(data2)/sizeof(data2[0]) ); } } diff --git a/senf/Packets/DataPacket.cc b/senf/Packets/DataPacket.cc index 3aba8ee..4f034cd 100644 --- a/senf/Packets/DataPacket.cc +++ b/senf/Packets/DataPacket.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/DefaultBundle/EthernetPacket.hh b/senf/Packets/DefaultBundle/EthernetPacket.hh index 8eed2ec..b38edfc 100644 --- a/senf/Packets/DefaultBundle/EthernetPacket.hh +++ b/senf/Packets/DefaultBundle/EthernetPacket.hh @@ -36,7 +36,7 @@ namespace senf { - /** \brief Parse an Ethernet MAC address + /** \brief Parse an Ethernet MAC address The ethernet MAC is returned by value as a 6-byte sequence @@ -46,7 +46,7 @@ namespace senf { struct MACAddressParser : public PacketParserBase { MACAddressParser(data_iterator i, state_type s) : PacketParserBase(i,s,fixed_bytes) {} - + /////////////////////////////////////////////////////////////////////////// typedef MACAddress value_type; @@ -59,7 +59,7 @@ namespace senf { MACAddressParser const & operator= (value_type const & other) { value(other); return *this; } }; - + /** \brief Parse an Ethernet packet Parser implementing an ethernet header. @@ -80,7 +80,7 @@ namespace senf { /** \brief EtherType registry This registry registers packet types with their EtherType number. - + \see Ethernet numbers \n \ref PacketRegistry */ @@ -121,7 +121,7 @@ namespace senf { static factory_t nextPacketType(packet p); /// Dump given EthernetPacket in readable form to given output stream - static void dump(packet p, std::ostream & os); + static void dump(packet p, std::ostream & os); static void finalize(packet p); }; @@ -130,9 +130,9 @@ namespace senf { */ typedef ConcretePacket EthernetPacket; - + /** \brief Parse an ethernet VLAN tag - + Parser interpreting the ethernet VLAN tag. Fields are \see EthVLanPacketType @@ -158,7 +158,7 @@ namespace senf { \par Fields: \ref EthVLanPacketParser \image html EthVLanPacket.png - + \par Associated registries: \ref EtherTypes @@ -168,7 +168,7 @@ namespace senf { \ingroup protocolbundle_default */ struct EthVLanPacketType - : public PacketTypeBase, + : public PacketTypeBase, public PacketTypeMixin { #ifndef DOXYGEN @@ -184,7 +184,7 @@ namespace senf { /** \todo Add LLC/SNAP support -> only use the registry for type() values >=1536, otherwise expect an LLC header */ - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->type(); } /// Dump given EthVLanPacket in readable form to given output stream diff --git a/senf/Packets/DefaultBundle/ICMPv6Packet.cc b/senf/Packets/DefaultBundle/ICMPv6Packet.cc index be0daf5..fa59596 100644 --- a/senf/Packets/DefaultBundle/ICMPv6Packet.cc +++ b/senf/Packets/DefaultBundle/ICMPv6Packet.cc @@ -37,21 +37,21 @@ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 58, senf::ICMPv6Packet); -prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum() +prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum() const { senf::IPv6Packet ipv6 (packet().rfind(senf::nothrow)); if (! ipv6) return 0u; - + senf::IpChecksum summer; //////////////////////////////////////// // IPv6 pseudo header - summer.feed( ipv6->source().i(), + summer.feed( ipv6->source().i(), ipv6->source().i() + senf::IPv6Packet::Parser::source_t::fixed_bytes ); // need support for HopByHop routing header -> the destination used here must be the *final* // destination ... - summer.feed( ipv6->destination().i(), + summer.feed( ipv6->destination().i(), ipv6->destination().i() + senf::IPv6PacketParser::destination_t::fixed_bytes ); // packet length boost::uint32_t size (data().size()); diff --git a/senf/Packets/DefaultBundle/ICMPv6Packet.hh b/senf/Packets/DefaultBundle/ICMPv6Packet.hh index c5c2694..7cba25e 100644 --- a/senf/Packets/DefaultBundle/ICMPv6Packet.hh +++ b/senf/Packets/DefaultBundle/ICMPv6Packet.hh @@ -31,7 +31,7 @@ //#include "ICMPv6Packet.mpp" ///////////////////////////////hh.p//////////////////////////////////////// -namespace senf +namespace senf { struct ICMPv6PacketParser : public PacketParserBase { @@ -39,12 +39,12 @@ namespace senf SENF_PARSER_FIELD ( type, UInt8Parser ); SENF_PARSER_FIELD ( code, UInt8Parser ); SENF_PARSER_FIELD ( checksum, UInt16Parser ); - + SENF_PARSER_FINALIZE ( ICMPv6PacketParser ); - + boost::uint16_t calcChecksum() const; }; - + struct ICMPTypes { // ICMP type registry typedef boost::uint8_t key_t; @@ -58,37 +58,37 @@ namespace senf \par Fields: \ref ICMPv6PacketParser \image html ICMPv6Packet.png - + \par Associated registries: \ref ICMPTypes \ingroup protocolbundle_default */ - struct ICMPv6PacketType + struct ICMPv6PacketType : public PacketTypeBase, public PacketTypeMixin { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6PacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); - - static key_t nextPacketKey(packet p) { + + static key_t nextPacketKey(packet p) { return p->type(); } - + static void finalize(packet p) { p->type() << key(p.next(senf::nothrow)); p->checksum() << p->calcChecksum(); } }; - + /** \brief ICMPv6 packet typedef \ingroup protocolbundle_default */ diff --git a/senf/Packets/DefaultBundle/ICMPv6Packet.test.cc b/senf/Packets/DefaultBundle/ICMPv6Packet.test.cc index 3502a61..228606b 100644 --- a/senf/Packets/DefaultBundle/ICMPv6Packet.test.cc +++ b/senf/Packets/DefaultBundle/ICMPv6Packet.test.cc @@ -56,7 +56,7 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) SENF_CHECK_NO_THROW( pListenerReport.dump( oss)); unsigned char dataListenerQuery[] = { - 0x82, 0x00, 0xf7, 0xd6, 0x27, 0x10, 0x00, 0x00, + 0x82, 0x00, 0xf7, 0xd6, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7d, 0x00, 0x00 @@ -70,7 +70,7 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pListenerQuery.next().size(), 24u ); SENF_CHECK_NO_THROW( pListenerQuery.dump( oss)); - + unsigned char dataEchoRequest[] = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07 }; @@ -83,11 +83,11 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pEchoRequest.next().size(), 4u ); SENF_CHECK_NO_THROW( pEchoRequest.dump( oss)); - + unsigned char dataEchoReply[] = { 0x81, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x4d }; - + senf::ICMPv6Packet pEchoReply ( senf::ICMPv6Packet::create(dataEchoReply) ); BOOST_CHECK_EQUAL( pEchoReply->type(), 0x81 ); BOOST_CHECK_EQUAL( pEchoReply->code(), 0x00 ); @@ -97,12 +97,12 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pEchoReply.next().size(), 4u ); SENF_CHECK_NO_THROW( pEchoReply.dump( oss)); - - + + unsigned char dataErrDestUnreachable[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + senf::ICMPv6Packet pErrDestUnreachable ( senf::ICMPv6Packet::create(dataErrDestUnreachable) ); BOOST_CHECK_EQUAL( pErrDestUnreachable->type(), 0x01 ); BOOST_CHECK_EQUAL( pErrDestUnreachable->code(), 0x00 ); @@ -112,12 +112,12 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pErrDestUnreachable.next().size(), 4u ); SENF_CHECK_NO_THROW( pErrDestUnreachable.dump( oss)); - - + + unsigned char dataErrTooBig[] = { - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd8 + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd8 }; - + senf::ICMPv6Packet pErrTooBig ( senf::ICMPv6Packet::create(dataErrTooBig) ); BOOST_CHECK_EQUAL( pErrTooBig->type(), 0x02 ); BOOST_CHECK_EQUAL( pErrTooBig->code(), 0x00 ); @@ -127,12 +127,12 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pErrTooBig.next().size(), 4u ); SENF_CHECK_NO_THROW( pErrTooBig.dump( oss)); - - + + unsigned char dataErrTimeExceeded[] = { 0x03, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + senf::ICMPv6Packet pErrTimeExceeded ( senf::ICMPv6Packet::create(dataErrTimeExceeded) ); BOOST_CHECK_EQUAL( pErrTimeExceeded->type(), 0x03 ); BOOST_CHECK_EQUAL( pErrTimeExceeded->code(), 0x63 ); @@ -142,12 +142,12 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pErrTimeExceeded.next().size(), 4u ); SENF_CHECK_NO_THROW( pErrTimeExceeded.dump( oss)); - - + + unsigned char dataErrParamProblem[] = { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + senf::ICMPv6Packet pErrParamProblem ( senf::ICMPv6Packet::create(dataErrParamProblem) ); BOOST_CHECK_EQUAL( pErrParamProblem->type(), 0x04 ); BOOST_CHECK_EQUAL( pErrParamProblem->code(), 0x01 ); @@ -157,7 +157,7 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) BOOST_CHECK_EQUAL( pErrParamProblem.next().size(), 4u ); SENF_CHECK_NO_THROW( pErrParamProblem.dump( oss)); - + unsigned char dataRouterSolicitation[] = { 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -263,14 +263,14 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_packet) SENF_AUTO_UNIT_TEST(ICMPv6Packet_create) { std::ostringstream oss (std::ostringstream::out); - + unsigned char ping[] = { 0x60, 0x00, 0x00, 0x00, 0x00, 0x40, 0x3a, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0xda, 0xe0, 0x9f, 0x7e, 0x00, 0x09, - + 0xb7, 0x3c, 0xbb, 0x4a, 0x9d, 0x90, 0x0a, 0x00, //payload 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -287,7 +287,7 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_create) senf::ICMPv6Packet icmp (senf::ICMPv6Packet::createAfter(ip)); icmp->code() = 0; - + senf::ICMPv6EchoRequest ereq (senf::ICMPv6EchoRequest::createAfter(icmp)); ereq->identifier() = 0x9f7e; ereq->seqNr() = 9; @@ -296,7 +296,7 @@ SENF_AUTO_UNIT_TEST(ICMPv6Packet_create) senf::DataPacket::createAfter(ereq, std::make_pair(ping+48, ping+sizeof(ping)))); ip.finalizeAll(); - + SENF_CHECK_NO_THROW (ip.dump( oss )); std::string dump ( diff --git a/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc b/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc index 1f014e2..c5950f1 100644 --- a/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc +++ b/senf/Packets/DefaultBundle/ICMPv6TypePacket.cc @@ -62,25 +62,25 @@ prefix_ void senf::ICMPv6EchoReplyType::dump(packet p, std::ostream & os) prefix_ void senf::ICMPv6ErrDestUnreachableType::dump(packet p, std::ostream & os) { - os << "ICMPv6 Error Destination Unreachable (no further fields available here)\n"; + os << "ICMPv6 Error Destination Unreachable (no further fields available here)\n"; } prefix_ void senf::ICMPv6ErrTooBigType::dump(packet p, std::ostream & os) { os << "ICMPv6 Error Packet Too Big:\n" - << senf::fieldName("MTU") << unsigned(p->mtu() ) << "\n"; + << senf::fieldName("MTU") << unsigned(p->mtu() ) << "\n"; } prefix_ void senf::ICMPv6ErrTimeExceededType::dump(packet p, std::ostream & os) { os << "ICMPv6 Error Time Exceeded:\n" - << senf::fieldName("Unused(32Bit)") << unsigned(p->unused() ) << "\n"; + << senf::fieldName("Unused(32Bit)") << unsigned(p->unused() ) << "\n"; } prefix_ void senf::ICMPv6ErrParamProblemType::dump(packet p, std::ostream & os) { os << "ICMPv6 Error Parameter Problem:\n" - << senf::fieldName("Pointer") << unsigned(p->pointer() ) << "\n"; + << senf::fieldName("Pointer") << unsigned(p->pointer() ) << "\n"; } prefix_ void senf::MLDv2ListenerQueryType::dump(packet p, std::ostream & os) @@ -97,16 +97,16 @@ prefix_ void senf::MLDv2ListenerQueryType::dump(packet p, std::ostream & os) senf::MLDv2ListenerQuery::Parser::srcAddresses_t::container c (p->srcAddresses()); senf::MLDv2ListenerQuery::Parser::srcAddresses_t::container::iterator i (c.begin()); for (unsigned int nr =1; i != c.end(); ++i, ++nr) - os << " " << nr << ".) " << *i << "\n"; - os << "\n"; + os << " " << nr << ".) " << *i << "\n"; + os << "\n"; } prefix_ void senf::MLDv2ListenerReportType::dump(packet p, std::ostream & os) { os << "ICMPv6 Multicast Listener Report Message:\n" - << senf::fieldName("Reserved") << unsigned(p->reserved() ) + << senf::fieldName("Reserved") << unsigned(p->reserved() ) <<"\n Multicast Address Records:\n"; - + senf::MLDv2ListenerReport::Parser::mcastAddrRecords_t::container cAddrR (p->mcastAddrRecords() ); senf::MLDv2ListenerReport::Parser::mcastAddrRecords_t::container::iterator iAddrR (cAddrR.begin() ); for (; iAddrR != cAddrR.end(); ++iAddrR) { diff --git a/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh b/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh index 78daaef..a51fca2 100644 --- a/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh +++ b/senf/Packets/DefaultBundle/ICMPv6TypePacket.hh @@ -43,10 +43,10 @@ namespace senf { # include SENF_FIXED_PARSER() SENF_PARSER_FIELD ( identifier, UInt16Parser ); SENF_PARSER_FIELD ( seqNr, UInt16Parser ); - + SENF_PARSER_FINALIZE ( ICMPv6EchoRequestParser ); }; - + /** \brief ICMPv6 Echo Request \par Packet type (typedef): @@ -65,16 +65,16 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6EchoRequestParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; static void dump(packet p, std::ostream & os); }; - + typedef ConcretePacket ICMPv6EchoRequest; - + //############################################################# //ICMPv6 Echo Reply //############################################################# @@ -83,10 +83,10 @@ namespace senf { # include SENF_FIXED_PARSER() SENF_PARSER_FIELD ( identifier, UInt16Parser ); SENF_PARSER_FIELD ( seqNr, UInt16Parser ); - + SENF_PARSER_FINALIZE ( ICMPv6EchoReplyParser ); }; - + /** \brief ICMPv6 Echo Reply \par Packet type (typedef): @@ -105,28 +105,28 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6EchoReplyParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; - + typedef ConcretePacket ICMPv6EchoReply; - + //############################################################# //ICMPv6 Error Destination Unreachable Message //############################################################# struct ICMPv6ErrDestUnreachableParser : public PacketParserBase { # include SENF_FIXED_PARSER() - + //should be set static 0 by sender and ignored by receiver SENF_PARSER_PRIVATE_FIELD ( unused, UInt32Parser ); - - SENF_PARSER_INIT() { - unused() = 0; + + SENF_PARSER_INIT() { + unused() = 0; } /* Code 0 - No route to destination 1 - Communication with destination @@ -140,10 +140,10 @@ namespace senf { ICMPv6Packet icmpv6 (senf::Packet().rfind(senf::nothrow)); icmpv6->code() = code; } - + SENF_PARSER_FINALIZE ( ICMPv6ErrDestUnreachableParser ); }; - + /** \brief ICMPv6 Destination unreachable \par Packet type (typedef): @@ -152,7 +152,7 @@ namespace senf { \par Fields: \ref ICMPv6ErrDestUnreachableParser \image html ICMPv6ErrDestUnreachable.png - + \ingroup protocolbundle_default */ struct ICMPv6ErrDestUnreachableType @@ -162,16 +162,16 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6ErrDestUnreachableParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; - + typedef ConcretePacket ICMPv6ErrDestUnreachable; - + //############################################################# //ICMPv6 Error Packet Too Big Message //############################################################# @@ -179,16 +179,16 @@ namespace senf { { # include SENF_FIXED_PARSER() SENF_PARSER_FIELD ( mtu, UInt32Parser ); - + /* Code static set to 0 */ SENF_PARSER_INIT() { ICMPv6Packet icmpv6 (packet().rfind(senf::nothrow)); icmpv6->code() = 0; } - + SENF_PARSER_FINALIZE ( ICMPv6ErrTooBigParser ); }; - + /** \brief ICMPv6 Packet to big \par Packet type (typedef): @@ -207,16 +207,16 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6ErrTooBigParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; typedef ConcretePacket ICMPv6ErrTooBig; - + //############################################################# //ICMPv6 Error Time Exceeded Message //############################################################# @@ -232,10 +232,10 @@ namespace senf { ICMPv6Packet icmpv6 (packet().rfind(senf::nothrow)); icmpv6->code() = code; } - + SENF_PARSER_FINALIZE ( ICMPv6ErrTimeExceededParser ); }; - + /** \brief ICMPv6 Time exceeded \par Packet type (typedef): @@ -254,15 +254,15 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6ErrTimeExceededParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; typedef ConcretePacket ICMPv6ErrTimeExceeded; - + //############################################################# //ICMPv6 Error Parameter Problem Message //############################################################# @@ -274,7 +274,7 @@ namespace senf { /* Code 0 - Erroneous header field encountered 1 - Unrecognized Next Header type encountered 2 - Unrecognized IPv6 option encountered */ - + void setErrCode(int code) { ICMPv6Packet icmpv6 (packet().rfind(senf::nothrow)); @@ -282,7 +282,7 @@ namespace senf { } SENF_PARSER_FINALIZE ( ICMPv6ErrParamProblemParser ); }; - + /** \brief ICMPv6 Parameter problem \par Packet type (typedef): @@ -301,15 +301,15 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef ICMPv6ErrParamProblemParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; typedef ConcretePacket ICMPv6ErrParamProblem; - + //############################################################# //ICMPv6 MLDv2 (RFC 3810) Multicast Listener Query //############################################################# @@ -319,13 +319,13 @@ namespace senf { //need a variant here // a.) maxResponseCode < 32768 =>Interger // b.) maxResponseCode >=32768 => float (is there a float parser???) - /* - float value as followed: + /* + float value as followed: 0 1 2 3 4 5 6 7 8 9 A B C D E F +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| exp | mant | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - + SENF_PARSER_FIELD ( maxResponseCode, UInt16Parser ); SENF_PARSER_FIELD ( reserved, UInt16Parser ); // set to zero by default SENF_PARSER_FIELD ( mcAddress, INet6AddressParser ); @@ -335,15 +335,15 @@ namespace senf { SENF_PARSER_FIELD ( qqic, UInt8Parser ); SENF_PARSER_PRIVATE_FIELD ( nrSources, UInt16Parser ); SENF_PARSER_VECTOR (srcAddresses, nrSources, INet6AddressParser ); - + SENF_PARSER_FINALIZE ( MLDv2ListenerQueryParser ); - - SENF_PARSER_INIT() { - reserved() = 0; + + SENF_PARSER_INIT() { + reserved() = 0; resv() = 0; } }; - + /** \brief MLDv2 Listener query \par Packet type (typedef): @@ -362,16 +362,16 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef MLDv2ListenerQueryParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; - + typedef ConcretePacket MLDv2ListenerQuery; - + //############################################################# //ICMPv6 MLDv2 (RFC 3810) Multicast Listener Report Message //############################################################# @@ -379,32 +379,32 @@ namespace senf { struct MLDv2AddressRecordParser : public PacketParserBase { # include SENF_PARSER() - + SENF_PARSER_FIELD ( recordType, UInt8Parser ); SENF_PARSER_PRIVATE_FIELD ( auxDataLen, UInt8Parser ); SENF_PARSER_PRIVATE_FIELD ( nrOfSrcs, UInt16Parser ); SENF_PARSER_FIELD ( mcAddress, INet6AddressParser); SENF_PARSER_VECTOR ( srcAddresses, nrOfSrcs, INet6AddressParser ); SENF_PARSER_VECTOR ( auxData, auxDataLen, UInt32Parser ); - + SENF_PARSER_FINALIZE ( MLDv2AddressRecordParser ); }; - + struct MLDv2ListenerReportParser : public PacketParserBase { # include SENF_PARSER() - + SENF_PARSER_FIELD ( reserved, UInt16Parser ); //set to zero by default SENF_PARSER_PRIVATE_FIELD ( nrMcastAddrRecords_, UInt16Parser ); SENF_PARSER_LIST ( mcastAddrRecords, nrMcastAddrRecords_, MLDv2AddressRecordParser ); - + SENF_PARSER_FINALIZE ( MLDv2ListenerReportParser ); - - SENF_PARSER_INIT() { - reserved() = 0; + + SENF_PARSER_INIT() { + reserved() = 0; } }; - + /** \brief MLDv2 Listener report \par Packet type (typedef): @@ -424,11 +424,11 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef MLDv2ListenerReportParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; typedef ConcretePacket MLDv2ListenerReport; diff --git a/senf/Packets/DefaultBundle/IPv4Packet.hh b/senf/Packets/DefaultBundle/IPv4Packet.hh index 898620b..819e080 100644 --- a/senf/Packets/DefaultBundle/IPv4Packet.hh +++ b/senf/Packets/DefaultBundle/IPv4Packet.hh @@ -52,16 +52,16 @@ namespace senf { void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); } operator value_type() const { return value(); } byte & operator[](size_type index) const { return *boost::next(i(),index); } - INet4AddressParser const & operator= (value_type const & other) + INet4AddressParser const & operator= (value_type const & other) { value(other); return *this; } }; /** \brief Parse an IPv4 packet Parser implementing the IPv4 header. - + \image html IPv4Packet.png - + \see IPv4PacketType \n RFC 791 @@ -96,7 +96,7 @@ namespace senf { } SENF_PARSER_FINALIZE(IPv4PacketParser); - + boost::uint16_t calcChecksum() const; ///< calculate header checksum /**< calculate and return the checksum of the header \see \ref senf::IpChecksum */ @@ -104,8 +104,8 @@ namespace senf { bool validateChecksum() const { return checksum() == calcChecksum(); } ///< validate header checksum - /**< return \c true if the \ref checksum() "checksum" - field is equal to the \ref calcChecksum() + /**< return \c true if the \ref checksum() "checksum" + field is equal to the \ref calcChecksum() "calculated checksum" */ }; @@ -121,7 +121,7 @@ namespace senf { }; /** \brief IPv4 packet - + \par Packet type (typedef): \ref IPv4Packet @@ -139,7 +139,7 @@ namespace senf { \ref IPv4PacketParser::version() "Version" \ref IPv4PacketParser::ihl() "IHL" \ref IPv4PacketParser::tos() "TOS"\ref IPv4PacketParser::length() "Length"\ref IPv4PacketParser::length() "Length"
\ref IPv4PacketParser::identifier() "Identifier" R
- + \par Associated registries: \ref IpTypes @@ -138,17 +138,17 @@ namespace senf { using mixin::initSize; using mixin::init; - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->nextHeader(); } - + /** \brief Dump given IPv6Packet in readable form to given output stream */ - static void dump(packet p, std::ostream & os); - + static void dump(packet p, std::ostream & os); + static void finalize(packet p); ///< Finalize packet. - /**< \li set \ref IPv6PacketParser::length() "length" + /**< \li set \ref IPv6PacketParser::length() "length" from payload size - \li set \ref IPv6PacketParser::nextHeader() - "nextHeader" from type of next packet if found + \li set \ref IPv6PacketParser::nextHeader() + "nextHeader" from type of next packet if found in \ref IpTypes */ }; diff --git a/senf/Packets/DefaultBundle/IPv6Packet.test.cc b/senf/Packets/DefaultBundle/IPv6Packet.test.cc index 53a6afc..13f2d52 100644 --- a/senf/Packets/DefaultBundle/IPv6Packet.test.cc +++ b/senf/Packets/DefaultBundle/IPv6Packet.test.cc @@ -39,14 +39,14 @@ SENF_AUTO_UNIT_TEST(ipV6Packet_parse) { - unsigned char data[] = { + unsigned char data[] = { 0x60, 0x12, 0x20, 0x30, 0x00, 0x01, 0x03, 0x04, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0xff + 0xff }; senf::IPv6Packet p (senf::IPv6Packet::create(data)); @@ -79,10 +79,10 @@ SENF_AUTO_UNIT_TEST(ipV6Packet_create) ip->hopLimit() = 0x04u; ip->source() = senf::INet6Address::from_string("1011:1213:1415:1617:1819:1a1b:1c1d:1e1f"); ip->destination() = senf::INet6Address::from_string("2021:2223:2425:2627:2829:2a2b:2c2d:2e2f"); - + ip.finalizeAll(); - - unsigned char data[] = { + + unsigned char data[] = { 0x60, 0x12, 0x20, 0x30, 0x00, 0x00, 0x3b, 0x04, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -90,7 +90,7 @@ SENF_AUTO_UNIT_TEST(ipV6Packet_create) 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f }; - BOOST_CHECK_EQUAL_COLLECTIONS( + BOOST_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), ip.data().begin(), ip.data().end() ); } diff --git a/senf/Packets/DefaultBundle/ListOptionTypeParser.cti b/senf/Packets/DefaultBundle/ListOptionTypeParser.cti index 82297ca..81266cf 100644 --- a/senf/Packets/DefaultBundle/ListOptionTypeParser.cti +++ b/senf/Packets/DefaultBundle/ListOptionTypeParser.cti @@ -44,7 +44,7 @@ template prefix_ senf::detail::ListOptionTypeParser_Policy:: ListOptionTypeParser_Policy(Arg const & arg) - : AuxPolicy(arg) + : AuxPolicy(arg) {} template @@ -88,7 +88,7 @@ template prefix_ senf::detail::ListOptionTypeParser_Policy::container_policy:: container_policy(parser_policy const & p) - : AuxPolicy(p) + : AuxPolicy(p) {} //destructor diff --git a/senf/Packets/DefaultBundle/LlcSnapPacket.cc b/senf/Packets/DefaultBundle/LlcSnapPacket.cc index c3875ba..8b09238 100644 --- a/senf/Packets/DefaultBundle/LlcSnapPacket.cc +++ b/senf/Packets/DefaultBundle/LlcSnapPacket.cc @@ -42,7 +42,7 @@ prefix_ void senf::LlcSnapPacketType::dump(packet p, std::ostream & os) << senf::fieldName(" dsap") << "0x" << unsigned(p->dsap()) << "\n" << senf::fieldName(" ssap") << "0x" << unsigned(p->ssap()) << "\n" << senf::fieldName(" control id") << "0x" << unsigned(p->ctrl()) << "\n" - << " SNAP\n" + << " SNAP\n" << senf::fieldName(" protocol id") << "0x" << std::setw(6) << unsigned(p->protocolId()) << "\n" << senf::fieldName(" type/length") << "0x" << std::setw(4) << unsigned(p->type_length()) << "\n"; } diff --git a/senf/Packets/DefaultBundle/LlcSnapPacket.hh b/senf/Packets/DefaultBundle/LlcSnapPacket.hh index 9f0993d..ff6104e 100644 --- a/senf/Packets/DefaultBundle/LlcSnapPacket.hh +++ b/senf/Packets/DefaultBundle/LlcSnapPacket.hh @@ -37,7 +37,7 @@ namespace senf { /** \brief Parse a LLC/SNAP header - + \image html LlcSnapPacket.png \todo document me */ @@ -53,7 +53,7 @@ namespace senf { SENF_PARSER_FIELD( type_length, UInt16Parser ); SENF_PARSER_FINALIZE(LlcSnapPacketParser); - + SENF_PARSER_INIT() { dsap() = 0xaa; ssap() = 0xaa; @@ -81,7 +81,7 @@ namespace senf { \ingroup protocolbundle_default */ struct LlcSnapPacketType - : public PacketTypeBase, + : public PacketTypeBase, public PacketTypeMixin { #ifndef DOXYGEN @@ -93,10 +93,10 @@ namespace senf { using mixin::nextPacketRange; using mixin::initSize; using mixin::init; - + static factory_t nextPacketType(packet p); /** \brief Dump given LlcSnapPacket in readable form to given output stream */ - static void dump(packet p, std::ostream & os); + static void dump(packet p, std::ostream & os); static void finalize(packet p); }; diff --git a/senf/Packets/DefaultBundle/RTPPacket.cc b/senf/Packets/DefaultBundle/RTPPacket.cc index afe5cd5..1e4b408 100644 --- a/senf/Packets/DefaultBundle/RTPPacket.cc +++ b/senf/Packets/DefaultBundle/RTPPacket.cc @@ -20,7 +20,7 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -/** \file +/** \file \brief RTPPacket non-inline non-template implementation */ #include "RTPPacket.hh" @@ -31,7 +31,7 @@ #define prefix_ -namespace +namespace { std::string ptName(int pt) { @@ -56,7 +56,7 @@ namespace return ptList[n].name; ++n; } - + return "UNKNOWN"; } } @@ -70,7 +70,7 @@ prefix_ void senf::RTPPacketType::dump(packet p, std::ostream &os) << senf::fieldName("extension") << p->extension() << "\n" << senf::fieldName("contributing source cnt") << p->csrcCount() << "\n" << senf::fieldName("marker") << p->marker() << "\n" - << senf::fieldName("payload type") << p->payloadType() << " " + << senf::fieldName("payload type") << p->payloadType() << " " << ptName(p->payloadType() ) <<"\n" << senf::fieldName("sequence number") << p->seqNumber() << "\n" << senf::fieldName("timestamp") << p->timeStamp() << "\n" diff --git a/senf/Packets/DefaultBundle/RTPPacket.hh b/senf/Packets/DefaultBundle/RTPPacket.hh index c588ab9..39aaaeb 100644 --- a/senf/Packets/DefaultBundle/RTPPacket.hh +++ b/senf/Packets/DefaultBundle/RTPPacket.hh @@ -32,7 +32,7 @@ namespace senf { - + struct RTPPacketParser : public PacketParserBase { # include SENF_PARSER() @@ -46,26 +46,26 @@ namespace senf { SENF_PARSER_FIELD ( timeStamp, UInt32Parser ); //signals sampling time of 1st byte of payload; initialised; used to calculate Jitter between segments SENF_PARSER_FIELD ( synSourceId, UInt32Parser ); //Synchronisation source identifier; identifier of RFTP stream source (random number) in case of conferencing identifier of mixer SENF_PARSER_VECTOR (csrcOpt, csrcCount, UInt32Parser ); - + bool valid() const {return version() == 2;} SENF_PARSER_FINALIZE(RTPPacketParser); }; - - struct RTPPacketType + + struct RTPPacketType : public PacketTypeBase, public PacketTypeMixin { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef RTPPacketParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream &os); }; - + typedef RTPPacketType::packet RTPPacket; } diff --git a/senf/Packets/DefaultBundle/TCPPacket.hh b/senf/Packets/DefaultBundle/TCPPacket.hh index 3376343..f3ebf2e 100644 --- a/senf/Packets/DefaultBundle/TCPPacket.hh +++ b/senf/Packets/DefaultBundle/TCPPacket.hh @@ -163,7 +163,7 @@ namespace senf { "checksum" */ }; - /** \brief TCP packet typedef + /** \brief TCP packet typedef \ingroup protocolbundle_default */ typedef ConcretePacket TCPPacket; diff --git a/senf/Packets/DefaultBundle/TCPPacket.test.cc b/senf/Packets/DefaultBundle/TCPPacket.test.cc index 702088d..7466c9f 100644 --- a/senf/Packets/DefaultBundle/TCPPacket.test.cc +++ b/senf/Packets/DefaultBundle/TCPPacket.test.cc @@ -107,11 +107,11 @@ SENF_AUTO_UNIT_TEST(tcpPacket_in_ipv6_parse) 0x60, 0xa0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x20, 0x01, 0x06, 0x38, 0x04, 0x08, 0x02, 0x01, 0xef, 0xdc, 0x71, 0x52, 0x17, 0x2c, 0x44, 0x3e, - + // 20 Byte TCP-Header without Options 0x00, 0x50, 0xac, 0x3e, 0x82, 0x99, 0x60, 0xa6, 0xa4, 0xfa, 0x32, 0x83, 0x50, 0x18, 0x19, 0x20, 0xd7, 0xcd, 0x00, 0x00, - + // TCP-Payload 0x1a, 0x01, 0x52, 0x0e, 0x26, 0x6f, 0xac, 0xd9, 0x78, 0x0c, 0x3c, 0x69, 0x3c, 0xa6, 0x49, 0xc6, 0x85, 0xc2, 0xa9, 0x72, 0x75, 0x9a, @@ -144,7 +144,7 @@ SENF_AUTO_UNIT_TEST(tcpPacket_in_ipv6_create) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - + // TCP-Header + TCP-Payload 0x5b, 0xa0, 0x30, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, diff --git a/senf/Packets/DefaultBundle/UDPPacket.cc b/senf/Packets/DefaultBundle/UDPPacket.cc index d1ff6c2..4e30c47 100644 --- a/senf/Packets/DefaultBundle/UDPPacket.cc +++ b/senf/Packets/DefaultBundle/UDPPacket.cc @@ -20,7 +20,7 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -/** \file +/** \file \brief UDPPacket non-inline non-template implementation */ #include "UDPPacket.hh" @@ -52,26 +52,26 @@ prefix_ boost::uint16_t senf::UDPPacketParser::calcChecksum() IPv4Packet ipv4 (packet().rfind(nothrow)); if (ipv4) { // Pseudo header defined in RFC768 - summer.feed( ipv4->source().i(), + summer.feed( ipv4->source().i(), ipv4->source().i() + IPv4Packet::Parser::source_t::fixed_bytes ); ///\fixme What about a hop-by-hop routing option? Which destination is used in IPv4 ? - summer.feed( ipv4->destination().i(), + summer.feed( ipv4->destination().i(), ipv4->destination().i() + IPv4PacketParser::destination_t::fixed_bytes ); summer.feed( 0u ); ///\fixme May there be another header between the IPv4 header and UDP? if so, we /// need to hack the correct protocol number here ... summer.feed( 17u ); summer.feed( i() + length_offset, i() + length_offset + 2 ); - } + } else { // Pseudo header defined in RFC2460 IPv6Packet ipv6 (packet().rfind(nothrow)); if (ipv6) { - summer.feed( ipv6->source().i(), + summer.feed( ipv6->source().i(), ipv6->source().i() + IPv6Packet::Parser::source_t::fixed_bytes ); ///\todo Implement routing header support // The destination used here must be the *final* destination ... - summer.feed( ipv6->destination().i(), + summer.feed( ipv6->destination().i(), ipv6->destination().i() + IPv6PacketParser::destination_t::fixed_bytes ); // This is a simplification. The value is really 32bit to support UDP Jumbograms // (RFC2147). However, skipping an even number of 0 bytes does not change the checksum @@ -82,8 +82,8 @@ prefix_ boost::uint16_t senf::UDPPacketParser::calcChecksum() summer.feed( 17u ); } } - - // since header are 16 / even 32bit aligned we don't have to care for padding. since IpChecksum + + // since header are 16 / even 32bit aligned we don't have to care for padding. since IpChecksum // cares for padding at the final summing we don't have to care is the payload is 16nbit-aligned, too. summer.feed( i(), i()+checksum_offset ); summer.feed( i()+checksum_offset+2, data().end() ); diff --git a/senf/Packets/DefaultBundle/UDPPacket.hh b/senf/Packets/DefaultBundle/UDPPacket.hh index 2914a48..77788d8 100644 --- a/senf/Packets/DefaultBundle/UDPPacket.hh +++ b/senf/Packets/DefaultBundle/UDPPacket.hh @@ -38,7 +38,7 @@ namespace senf { Parser implementing the UDP header. The fields implemented are: \image html UDPPacket.png - + \see UDPPacketType \n RFC 768 */ @@ -64,7 +64,7 @@ namespace senf { }; /** \brief UDP packet - + \par Packet type (typedef): \ref UDPPacket @@ -83,7 +83,7 @@ namespace senf {
\ref UDPPacketParser::checksum() "Checksum"
- + \par Finalize action: \copydetails finalize() @@ -105,15 +105,15 @@ namespace senf { /** \brief Dump given UDPPacket in readable form to given output stream */ static void dump(packet p, std::ostream & os); - + static void finalize(packet p); ///< Finalize packet. - /**< \li set \ref UDPPacketParser::length() "length" from + /**< \li set \ref UDPPacketParser::length() "length" from payload size - \li calculate and set \ref UDPPacketParser::checksum() + \li calculate and set \ref UDPPacketParser::checksum() "checksum" */ }; - /** \brief UDP packet typedef + /** \brief UDP packet typedef \ingroup protocolbundle_default */ typedef ConcretePacket UDPPacket; diff --git a/senf/Packets/DefaultBundle/UDPPacket.test.cc b/senf/Packets/DefaultBundle/UDPPacket.test.cc index 12c5171..907c180 100644 --- a/senf/Packets/DefaultBundle/UDPPacket.test.cc +++ b/senf/Packets/DefaultBundle/UDPPacket.test.cc @@ -40,7 +40,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_parse) { - unsigned char data[] = { + unsigned char data[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; @@ -57,12 +57,12 @@ SENF_AUTO_UNIT_TEST(udpPacket_parse) SENF_AUTO_UNIT_TEST(udpPacket_in_ipv4_create) { - unsigned char data[] = { + unsigned char data[] = { 0x45, 0x00, 0x00, 0x26, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, 0x3c, 0xc5, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01, 0x5b, 0xa0, 0x30, 0x39, 0x00, 0x12, 0xfa, 0x6e, 0x54, 0x45, 0x53, 0x54, - 0x2d, 0x57, 0x52, 0x49, 0x54, 0x45 + 0x2d, 0x57, 0x52, 0x49, 0x54, 0x45 }; senf::IPv4Packet ip (senf::IPv4Packet::create()); @@ -81,7 +81,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv4_create) BOOST_CHECK( udp->validateChecksum() ); ip.finalizeAll(); - BOOST_CHECK_EQUAL_COLLECTIONS( + BOOST_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), ip.data().begin(), ip.data().end() ); BOOST_CHECK( udp->validateChecksum() ); } @@ -89,7 +89,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv4_create) SENF_AUTO_UNIT_TEST(udpPacket_in_ipv6_parse) { // captured udp packet generated with mgen send over ipv6 - unsigned char data[] = { + unsigned char data[] = { // IPv6 Packet 0x60, 0x00, 0x00, 0x00, 0x00, 0x32, 0x11, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -104,7 +104,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv6_parse) 0x00, 0x09, 0x5b, 0x37, 0x13, 0x88, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00 + 0x00, 0x00 }; senf::IPv6Packet ip (senf::IPv6Packet::create(data)); @@ -113,18 +113,18 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv6_parse) BOOST_CHECK_EQUAL( ip->hopLimit(), 64u ); BOOST_CHECK_EQUAL( ip->source().value(), senf::INet6Address::Loopback ); BOOST_CHECK_EQUAL( ip->destination().value(), senf::INet6Address::Loopback ); - + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( ip.dump( oss)); - + BOOST_REQUIRE( ip.next().is() ); senf::UDPPacket udp (ip.next().as()); - + BOOST_CHECK_EQUAL( udp->source(), 5001u ); BOOST_CHECK_EQUAL( udp->destination(), 5000u ); BOOST_CHECK_EQUAL( udp->length(), 50u ); BOOST_CHECK_EQUAL( udp->checksum(), 0x1123 ); - + BOOST_CHECK( udp->validateChecksum() ); } diff --git a/senf/Packets/DefaultBundle/extra_tests/PacketLink.test.cc b/senf/Packets/DefaultBundle/extra_tests/PacketLink.test.cc index 9d4f7d8..fa0f290 100644 --- a/senf/Packets/DefaultBundle/extra_tests/PacketLink.test.cc +++ b/senf/Packets/DefaultBundle/extra_tests/PacketLink.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,13 +45,13 @@ SENF_AUTO_UNIT_TEST(packetLink) 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // target mac 0x86, 0xdd, // ethertype - 0x60, 0x00, 0x00, 0x00, // IP version, class, + 0x60, 0x00, 0x00, 0x00, // IP version, class, // flow label 0x00, 0x00, // payload length 0x3B, // no next header 0x10, // hop limit 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // source ip - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // target ip 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; diff --git a/senf/Packets/DumpFormat.cc b/senf/Packets/DumpFormat.cc index de102c7..3c41aba 100644 --- a/senf/Packets/DumpFormat.cc +++ b/senf/Packets/DumpFormat.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/DumpFormat.hh b/senf/Packets/DumpFormat.hh index cb3e09d..79a832f 100644 --- a/senf/Packets/DumpFormat.hh +++ b/senf/Packets/DumpFormat.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -41,7 +41,7 @@ namespace senf { std::string fieldName(std::string const & s); - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Packets/DumpFormat.test.cc b/senf/Packets/DumpFormat.test.cc index 31e7532..3f5dea5 100644 --- a/senf/Packets/DumpFormat.test.cc +++ b/senf/Packets/DumpFormat.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/GenericTLV.ct b/senf/Packets/GenericTLV.ct index 6605618..e405ce7 100644 --- a/senf/Packets/GenericTLV.ct +++ b/senf/Packets/GenericTLV.ct @@ -40,7 +40,7 @@ template template prefix_ Parser senf::GenericTLVParserBase::init() -{ +{ senf::PacketParserBase::size_type oldSize (bytes() ); senf::PacketParserBase::size_type newParserSize ( senf::init_bytes::value ); this->resize( oldSize, newParserSize); @@ -53,7 +53,7 @@ prefix_ Parser senf::GenericTLVParserBase::init() template prefix_ void senf::GenericTLVParserBase::dump(std::ostream & os) - const + const { if (Base::Registry::instance().isRegistered( *this)) { Base::Registry::instance().dump( *this, os); @@ -68,8 +68,8 @@ prefix_ void senf::GenericTLVParserBase::dump(std::ostream & os) } template -prefix_ senf::PacketInterpreterBase::range senf::GenericTLVParserBase::value() - const +prefix_ senf::PacketInterpreterBase::range senf::GenericTLVParserBase::value() + const { senf::PacketData::iterator begin ( boost::next(this->i(), senf::bytes( self())) ); return PacketInterpreterBase::range(begin, boost::next( begin, this->length()) ); @@ -146,7 +146,7 @@ prefix_ senf::PacketParserBase::size_type senf::GenericTLVParserRegistry prefix_ void senf::GenericTLVParserBase::value( ForwardReadableRange const & val, typename boost::disable_if >::type *) -{ - value_( val); +{ + value_( val); } template @@ -95,8 +95,8 @@ template prefix_ void senf::GenericTLVParserBase::value( std::pair const & val, typename boost::disable_if >::type *) -{ - value_( val); +{ + value_( val); } template @@ -104,9 +104,9 @@ template prefix_ void senf::GenericTLVParserBase::value( std::pair const & val, typename boost::enable_if >::type *) -{ +{ this->type() = val.first; - value_( val.second); + value_( val.second); } #endif diff --git a/senf/Packets/GenericTLV.hh b/senf/Packets/GenericTLV.hh index db0708f..81513bb 100644 --- a/senf/Packets/GenericTLV.hh +++ b/senf/Packets/GenericTLV.hh @@ -36,13 +36,13 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - + /** \brief Base class for generic TLV parsers - + This abstract base class can be used to define generic TLV parsers. The following class structure is assumed: \image html GenericTLV.png - + Your TLVParser base class has to define a \c type and a \c length field: \code struct MyTLVParserBase : public senf::PacketParserBase @@ -53,7 +53,7 @@ namespace senf { SENF_PARSER_FINALIZE ( MyTLVParserBase ); }; \endcode - + Your concrete TLV parsers will inherit from this base class and have to define a specific value field and a \c typeId member: \code @@ -63,34 +63,34 @@ namespace senf { SENF_PARSER_INHERIT ( MyTLVParserBase ); SENF_PARSER_FIELD ( myValue, senf::UInt32Parser ); SENF_PARSER_FINALIZE ( MyConcreteTLVParser ); - + SENF_PARSER_INIT() { type() = typeId; length_() = 4; - } + } static const type_t::value_type typeId = 0x42; }; \endcode - + With GenericTLVParserBase you can define a generic parser class which provides members to access the value data and and to cast the parser to a concrete tlv - parser: + parser: \code struct MyGenericTLVParser : public senf::GenericTLVParserBase { typedef senf::GenericTLVParserBase base; MyGenericTLVParser(data_iterator i, state_type s) : base(i,s) {} - + // members for your generic TLV parser... }; \endcode - + If your generic TLV parser just inherits from GenericTLVParserBase and doesn't add any additional functionality you can use a simple \c typedef as well: \code typedef senf::GenericTLVParserBase MyGenericTLVParser; \endcode - + This generic tlv parser can now be used for example in a list: \code class MyTestPacketParser : public senf::PacketParserBase @@ -101,7 +101,7 @@ namespace senf { SENF_PARSER_FINALIZE ( MyTestPacketParser ); }; \endcode - + Now, you can access the TLV parsers in the list in a generic way or you can cast the parsers to some concrete tlv parser: \code @@ -109,23 +109,23 @@ namespace senf { typedef MyTestPacket::Parser::tlv_list_t::container container_t; container_t tlvContainer (p->tlv_list() ); optContainer_t::iterator listIter (tlvContainer.begin()); - + // listIter points to a MyGenericTLVParser, so you have generic access: listIter->type() = 0x42; listIter->value( someRangeOfValueData); - + // cast to an instance of MyConcreteTLVParser: if (listIter->is()) { MyConcreteTLVParser concreteTLVParser ( listIter->as()); concreteTLVParser.myValue() = 0xabababab; } - + // add a MyConcreteTLV to the list: MyConcreteTLVParser tlv ( tlvContainer.push_back_space().init()); tlv.myValue() = 0xffff; - \endcode + \endcode - \see + \see IPv6GenericOptionParser, WLANGenericInfoElementParser, MIHGenericTLVParser \n GenericTLVParserRegistry */ @@ -133,25 +133,25 @@ namespace senf { class GenericTLVParserBase : public Base { public: - GenericTLVParserBase(senf::PacketParserBase::data_iterator i, senf::PacketParserBase::state_type s) + GenericTLVParserBase(senf::PacketParserBase::data_iterator i, senf::PacketParserBase::state_type s) : Base(i,s) {} - + senf::PacketParserBase::size_type bytes() const; void init() const; template Parser init(); - + template Parser as() const; - + template bool is() const; senf::PacketInterpreterBase::range value() const; void dump(std::ostream & os) const; - + #ifndef DOXYGEN template void value(ForwardReadableRange const & val, @@ -163,31 +163,31 @@ namespace senf { template void value(std::pair const & val, - typename boost::enable_if >::type * = 0); + typename boost::enable_if >::type * = 0); #else template void value(ForwardReadableRange const & val); - + template void value(std::pair const & val); -#endif - +#endif + private: template void value_(ForwardReadableRange const &range); - + Base & self(); Base const & self() const; }; - - + + namespace detail { template struct GenericTLVParserRegistry_EntryBase { virtual void dump(GenericTLVParserBase const & parser, std::ostream & os) const = 0; virtual PacketParserBase::size_type bytes(GenericTLVParserBase const & parser) const = 0; }; - + template struct GenericTLVParserRegistry_Entry : GenericTLVParserRegistry_EntryBase @@ -195,7 +195,7 @@ namespace senf { virtual void dump(GenericTLVParserBase const & parser, std::ostream & os) const; virtual PacketParserBase::size_type bytes(GenericTLVParserBase const & parser) const; }; - + //Helper Functor for STL-compatible predicate (E.g. find_if, for_each ...) template class Predicate @@ -206,24 +206,24 @@ namespace senf { } }; } - + /** \brief TLV parser registration facility The %GenericTLVParserRegistry provides a generic facility to globally register concrete TLV parser by the type value. The concrete TLV parser must therefore provide a \c typeId member. See GenericTLVParserBase for details about the assumed class structure. - - Every registry is identified by the base tlv parser class. Parsers can be registered - statically only: + + Every registry is identified by the base tlv parser class. Parsers can be registered + statically only: \code GenericTLVParserRegistry::RegistrationProxy registerConcreteTLVParser; - \endcode - This global variable declaration will register ConcreteTLVParser. The variable - registerConcreteTLVParser is a dummy. It's only function is to force the call of + \endcode + This global variable declaration will register ConcreteTLVParser. The variable + registerConcreteTLVParser is a dummy. It's only function is to force the call of it's constructor during global construction time. This static registration only works when the symbol is included into the final binary. - + To simplify the registration the \ref SENF_PACKET_TLV_REGISTRY_REGISTER macro can be used. The \c ConreteTLVParser must therefore provide a \c Registry typedef pointing to the %GenericTLVParserRegistry; typically you put this typedef to the TLVBaseParser class. @@ -239,34 +239,34 @@ namespace senf { static const type_t::value_type typeId = 0x42; void dump(std::ostream & os) const; }; - + // register MyConcreteTLVParser to the MyTLVParserBase-Registry with the type id 0x42: SENF_PACKET_TLV_REGISTRY_REGISTER( MyConcreteTLVParser ); \endcode - + The registry provides a dump() member to dump an instance of a generic TLV parser. If the type value of the given TLV parser is registered the generic tlv will be casted to the registered concrete TLV parser and the dump member from this parser will be called. - + \see GenericTLVParserBase for the general TLV class structure \n IPv6OptionParser::Registry, WLANInfoElementParser::Registry, - MIHBaseTLVParser::Registry + MIHBaseTLVParser::Registry */ template class GenericTLVParserRegistry : public senf::singleton > { - typedef boost::ptr_map > Map; Map map_; - + GenericTLVParserRegistry() {}; public: using senf::singleton >::instance; friend class senf::singleton >; - + template struct RegistrationProxy { RegistrationProxy(); @@ -274,28 +274,28 @@ namespace senf { template void registerParser(); - + typedef GenericTLVParserBase GenericTLVParser; - + bool isRegistered(GenericTLVParserBase const & parser) const; bool isRegistered(Keytype const & key) const; - + void dump(GenericTLVParser const & parser, std::ostream & os) const; void dump(GenericTLVParser const & parser, Keytype const & key, std::ostream & os) const; - + PacketParserBase::size_type bytes(GenericTLVParser const & parser) const; PacketParserBase::size_type bytes(GenericTLVParser const & parser, Keytype const & key) const; }; - + struct TLVParserNotRegisteredException : public senf::Exception - { - TLVParserNotRegisteredException() : senf::Exception("tlv parser not registered") {} + { + TLVParserNotRegisteredException() : senf::Exception("tlv parser not registered") {} }; - + /** \brief Statically add an entry to a TLV parser registry - This macro will declare an anonymous global variable in such a way, that constructing + This macro will declare an anonymous global variable in such a way, that constructing this variable will register the given tlv parser. \hideinitializer @@ -306,7 +306,7 @@ namespace senf { ConreteTLVParser::Registry::RegistrationProxy \ BOOST_PP_CAT(tlvparserRegistration_, __LINE__); \ } - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Packets/GenericTLV.test.cc b/senf/Packets/GenericTLV.test.cc index b403c33..6bdd1c9 100644 --- a/senf/Packets/GenericTLV.test.cc +++ b/senf/Packets/GenericTLV.test.cc @@ -34,24 +34,24 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - struct MyTLVParserBase + struct MyTLVParserBase : public senf::PacketParserBase { # include SENF_PARSER() SENF_PARSER_FIELD ( type, senf::UInt8Parser ); SENF_PARSER_FIELD_RO ( length, senf::UInt8Parser ); SENF_PARSER_FINALIZE ( MyTLVParserBase ); - + typedef senf::GenericTLVParserRegistry Registry; }; - + struct MyGenericTLVParser : public senf::GenericTLVParserBase { typedef senf::GenericTLVParserBase base; MyGenericTLVParser(data_iterator i, state_type s) : base(i,s) {} }; - + struct MyConcreteTLVParser : public MyTLVParserBase { @@ -59,13 +59,13 @@ namespace { SENF_PARSER_INHERIT ( MyTLVParserBase ); SENF_PARSER_FIELD ( myValue, senf::UInt32Parser ); SENF_PARSER_FINALIZE ( MyConcreteTLVParser ); - + SENF_PARSER_INIT() { type() = typeId; length_() = 4; } static type_t::value_type const typeId = 0x42; - + void dump(std::ostream & os) const { boost::io::ios_all_saver ias(os); os << " MyConcreteTLVParser\n" @@ -74,7 +74,7 @@ namespace { << " value: " << senf::format::dumpint(myValue()) << "\n"; } }; - + struct MyConcrete2TLVParser : public MyTLVParserBase { @@ -82,13 +82,13 @@ namespace { SENF_PARSER_INHERIT ( MyTLVParserBase ); SENF_PARSER_FIELD ( myValue, senf::UInt32Parser ); SENF_PARSER_FINALIZE ( MyConcrete2TLVParser ); - + SENF_PARSER_INIT() { type() = typeId; length_() = 4; } static type_t::value_type const typeId = 0x47; - + void dump(std::ostream & os) const { boost::io::ios_all_saver ias(os); os << " MyConcreteTLVParser\n" @@ -97,7 +97,7 @@ namespace { << " value: " << senf::format::dumpint(myValue()) << "\n"; } }; - + class MyTestPacketParser : public senf::PacketParserBase { @@ -106,7 +106,7 @@ namespace { SENF_PARSER_LIST ( tlv_list, list_length, MyGenericTLVParser ); SENF_PARSER_FINALIZE ( MyTestPacketParser ); }; - + struct MyTestPacketType : public senf::PacketTypeBase, public senf::PacketTypeMixin @@ -124,7 +124,7 @@ namespace { SENF_AUTO_UNIT_TEST(GenericTLV_parser) { - BOOST_CHECK_EQUAL( senf::init_bytes::value, + BOOST_CHECK_EQUAL( senf::init_bytes::value, senf::init_bytes::value) ; unsigned char data[] = { @@ -144,9 +144,9 @@ SENF_AUTO_UNIT_TEST(GenericTLV_parser) SENF_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), genericTLVParser.value().begin(), genericTLVParser.value().end() ); - std::vector value (4, 0xab); + std::vector value (4, 0xab); genericTLVParser.value( std::make_pair(0x42, value)); - + BOOST_CHECK( genericTLVParser.is()); MyConcreteTLVParser concreteTLVParser ( genericTLVParser.as()); @@ -162,7 +162,7 @@ SENF_AUTO_UNIT_TEST(GenericTLV_packet) MyConcreteTLVParser tlv ( tlvContainer.push_back_space().init()); tlv.myValue() << 0xffff; p.finalizeThis(); - + unsigned char data[] = { 0x01, // tlv list length // first tlv: @@ -179,25 +179,25 @@ SENF_AUTO_UNIT_TEST(GenericTLV_registry) typedef senf::GenericTLVParserRegistry MyTLVParserRegistry; MyTestPacket p ( MyTestPacket::create()); MyTestPacket::Parser::tlv_list_t::container tlvContainer (p->tlv_list() ); - MyConcreteTLVParser conreteTLVParser ( + MyConcreteTLVParser conreteTLVParser ( tlvContainer.push_back_space().init()); conreteTLVParser.myValue() << 0xffff; p.finalizeThis(); - + std::stringstream ss; tlvContainer.begin()->dump( ss); - BOOST_CHECK_EQUAL( ss.str().substr(0,58), + BOOST_CHECK_EQUAL( ss.str().substr(0,58), " GenericTLVParser<(anonymous namespace)::MyTLVParserBase>" ); BOOST_CHECK( ! MyTLVParserRegistry::instance().isRegistered( tlvContainer.begin()->type())); - + MyTLVParserRegistry::instance().registerParser(); BOOST_CHECK( MyTLVParserRegistry::instance().isRegistered( tlvContainer.begin()->type())); - BOOST_CHECK_EQUAL( + BOOST_CHECK_EQUAL( MyTLVParserRegistry::instance().bytes( *tlvContainer.begin()), senf::bytes( *tlvContainer.begin()) ); - + ss.str(""); ss.clear(); - + tlvContainer.begin()->dump( ss); BOOST_CHECK_EQUAL( ss.str().substr(0,21), " MyConcreteTLVParser" ); } @@ -206,20 +206,20 @@ SENF_AUTO_UNIT_TEST(GenericTLV_predicate) { MyTestPacket p ( MyTestPacket::create() ); MyTestPacket::Parser::tlv_list_t::container tlvContainer (p->tlv_list() ); - MyConcreteTLVParser conreteTLVParser ( + MyConcreteTLVParser conreteTLVParser ( tlvContainer.push_back_space().init()); conreteTLVParser.myValue() << 0xffff; - MyConcrete2TLVParser conreteTLVParser2 ( + MyConcrete2TLVParser conreteTLVParser2 ( tlvContainer.push_back_space().init()); conreteTLVParser2.myValue() << 0xdddd; p.finalizeThis(); - -// typedef senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optContainer_t; + +// typedef senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optContainer_t; // optContainer_t optC (p->tlv_list() ); - + MyTestPacket::Parser::tlv_list_t::container testTlvContainer (p->tlv_list() ); MyTestPacket::Parser::tlv_list_t::container::iterator it = std::find_if ( - testTlvContainer.begin(), testTlvContainer.end(), + testTlvContainer.begin(), testTlvContainer.end(), senf::detail::Predicate< senf::GenericTLVParserBase, MyConcreteTLVParser>() ); BOOST_CHECK( it->is()) ; } diff --git a/senf/Packets/IntParser.hh b/senf/Packets/IntParser.hh index 02e8eb1..e24f429 100644 --- a/senf/Packets/IntParser.hh +++ b/senf/Packets/IntParser.hh @@ -59,7 +59,7 @@ namespace senf { \li p = v: Assigns the value to the packet field. \li p.value(v): same as above. \li p.value(): Returns the fields value as an integer number. - \li Use of p like an integer in most contexts: p += v, p *= v, v = p + + \li Use of p like an integer in most contexts: p += v, p *= v, v = p 1 and so on. You will only need to use the explicit \c value() member in rare circumstances when the automatic conversion is ambiguous or in some template contexts. diff --git a/senf/Packets/ListBParser.ct b/senf/Packets/ListBParser.ct index 880aa92..de8f2b0 100644 --- a/senf/Packets/ListBParser.ct +++ b/senf/Packets/ListBParser.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2010 +// Copyright (C) 2010 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/ListBParser.cti b/senf/Packets/ListBParser.cti index 80a4914..80e8c79 100644 --- a/senf/Packets/ListBParser.cti +++ b/senf/Packets/ListBParser.cti @@ -187,7 +187,7 @@ next(container_type const & c, iterator_data & d) const { return boost::next( container_type::iterator::get(d).i(), - senf::bytes(ElementParser( container_type::iterator::get(d).i(), + senf::bytes(ElementParser( container_type::iterator::get(d).i(), c.state() )) ); } diff --git a/senf/Packets/ListBParser.ih b/senf/Packets/ListBParser.ih index aa72d28..c3c8e2e 100644 --- a/senf/Packets/ListBParser.ih +++ b/senf/Packets/ListBParser.ih @@ -138,8 +138,8 @@ namespace detail { }; template - struct ListParserPolicy > { typedef ListBParser_Policy< ElementParser, diff --git a/senf/Packets/ListBParser.test.cc b/senf/Packets/ListBParser.test.cc index 83ba23b..0d30cb5 100644 --- a/senf/Packets/ListBParser.test.cc +++ b/senf/Packets/ListBParser.test.cc @@ -59,7 +59,7 @@ SENF_AUTO_UNIT_TEST(ListBParser) { senf::PacketInterpreterBase::ptr pi (senf::PacketInterpreter::create( MyListBParser::init_bytes)); - + MyListBParser p (pi->data().begin(),&pi->data()); p.init(); BOOST_CHECK_EQUAL( p.size(), 0u ); @@ -80,14 +80,14 @@ SENF_AUTO_UNIT_TEST(ListBParser_container) { senf::PacketInterpreterBase::ptr pi (senf::PacketInterpreter::create( MyListBParser::init_bytes)); - + { MyListBParser::container c (MyListBParser(pi->data().begin(),&pi->data())); - + BOOST_CHECK_EQUAL( c.size(), 0u ); BOOST_CHECK_EQUAL( c.bytes(), 2u ); BOOST_CHECK( c.begin() == c.end() ); - + c.shift(c.begin()); BOOST_CHECK_EQUAL( c.size(), 1u ); BOOST_CHECK_EQUAL( c.bytes(), 3u ); @@ -108,7 +108,7 @@ SENF_AUTO_UNIT_TEST(ListBParser_container) BOOST_CHECK_EQUAL(c2.size(), 1u); BOOST_CHECK_EQUAL(c2.bytes(), 7u); - + c.insert(c.end(),c2.back()); BOOST_CHECK_EQUAL( c.size(), 2u ); BOOST_CHECK_EQUAL( c.bytes(), 10u ); @@ -119,7 +119,7 @@ SENF_AUTO_UNIT_TEST(ListBParser_container) c.insert(boost::next(c.begin()), 2u, c2.back()); BOOST_CHECK_EQUAL( c.size(), 4u ); BOOST_CHECK_EQUAL( c.bytes(), 20u ); - BOOST_CHECK_EQUAL( (*boost::next(c.begin())).vec()[0], 0x1357u ); + BOOST_CHECK_EQUAL( (*boost::next(c.begin())).vec()[0], 0x1357u ); BOOST_CHECK_EQUAL( (*boost::next(c.begin(),2)).vec()[0], 0x1357u ); c2.back().vec()[0] << 0x2468u; @@ -133,7 +133,7 @@ SENF_AUTO_UNIT_TEST(ListBParser_container) BOOST_CHECK_EQUAL( c.bytes(), 17u ); BOOST_CHECK_EQUAL( c.front().vec()[0],0x1357u ); BOOST_CHECK_EQUAL( c.back().vec()[0], 0x2345u ); - + c.erase((boost::next(c.begin(),2)),c.end()); BOOST_CHECK_EQUAL( c.size(), 2u ); BOOST_CHECK_EQUAL( c.bytes(), 12u ); @@ -148,7 +148,7 @@ SENF_AUTO_UNIT_TEST(ListBParser_container) } namespace { - + struct TestTransform { typedef unsigned value_type; @@ -165,7 +165,7 @@ namespace { SENF_PARSER_PRIVATE_FIELD ( size2 , senf::UInt8Parser ); SENF_PARSER_FIELD ( dummy , senf::UInt32Parser ); SENF_PARSER_LIST ( list1 , bytes(size1) , VectorParser ); - SENF_PARSER_LIST ( list2 , transform(TestTransform, bytes(size2)) , + SENF_PARSER_LIST ( list2 , transform(TestTransform, bytes(size2)) , VectorParser ); SENF_PARSER_FINALIZE(TestListParser); @@ -189,10 +189,10 @@ SENF_AUTO_UNIT_TEST(listBytesMacro) 0x0D, 0x0E, // list2()[1].vec()[1] 0x01, // list2()[2].size() 0x0F, 0x10 }; // list2()[2].vec()[0] - + senf::DataPacket p (senf::DataPacket::create(data)); TestListParser parser (p.data().begin(), &p.data()); - + BOOST_CHECK_EQUAL( parser.list1().size(), 2u ); BOOST_CHECK_EQUAL( parser.list2().size(), 3u ); BOOST_CHECK_EQUAL( parser.dummy(), 0x01020304u ); @@ -211,7 +211,7 @@ SENF_AUTO_UNIT_TEST(listBytesMacro) BOOST_CHECK_EQUAL( i->vec().size(), 2u ); BOOST_CHECK_EQUAL( i->vec()[0], 0x0708u ); BOOST_CHECK_EQUAL( i->vec()[1], 0x090Au ); - + ++i; BOOST_CHECK( i == list.end() ); } @@ -227,11 +227,11 @@ SENF_AUTO_UNIT_TEST(listBytesMacro) BOOST_CHECK_EQUAL( i->vec().size(), 2u ); BOOST_CHECK_EQUAL( i->vec()[0], 0x0B0Cu ); BOOST_CHECK_EQUAL( i->vec()[1], 0x0D0Eu ); - + ++i; BOOST_CHECK_EQUAL( i->vec().size(), 1u ); BOOST_CHECK_EQUAL( i->vec()[0], 0x0F10u ); - + ++i; BOOST_CHECK( i == list.end() ); } @@ -266,7 +266,7 @@ SENF_AUTO_UNIT_TEST(listBytesParser_packetSize) 0x0D, 0x0E, // list()[3].vec()[1] 0x01, // list()[4].vec().size() 0x0F, 0x10 }; // list()[4].vec()[0] - + senf::DataPacket p (senf::DataPacket::create(data)); { diff --git a/senf/Packets/ListNParser.ih b/senf/Packets/ListNParser.ih index 2c8ad05..b6e2042 100644 --- a/senf/Packets/ListNParser.ih +++ b/senf/Packets/ListNParser.ih @@ -57,7 +57,7 @@ namespace detail { size_type bytes (data_iterator i, state_type s) const; size_type size (data_iterator i, state_type s) const; void init (data_iterator i, state_type s) const; - + void construct (container_type & c) const; void destruct (container_type & c) const; void erase (container_type & c, data_iterator p) const; @@ -85,8 +85,8 @@ namespace detail { }; template - struct ListParserPolicy > { typedef ListNParser_Policy< ElementParser, diff --git a/senf/Packets/ListNParser.test.cc b/senf/Packets/ListNParser.test.cc index 6500e2b..a28f765 100644 --- a/senf/Packets/ListNParser.test.cc +++ b/senf/Packets/ListNParser.test.cc @@ -46,7 +46,7 @@ namespace { SENF_PARSER_PRIVATE_FIELD( size, senf::UInt8Parser ); SENF_PARSER_VECTOR( vec, size, senf::UInt16Parser ); - + SENF_PARSER_FINALIZE(MyVec); }; @@ -124,7 +124,7 @@ SENF_AUTO_UNIT_TEST(ListNParser) BOOST_CHECK_EQUAL( p.size(), 2u ); BOOST_CHECK_EQUAL( p.bytes(), 8u ); BOOST_CHECK_EQUAL( p.back().vec().size(), 0u ); - + p.back().vec().push_front(0x0123u); BOOST_CHECK_EQUAL( p.front().vec().size(), 2u ); BOOST_CHECK_EQUAL( p.back().vec().size(), 1u ); @@ -132,7 +132,7 @@ SENF_AUTO_UNIT_TEST(ListNParser) p.push_front_space(2u); BOOST_CHECK_EQUAL( p.size(), 4u ); BOOST_CHECK_EQUAL( p.front().vec().size(), 0u); - + p.resize(3u); BOOST_CHECK_EQUAL( p.size(), 3u ); BOOST_CHECK_EQUAL( p.back().vec()[0], 0x1234u ); @@ -143,7 +143,7 @@ SENF_AUTO_UNIT_TEST(ListNParser) } namespace { - + struct TestTransform { typedef unsigned value_type; @@ -183,10 +183,10 @@ SENF_AUTO_UNIT_TEST(listMacro) 0x0D, 0x0E, // list2()[1].vec()[1] 0x01, // list2()[2].size() 0x0F, 0x10 }; // list2()[2].vec()[0] - + senf::DataPacket p (senf::DataPacket::create(data)); TestListParser parser (p.data().begin(), &p.data()); - + BOOST_CHECK_EQUAL( parser.list1().size(), 2u ); BOOST_CHECK_EQUAL( parser.list2().size(), 3u ); BOOST_CHECK_EQUAL( parser.dummy(), 0x01020304u ); @@ -205,7 +205,7 @@ SENF_AUTO_UNIT_TEST(listMacro) BOOST_CHECK_EQUAL( i->vec().size(), 2u ); BOOST_CHECK_EQUAL( i->vec()[0], 0x0708u ); BOOST_CHECK_EQUAL( i->vec()[1], 0x090Au ); - + ++i; BOOST_CHECK( i == list.end() ); } @@ -221,11 +221,11 @@ SENF_AUTO_UNIT_TEST(listMacro) BOOST_CHECK_EQUAL( i->vec().size(), 2u ); BOOST_CHECK_EQUAL( i->vec()[0], 0x0B0Cu ); BOOST_CHECK_EQUAL( i->vec()[1], 0x0D0Eu ); - + ++i; BOOST_CHECK_EQUAL( i->vec().size(), 1u ); BOOST_CHECK_EQUAL( i->vec()[0], 0x0F10u ); - + ++i; BOOST_CHECK( i == list.end() ); } diff --git a/senf/Packets/ListParser.hh b/senf/Packets/ListParser.hh index 352d6b1..709ed0d 100644 --- a/senf/Packets/ListParser.hh +++ b/senf/Packets/ListParser.hh @@ -62,7 +62,7 @@ namespace senf { API however you will need to instantiate a container wrapper for the list. See \ref packet_usage_fields_collection. - \see + \see How to access \ref packet_usage_fields_collection \n SENF_PARSER_LIST() macro used to define list fields \n ListParser_Container list container wrapper API \n @@ -240,7 +240,7 @@ namespace senf { // Define the list SENF_PARSER_LIST ( list, list_size_, EltParser ); \endcode - + Here \c EltParser can be an arbitrary parser and need not have a fixed size. \warning Realize, that the \a size field is controlled by the list parser. This field @@ -261,7 +261,7 @@ namespace senf { \c transform(\a transform, \c bytes(\a size))The \a transform is applied to the \a size value. The value is then interpreted containing the list size in bytes not - number of elements + number of elements The optional \a transform is a class with the following layout @@ -272,7 +272,7 @@ namespace senf { static value_type get(other_type v); static other_type set(value_type v); }; - \endcode + \endcode \c other_type is \a size ::\c value_type, the type of the value returned by the \a size field, whereas the \c value_type typedef is the arbitrary return type of the transform. @@ -297,7 +297,7 @@ namespace senf { \param[in] size name of field giving the list size \param[in] elt_type list element type - \see + \see How to use \ref packet_usage_fields_collection \n senf::ListParser the list parser API for list field access senf::ListParser_Container the list parser container API for list field access diff --git a/senf/Packets/ListParser.ih b/senf/Packets/ListParser.ih index bf60983..e7ee362 100644 --- a/senf/Packets/ListParser.ih +++ b/senf/Packets/ListParser.ih @@ -56,14 +56,14 @@ namespace detail { PacketParserBase::data_iterator raw() const; PacketParserBase::data_iterator i() const; - + static ListParser_Iterator & get(typename Container::policy::iterator_data & d); static ListParser_Iterator const & get(typename Container::policy::iterator_data const & d); private: friend class boost::iterator_core_access; template friend class ListParser_Container; - + value_type dereference() const; bool equal(ListParser_Iterator const & other) const; void increment(); diff --git a/senf/Packets/MPEGDVBBundle/DTCPPacket.cc b/senf/Packets/MPEGDVBBundle/DTCPPacket.cc index 3f0ea63..2fedd7e 100644 --- a/senf/Packets/MPEGDVBBundle/DTCPPacket.cc +++ b/senf/Packets/MPEGDVBBundle/DTCPPacket.cc @@ -49,7 +49,7 @@ prefix_ void senf::DTCPHelloPacketType::dump(packet p, std::ostream & os) << senf::fieldName("tunnel protocol") << unsigned(p->tunnelProtocol()) << "\n" << senf::fieldName("number of BDL ips") << unsigned(p->fbipCount()) << "\n" << " feed BDL ips:\n"; - + switch (p->ipVersion()) { case 4 : { typedef DTCPHelloPacket::Parser::v4fbipList_t FBIPList; diff --git a/senf/Packets/MPEGDVBBundle/DTCPPacket.hh b/senf/Packets/MPEGDVBBundle/DTCPPacket.hh index f5bdbe2..35550a3 100644 --- a/senf/Packets/MPEGDVBBundle/DTCPPacket.hh +++ b/senf/Packets/MPEGDVBBundle/DTCPPacket.hh @@ -40,9 +40,9 @@ namespace senf { # define DTCP_V6_MCADDRESS "FF02:0:0:0:0:0:1:4" # define DTCP_UDP_PORT 652 - struct DTCPIPv4AddressListParser : public PacketParserBase + struct DTCPIPv4AddressListParser : public PacketParserBase { -# include SENF_PARSER() +# include SENF_PARSER() SENF_PARSER_PRIVATE_FIELD( fbipCount_, UInt8Parser ); //pkgdraw: name= - SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt8Parser ); // must be zero + SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt8Parser ); // must be zero // Go back to fbipCount so the variant has access to that field SENF_PARSER_GOTO( fbipCount ); SENF_PARSER_VARIANT ( fbipList_, ipVersion, ( ids(na, has_v4fbipList, init_v4fbipList, - key(4, DTCPIPv4AddressListParser)) ) + key(4, DTCPIPv4AddressListParser)) ) ( ids(na, has_v6fbipList, init_v6fbipList, key(6, DTCPIPv6AddressListParser)) ) ); @@ -117,12 +117,12 @@ namespace senf { typedef DTCPIPv6AddressListParser::fbips_t v6fbipList_t; v6fbipList_t v6fbipList() { return fbipList_().get<1>().fbips(); } - + SENF_PARSER_FINALIZE(DTCPHelloPacketParser); }; - + /** \brief DTCP HELLO packet - + \par Packet type (typedef): \ref DTCPHelloPacket @@ -140,14 +140,14 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef DTCPHelloPacketParser parser; - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); }; - + /** \brief DTCP packet typedef */ typedef DTCPHelloPacketType::packet DTCPHelloPacket; } diff --git a/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc b/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc index 98a5243..8d456d6 100644 --- a/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc +++ b/senf/Packets/MPEGDVBBundle/DTCPPacket.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -38,7 +38,7 @@ SENF_AUTO_UNIT_TEST(dtcpPacket) { - unsigned char data[] = { + unsigned char data[] = { 0x11, // versionNumber = 1, command = JOIN 5, // interval 0x0A, 0x0B, // sequence number @@ -72,7 +72,7 @@ SENF_AUTO_UNIT_TEST(dtcpPacket) std::stringstream ss; hello.dump(ss); - BOOST_CHECK_EQUAL( ss.str(), + BOOST_CHECK_EQUAL( ss.str(), "DTCP HELLO Packet:\n" " version : 1\n" " command : JOIN\n" diff --git a/senf/Packets/MPEGDVBBundle/GREPacket.hh b/senf/Packets/MPEGDVBBundle/GREPacket.hh index 99434a2..e3efe73 100644 --- a/senf/Packets/MPEGDVBBundle/GREPacket.hh +++ b/senf/Packets/MPEGDVBBundle/GREPacket.hh @@ -39,11 +39,11 @@ namespace senf { /** \brief Parse a GRE packet Parser implementing the header of a General Routing Encapsulation (GRE, RFC 2784) Packet - + \see GREPacketType */ struct GREChecksumParser : public PacketParserBase { -# include SENF_PARSER() +# include SENF_PARSER() SENF_PARSER_FIELD ( checksum1_, UInt16Parser ); SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt16Parser ); SENF_PARSER_FINALIZE(GREChecksumParser); @@ -59,16 +59,16 @@ namespace senf { SENF_PARSER_FIELD ( protocol_type, UInt16Parser ); SENF_PARSER_PRIVATE_VARIANT ( checksum_, checksum_present, (VoidPacketParser) (GREChecksumParser) ); - + SENF_PARSER_FINALIZE( GREPacketParser ); - private: + private: UInt16Parser checksum() const /// only defined if checksum_present() == \c true { return checksum_().get<1>().checksum1_(); } }; - + /** \brief GRE packet - + \par Packet type (typedef): \ref GREPacket @@ -85,12 +85,12 @@ namespace senf { typedef PacketTypeMixin mixin; typedef ConcretePacket packet; typedef GREPacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - + static void dump(packet p, std::ostream & os); static EtherTypes::key_t nextPacketKey(packet p) { return p->protocol_type(); @@ -99,18 +99,18 @@ namespace senf { p->protocol_type() << key(p.next(nothrow)); p->version_number() = 0; // as per RFC2784, 2.3.1 - if (p->checksum_present()) { + if (p->checksum_present()) { // compute checksum } else { // ??? } } }; - + /** \brief GRE packet typedef */ typedef GREPacketType::packet GREPacket; - - + + } diff --git a/senf/Packets/MPEGDVBBundle/MPESection.hh b/senf/Packets/MPEGDVBBundle/MPESection.hh index d537eef..92fc4a4 100644 --- a/senf/Packets/MPEGDVBBundle/MPESection.hh +++ b/senf/Packets/MPEGDVBBundle/MPESection.hh @@ -132,16 +132,16 @@ namespace senf { /** \brief Dump given MPESection in readable form to given output stream */ static void dump(packet p, std::ostream & os); - + static void finalize(packet p); - + static factory_t nextPacketType(packet p); - + static PacketParserBase::size_type initSize(); static PacketParserBase::size_type initHeadSize(); }; - /** \brief MPESection packet typedef + /** \brief MPESection packet typedef \ingroup protocolbundle_mpegdvb */ typedef ConcretePacket MPESection; diff --git a/senf/Packets/MPEGDVBBundle/MPESection.test.cc b/senf/Packets/MPEGDVBBundle/MPESection.test.cc index 9463ee2..29d7e41 100644 --- a/senf/Packets/MPEGDVBBundle/MPESection.test.cc +++ b/senf/Packets/MPEGDVBBundle/MPESection.test.cc @@ -187,7 +187,7 @@ SENF_AUTO_UNIT_TEST(MPESection_create) 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x52, 0xdf, 0x6a, 0x1d }; - SENF_CHECK_EQUAL_COLLECTIONS( + SENF_CHECK_EQUAL_COLLECTIONS( sec_data, sec_data+sizeof(sec_data), sec.data().begin(), sec.data().end() ); } diff --git a/senf/Packets/MPEGDVBBundle/SNDUPacket.cc b/senf/Packets/MPEGDVBBundle/SNDUPacket.cc index e6761b3..2aa6253 100644 --- a/senf/Packets/MPEGDVBBundle/SNDUPacket.cc +++ b/senf/Packets/MPEGDVBBundle/SNDUPacket.cc @@ -38,14 +38,14 @@ prefix_ boost::uint32_t senf::SNDUPacketParser::calcCrc() const { return std::for_each( - data().begin(), - boost::prior(data().end(), 4), + data().begin(), + boost::prior(data().end(), 4), ule_crc32() ).checksum(); } //prefix_ senf::SNDUPacketType::key_t senf::SNDUPacketType::nextPacketKey(packet p) //{ -// return p->type(); +// return p->type(); //} prefix_ void senf::SNDUPacketType::init(packet p) @@ -65,12 +65,12 @@ prefix_ senf::PacketInterpreterBase::factory_t senf::SNDUPacketType::nextPacketT return e ? e->factory() : no_factory(); } -prefix_ senf::PacketInterpreterBase::optional_range -senf::SNDUPacketType::nextPacketRange(packet p) +prefix_ senf::PacketInterpreterBase::optional_range +senf::SNDUPacketType::nextPacketRange(packet p) { if (p.data().size() < 8) return no_range(); - + size_type sz = 2 + 2; // D-Bit + 15 bits length + 16 bits type field if (! p->d_bit() ) sz += 6; // + 6 Byte NPA destination address diff --git a/senf/Packets/MPEGDVBBundle/SNDUPacket.hh b/senf/Packets/MPEGDVBBundle/SNDUPacket.hh index e700942..27e1d09 100644 --- a/senf/Packets/MPEGDVBBundle/SNDUPacket.hh +++ b/senf/Packets/MPEGDVBBundle/SNDUPacket.hh @@ -38,9 +38,9 @@ namespace senf { /** \brief parse ULE SNDU Packet - + Parser implementing the header and trailer of a ULE SNDU Packet - + \see SNDUPacketType */ struct SNDUPacketParser : public PacketParserBase @@ -53,11 +53,11 @@ namespace senf { SENF_PARSER_PRIVATE_BITFIELD ( d_bit_ , 1 , unsigned ); SENF_PARSER_BITFIELD ( length , 15 , unsigned ); SENF_PARSER_FIELD ( type , UInt16Parser ); - SENF_PARSER_PRIVATE_VARIANT ( destination_ , d_bit_ , + SENF_PARSER_PRIVATE_VARIANT ( destination_ , d_bit_ , (MACAddressParser) (VoidPacketParser) ); - + SENF_PARSER_FINALIZE( SNDUPacketParser ); - + MACAddressParser destination() /// Only defined if d_bit() == \c false { return destination_().get<0>(); } @@ -66,23 +66,23 @@ namespace senf { void withDestination() /// Clear destination absent bit { destination_().init<0>(); } - + void withoutDestination() /// Set destination absent bit { destination_().init<1>(); } - UInt32Parser crc() + UInt32Parser crc() { return parse( data().size() - 4 ); } boost::uint32_t calcCrc() const; }; - + struct ULEExtHeaderTypes { typedef boost::uint16_t key_t; }; - + /** \brief ULE SNDU Packet - + \par Packet type (typedef): \ref SNDUPacket @@ -103,30 +103,30 @@ namespace senf { // using mixin::nextPacketRange; // using mixin::nextPacketType; // using mixin::init; - + // static key_t nextPacketKey(packet p); - + static void init(packet p); static factory_t nextPacketType(packet p); - + static optional_range nextPacketRange(packet p); - + static void dump(packet p, std::ostream & os); - + static PacketParserBase::size_type initSize(); - + static PacketParserBase::size_type initHeadSize(); }; - + typedef SNDUPacketType::packet SNDUPacket; - + typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> ule_crc32; /*! - \def ULE_END_INDICATOR - ULE End Indicator; indicates to the receiver that there are no + \def ULE_END_INDICATOR + ULE End Indicator; indicates to the receiver that there are no further SNDUs present within the current TS packet. */ # define ULE_END_INDICATOR 0xffff diff --git a/senf/Packets/MPEGDVBBundle/TransportPacket.cc b/senf/Packets/MPEGDVBBundle/TransportPacket.cc index 7ea59df..9543327 100644 --- a/senf/Packets/MPEGDVBBundle/TransportPacket.cc +++ b/senf/Packets/MPEGDVBBundle/TransportPacket.cc @@ -45,7 +45,7 @@ prefix_ void senf::TransportPacketParser::init_fields() prefix_ senf::UInt8Parser senf::TransportPacketParser::pointer_field() const { - return pointer_field_().get<1>(); + return pointer_field_().get<1>(); } prefix_ void senf::TransportPacketParser::setPUSI(bool pusi) @@ -54,7 +54,7 @@ prefix_ void senf::TransportPacketParser::setPUSI(bool pusi) if (pusi) pointer_field_().init<1>(); else pointer_field_().init<0>(); } - + prefix_ void senf::TransportPacketType::dump(packet p, std::ostream & os) { boost::io::ios_all_saver ias(os); diff --git a/senf/Packets/MPEGDVBBundle/TransportPacket.hh b/senf/Packets/MPEGDVBBundle/TransportPacket.hh index dddad47..d1d3f9f 100644 --- a/senf/Packets/MPEGDVBBundle/TransportPacket.hh +++ b/senf/Packets/MPEGDVBBundle/TransportPacket.hh @@ -38,7 +38,7 @@ namespace senf { Parser implementing the header of a MPEG Transport Stream packet. \image html TransportPacket.png - + \see TransportPacketType */ struct TransportPacketParser : public PacketParserBase @@ -57,9 +57,9 @@ namespace senf { SENF_PARSER_PRIVATE_VARIANT ( pointer_field_, pusi, (senf::VoidPacketParser) (UInt8Parser) ); - + SENF_PARSER_FINALIZE( TransportPacketParser ); - + UInt8Parser pointer_field() const; void init_fields() const; void setPUSI(bool pusi) const; @@ -69,9 +69,9 @@ namespace senf { init_fields(); } }; - + /** \brief Transport Stream packet - + @@ -105,7 +105,7 @@ namespace senf {
SyntaxNo. of bits
}
- + \par Packet type (typedef): \ref TransportPacket @@ -123,16 +123,16 @@ namespace senf { #endif typedef ConcretePacket packet; ///< Transport packet typedef typedef TransportPacketParser parser; ///< typedef to the parser of Transport packet - + using mixin::nextPacketRange; using mixin::init; using mixin::initSize; - + /** \brief Dump given Transport packet in readable form to given output stream */ static void dump(packet p, std::ostream & os); static const byte SYNC_BYTE = 0x47; }; - + /** \brief Transport packet typedef */ typedef ConcretePacket TransportPacket; } diff --git a/senf/Packets/Mainpage.dox b/senf/Packets/Mainpage.dox index f36ac13..a7854d8 100644 --- a/senf/Packets/Mainpage.dox +++ b/senf/Packets/Mainpage.dox @@ -27,12 +27,12 @@ \autotoc - + \section packet_intro_arch Introduction \seechapter \ref packet_arch The Packet library consists of several components: - + \li The \ref packet_module manages the packet data and provides the framework for handling the chain of packet headers. The visible interface is provided by the Packet class. \li \ref packetparser provides the framework for interpreting packet data. It handles @@ -45,11 +45,11 @@ \section packet_intro_usage Tutorial - \seechapter \ref packet_usage + \seechapter \ref packet_usage + + This chapter discusses the usage of the packet library from a high level view. - This chapter discusses the usage of the packet library from a high level view. - \section packet_intro_api The packet API The packet library API is divided into three areas @@ -58,7 +58,7 @@ \li the packet interpreter chain providing \ref packet_module \li and \ref packetparser which provides access to protocol specific packet fields. - + \section protocolbundles Supported packet types (protocols) Each protocol bundle provides a collection of related concrete packet classes for a group of @@ -70,7 +70,7 @@ \li \ref protocolbundle_80221 : 802.21 protocols There are two ways to link with a bundle - + \li If you only work with known packets which you explicitly reference you may just link with the corresponding library. \li If you need to parse unknown packets and want those to be parsed as complete as possible @@ -79,7 +79,7 @@ included whether they are explicitly referenced or not (and they will all automatically be registered). - + \section packet_intro_new Defining new packet types \seechapter \ref packet_new @@ -95,19 +95,19 @@ \autotoc - + \section packet_arch_handle The Packet handle Whenever we are using a Packet, we are talking about a senf::Packet (or a senf::ConcretePacket). This class is a \e handle referencing an internally managed packet data structure. So even though we pass senf::Packet instances around by value, they work like references. The packet library automatically manages all required memory resources using - reference counting. + reference counting. Different Packet handles may really internally share one Packet data structure if they both point to the same packet. - + \section packet_arch_data The Packet as a 'bunch of bytes' From the outside, a packet is just a bunch of bytes just as it is read from (or will be @@ -120,7 +120,7 @@ Packet p = ...; // Change first byte of packet to 1 - p.data()[0] = 1u; + p.data()[0] = 1u; // Copy packet data into a vector std::vector data (p.data().size()); @@ -133,12 +133,12 @@ \see senf::Packet::data() \n senf::PacketData - + \section packet_arch_chain The Interpreter Chain On the next level, the packet is divided into a nested list of sub-packets (or headers) called interpreters. Each senf::Packet handle internally points to an interpreter or header. This - allows us to access one and the same packet in different ways. + allows us to access one and the same packet in different ways. Consider an Ethernet Packet with an IP payload holding a UDP packet. We may reference either the Ethernet packet as a whole or we may reference the IP or UDP interpreters (sub-packets or @@ -167,7 +167,7 @@ udp.prev() == ip // true udp.prev() // throws InvalidPacketChainException \endcode - + \see \ref packet_module @@ -188,7 +188,7 @@ senf::EthernetPacket eth (senf::EthernetPacket::create()); senf::IPv4Packet ip (senf::IPv4Packet ::createAfter(eth)); senf::UDPPacket udp (senf::UDPPacket ::createAfter(ip)); - senf::DataPacket payload (senf::DataPacket ::createAfter(udp, + senf::DataPacket payload (senf::DataPacket ::createAfter(udp, std::string("Hello, world!"))); udp->source() = 2000u; @@ -198,7 +198,7 @@ ip->destination() = senf::INet4Address::from_string("192.168.0.2"); eth->source() = senf::MACAddress::from_string("00:11:22:33:44:55"); eth->destination() = senf::MACAddress::from_string("00:11:22:33:44:66"); - + eth.finalizeAll(); \endcode @@ -224,14 +224,14 @@ \code #include "Packets.hh" \endcode - + explicitly. \warning Never include any other Packets library header directly, only include \c Packets.hh or one (or several) protocol headers from the protocol bundles. Most every use of the packet library starts with some concrete packet typedef. Some fundamental - packet types are provided by \ref protocolbundle_default. + packet types are provided by \ref protocolbundle_default. \section packet_usage_create Creating a new packet @@ -247,7 +247,7 @@ senf::EthernetPacket eth (senf::EthernetPacket::create()); senf::IPv4Packet ip (senf::IPv4Packet ::createAfter(eth)); senf::UDPPacket udp (senf::UDPPacket ::createAfter(ip)); - senf::DataPacket payload (senf::DataPacket ::createAfter(udp, + senf::DataPacket payload (senf::DataPacket ::createAfter(udp, std::string("Hello, world!"))); \endcode @@ -271,7 +271,7 @@ ip->destination() = senf::INet4Address::from_string("192.168.0.2"); eth->source() = senf::MACAddress::from_string("00:11:22:33:44:55"); eth->destination() = senf::MACAddress::from_string("00:11:22:33:44:66"); - + eth.finalizeAll(); \endcode @@ -292,7 +292,7 @@ The chain navigation functions are also used to parse a packet. Let's read an Ethernet packet from a packet socket handle: - + \code senf::PacketSocketHandle sock(); sock.bind( senf::LLSocketAddress("eth0")); @@ -323,10 +323,10 @@ \section packet_usage_container The raw data container - + Every packet is based internally on a raw data container holding the packet data. This container is accessed via senf::Packet::data() member. - + This container is a random access container. It can be used like an ordinary STL container and supports all the standard container members. @@ -383,7 +383,7 @@ \code eth.data().insert(eth.data().end(), 5, 0x01); - assert( eth.data().end() == ip.data().end() + 5 + assert( eth.data().end() == ip.data().end() + 5 && ip.data().end() == udp.data().end() ); // Or alternatively: (You could even use eth.data().end() here ... it's the same) @@ -442,7 +442,7 @@ \endcode Additionally, the parsers have a parser specific API which allows to manipulate or query the - value. + value. This is a very abstract description of the parser structure. For a more concrete description, we need to differentiate between the different parser types @@ -483,7 +483,7 @@ \subsection packet_usage_fields_collection Collection parsers - Besides simple composites, the packet library has support for more complex collections. + Besides simple composites, the packet library has support for more complex collections. \li The senf::ArrayParser allows to repeat an arbitrary parser a fixed number of times. \li senf::VectorParser and senf::ListParser are two different types of lists with variable @@ -509,7 +509,7 @@ To demonstrate nested collections, we use the \c MLDv2ReportPacket as an example. The relevant fields of this packet are; - + @@ -521,7 +521,7 @@
nrOfRecordsIntegerNumber of multicast address records
recordsList of RecordsList of multicast groups and sources
nrOfSourcesIntegerNumber of sources in this record
sourcesVector of IPv6 AddressesMulticast sources
- + The first example will iterate over the sources in a \c MLDv2QueryPacket: \code @@ -531,7 +531,7 @@ MLDv2QueryPacket::Parser::sources_t::container sources (mld->sources()); // Iterate over all the addresses in that list - for (MLDv2QueryPacket::Parser::sources_t::container::iterator i (sources.begin()); + for (MLDv2QueryPacket::Parser::sources_t::container::iterator i (sources.begin()); i != sources.end(); ++i) std::cout << *i << std::endl; \endcode @@ -569,7 +569,7 @@ // Allocate a collection wrapper for the multicast address record typedef MLDv2ReportPacket::Parser::records_t::value_type::sources_t Sources; Sources::container sources (i->sources()); - + // Iterate over the sources in this record for (Sources::container::iterator i (sources.begin()); i != sources.end(); ++i) @@ -588,10 +588,10 @@ parser). Any change made to the packet not via the collection wrapper has the potential to invalidate the wrapper if it changes the packets size. - \see + \see senf::VectorParser / senf::VectorParser_Container Interface of the vector parser \n senf::ListParser / senf::ListParser_Container Interface of the list parser - + \subsubsection packet_usage_collection_variant The Variant Parser @@ -659,7 +659,7 @@ fbips.resize(addrs.size()); std::copy(addrs.begin(), addrs.end(), fbips.begin()); \endcode - + \note Here we have documented the default variant interface as it is preferred. It is possible to define variants in a different way giving other names to the special members (\c has_\e name or \c init_\e name etc.). This must be documented with the composite or protocol parser @@ -678,9 +678,9 @@ struct Timestamp { senf::ClockService::clock_t value; }; - - std::ostream & operator<<(std::ostream & os, Timestamp const & tstamp) { - os << tstamp.value; return os; + + std::ostream & operator<<(std::ostream & os, Timestamp const & tstamp) { + os << tstamp.value; return os; } senf::EthernetPacket packet (senf::EthernetPacket::create(senf::noinit)); @@ -691,21 +691,21 @@ In the same way, the annotation can be used later \code - if (senf::ClockService::now() - packet.annotation().value + if (senf::ClockService::now() - packet.annotation().value > senf::ClockService::seconds(1)) { // this packet is to old // ... } \endcode - + It is very important to define a specific structure (or class or enum) type for each type of annotation. \e Never directly store a fundamental type as an annotation: The name of the type is used to look up the annotation, so you can store only one annotation for each built-in type. \c typedef does not help since \c typedef does not introduce new type names, it only defines an alias. - The annotation type must support the output \c operator<< for description purposes - (e.g. for the \ref senf::Packet::dump() "Packet::dump()" member). + The annotation type must support the output \c operator<< for description purposes + (e.g. for the \ref senf::Packet::dump() "Packet::dump()" member). Of course, the annotation structure can be arbitrary. However, one very important caveat: If the annotation is not a POD type, it needs to inherit from senf::ComplexAnnotation. A type is POD, @@ -728,7 +728,7 @@ // Or store a reference to the annotation for easier access ReadInfo & info (packet.annotation()); - + if (info.interface == "eth0") { // ... } @@ -779,11 +779,11 @@ SENF_PARSER_FINALIZE(EthernetPacketParser); }; \endcode - + There are a lot of other possibilities to define fields. See \ref packetparsermacros for a detailed description of the macro language which is used to define composite parsers. - \see + \see \ref packetparsermacros \section packet_new_type The packet type policy class @@ -796,7 +796,7 @@ in this packet \li It provides methods to initialize a new packet and get information about the packet size - All this information is provided via static or typedef members. + All this information is provided via static or typedef members. \code struct EthernetPacketType diff --git a/senf/Packets/Packet.ct b/senf/Packets/Packet.ct index 073a9f8..f478535 100644 --- a/senf/Packets/Packet.ct +++ b/senf/Packets/Packet.ct @@ -38,9 +38,9 @@ prefix_ OtherPacket senf::Packet::find(NoThrow_t) const { Packet p (*this); - while (p && ! p.is()) + while (p && ! p.is()) p = p.next(nothrow); - if (p) + if (p) return p.as(); else return OtherPacket(); @@ -51,9 +51,9 @@ prefix_ OtherPacket senf::Packet::rfind(NoThrow_t) const { Packet p (*this); - while (p && ! p.is()) + while (p && ! p.is()) p = p.prev(nothrow); - if (p) + if (p) return p.as(); else return OtherPacket(); diff --git a/senf/Packets/Packet.cti b/senf/Packets/Packet.cti index 21600c6..5d79a2b 100644 --- a/senf/Packets/Packet.cti +++ b/senf/Packets/Packet.cti @@ -232,7 +232,7 @@ senf::ConcretePacket::createAfter(Packet const & packet, size_type s template prefix_ senf::ConcretePacket -senf::ConcretePacket::createAfter(Packet const & packet, size_type size, +senf::ConcretePacket::createAfter(Packet const & packet, size_type size, senf::NoInit_t) { return ConcretePacket(interpreter::createAfter(packet.ptr(), size, senf::noinit)); diff --git a/senf/Packets/Packet.hh b/senf/Packets/Packet.hh index d6dc393..db53195 100644 --- a/senf/Packets/Packet.hh +++ b/senf/Packets/Packet.hh @@ -242,7 +242,7 @@ namespace senf { Packet first() const; ///< Return first packet in chain - template OtherPacket first() const; + template OtherPacket first() const; ///< Return first packet in chain and cast /**< \throws std::bad_cast if the first() packet is not of type \a OtherPacket */ diff --git a/senf/Packets/Packet.test.cc b/senf/Packets/Packet.test.cc index 0581add..e917d72 100644 --- a/senf/Packets/Packet.test.cc +++ b/senf/Packets/Packet.test.cc @@ -43,7 +43,7 @@ namespace { typedef unsigned key_t; }; - struct FooPacketType + struct FooPacketType : public senf::PacketTypeBase, public senf::PacketTypeMixin { @@ -57,7 +57,7 @@ namespace { // mode. Otherwise, mixin::nextPacketRange() would query the parser for it's size to find // the header size. Since the parser is VoidPacketParser, the header size would therefore be // 0 - static size_type initHeadSize() + static size_type initHeadSize() { return initSize(); } }; typedef senf::ConcretePacket FooPacket; @@ -65,7 +65,7 @@ namespace { struct BarPacketParser : public senf::PacketParserBase { # include SENF_FIXED_PARSER() - + SENF_PARSER_FIELD( type, senf::UInt16Parser ); SENF_PARSER_FIELD( length, senf::Int32Parser ); SENF_PARSER_FIELD( reserved, senf::UInt16Parser ); @@ -77,7 +77,7 @@ namespace { SENF_PARSER_FINALIZE(BarPacketParser); }; - struct BarPacketType + struct BarPacketType : public senf::PacketTypeBase, public senf::PacketTypeMixin { @@ -116,7 +116,7 @@ namespace { std::ostream & operator<<(std::ostream & os, IntAnnotation const & v) { os << v.value; return os; } - + struct LargeAnnotation { char value[32]; }; @@ -152,7 +152,7 @@ namespace { SENF_AUTO_UNIT_TEST(packet) { - senf::Packet packet (FooPacket::create()); + senf::Packet packet (FooPacket::create()); BarPacket::createAfter(packet); BOOST_REQUIRE( packet ); @@ -171,7 +171,7 @@ SENF_AUTO_UNIT_TEST(packet) BOOST_CHECK( packet.next().is() ); BOOST_CHECK( packet.first() == packet ); BOOST_CHECK( packet.last() == packet.next() ); - + senf::Packet p2 (packet.next()); BOOST_CHECK( p2 ); packet.parseNextAs(); @@ -180,7 +180,7 @@ SENF_AUTO_UNIT_TEST(packet) BOOST_CHECK( packet.next().is() ); BOOST_CHECK( ! p2 ); BOOST_CHECK( packet.next().as() ); - + p2 = packet.next().clone(); BOOST_REQUIRE( p2 ); packet.next().append( p2 ); @@ -193,19 +193,19 @@ SENF_AUTO_UNIT_TEST(packet) BOOST_CHECK_EQUAL( senf::PacketRegistry::key(packet), 1u ); packet.next().parseNextAs( senf::PacketRegistry::lookup(2u).factory() ); BOOST_CHECK( packet.next().next().is() ); - + std::stringstream s; packet.dump(s); - BOOST_CHECK_EQUAL( s.str(), + BOOST_CHECK_EQUAL( s.str(), "Annotations:\n" " (anonymous namespace)::ComplexAnnotation: no value\n" " (anonymous namespace)::IntAnnotation: 0\n" "BarPacket:\n" " type: 0\n" " length: 0\n" ); - + packet.finalizeAll(); - BOOST_CHECK_EQUAL( packet.last().as()->type(), + BOOST_CHECK_EQUAL( packet.last().as()->type(), BarPacket::Parser::type_t::value_type(-1) ); packet.last().append(FooPacket::create()); packet.finalizeThis(); @@ -236,7 +236,7 @@ SENF_AUTO_UNIT_TEST(packet) BOOST_CHECK( packet.last().rfind() == packet.last() ); BOOST_CHECK( packet.next() == packet.next() ); BOOST_CHECK( packet.last().prev().prev() == packet ); - + senf::DataPacket::createAfter(packet); BOOST_CHECK_THROW( packet.next().next().next().parseNextAs(), senf::InvalidPacketChainException ); @@ -268,13 +268,13 @@ SENF_AUTO_UNIT_TEST(concretePacket) // No 'u' suffix here to check, that the disable_if works ... BOOST_CHECK_EQUAL( FooPacket::createAfter(packet,10).size(), 10u ); BOOST_CHECK_EQUAL( packet.size(), 14u ); - + BOOST_CHECK_EQUAL( FooPacket::createAfter(packet,2u,senf::noinit).size(), 2u ); BOOST_CHECK_EQUAL( packet.size(), 6u ); - + BOOST_CHECK_EQUAL( FooPacket::createAfter(packet,data).size(), 6u ); BOOST_CHECK_EQUAL( packet.size(), 10u ); - + BOOST_CHECK_EQUAL( FooPacket::createBefore(packet).size(), 14u ); BOOST_CHECK_EQUAL( packet.size(), 10u ); @@ -307,7 +307,7 @@ SENF_AUTO_UNIT_TEST(packetAssign) bar2->type() << 0x2A2Bu; bar1.parser() << bar2; - + BOOST_CHECK_EQUAL( bar1->type(), 0x2A2Bu ); } diff --git a/senf/Packets/PacketData.hh b/senf/Packets/PacketData.hh index 4218a71..6d1b3f7 100644 --- a/senf/Packets/PacketData.hh +++ b/senf/Packets/PacketData.hh @@ -44,12 +44,12 @@ namespace senf { Whenever the data is manipulated through PacketData, the change is assumed to be within the data range of that packet: All insertions take place \e inside \c this packet and \e outside - any following packets in the packet chain. + any following packets in the packet chain. \warning It is not permissible to change data belonging to a following packet/header/interpreter even though this data is part of \c this sequence. Doing so will corrupt the packet data. - + \par \warning When accessing packet data via the PacketData interface you are on your own: The @@ -91,21 +91,21 @@ namespace senf { ///@} /////////////////////////////////////////////////////////////////////////// - + ///\name Sequence interface to raw data ///@{ iterator begin() const; ///< Return iterator to beginning /**< Returns an random access iterator referring to the first byte of the packet data. */ - iterator end() const; ///< Return iterator to end - /**< Returns an random access iterator referring to the + iterator end() const; ///< Return iterator to end + /**< Returns an random access iterator referring to the byte past the end of the packet data. */ size_type size() const; ///< Returns the number of bytes in the packet data. bool empty() const; ///< Test whether the packet data is empty. /**< Returns whether the packet data is empty, i.e. whether its size - is 0. This function does not modify the content of the packet - data in any way. To clear the content use clear() */ + is 0. This function does not modify the content of the packet + data in any way. To clear the content use clear() */ byte operator[](size_type n) const; ///< Access byte in the packet data byte & operator[](size_type n); ///< Access byte in the packet data @@ -128,7 +128,7 @@ namespace senf { void erase(iterator pos); void erase(iterator first, iterator last); void clear(); ///< All bytes of the packet data dropped, leaving the container with a size of 0. */ - + void resize(size_type n, byte v=0); void reserve(size_type n); diff --git a/senf/Packets/PacketData.test.cc b/senf/Packets/PacketData.test.cc index d69f875..2da2126 100644 --- a/senf/Packets/PacketData.test.cc +++ b/senf/Packets/PacketData.test.cc @@ -47,23 +47,23 @@ SENF_AUTO_UNIT_TEST(packetData) senf::PacketInterpreterBase::ptr pi (senf::PacketInterpreter::create()); senf::PacketData & d (pi->data());\ - + BOOST_CHECK( d.begin() == d.end() ); BOOST_CHECK_EQUAL( d.size(), 0u ); BOOST_CHECK( d.empty() ); - + d.insert(d.begin(), 0xabu); BOOST_CHECK_EQUAL( d.size(), 1u ); BOOST_CHECK_EQUAL( d[0], 0xabu ); BOOST_CHECK( !d.empty() ); - + d.insert(d.begin(), 10, 0xcdu ); BOOST_CHECK_EQUAL( d.size(), 11u ); BOOST_CHECK_EQUAL( d[0], 0xcdu ); BOOST_CHECK_EQUAL( d[9], 0xcdu ); BOOST_CHECK_EQUAL( d[10], 0xabu ); - senf::PacketData::byte data[] = + senf::PacketData::byte data[] = { 0xf0u, 0xf1u, 0xf2u, 0xf3u, 0xf4u, 0xf5u, 0xf6u, 0xf7u }; d.insert(d.begin()+5, data, data+sizeof(data)/sizeof(data[0])); BOOST_CHECK_EQUAL( d.size(), 19u ); @@ -74,7 +74,7 @@ SENF_AUTO_UNIT_TEST(packetData) d.erase(d.begin()); BOOST_CHECK_EQUAL( d.size(), 18u ); BOOST_CHECK_EQUAL( d[4], 0xf0u ); - + d.erase(d.begin(), d.begin()+11); BOOST_CHECK_EQUAL( d.size(), 7u ); BOOST_CHECK_EQUAL( d[0], 0xf7u ); @@ -111,7 +111,7 @@ SENF_AUTO_UNIT_TEST(safePacketIterator) BOOST_CHECK( i == senf::safe_data_iterator(d,d.begin()) ); BOOST_CHECK( senf::PacketData::iterator(i) == d.begin() ); - senf::PacketData::byte data[] = + senf::PacketData::byte data[] = { 0xf0u, 0xf1u, 0xf2u, 0xf3u, 0xf4u, 0xf5u, 0xf6u, 0xf7u }; d.resize(sizeof(data)/sizeof(data[0])); BOOST_CHECK( senf::PacketData::iterator(i) == d.begin() ); @@ -119,7 +119,7 @@ SENF_AUTO_UNIT_TEST(safePacketIterator) BOOST_CHECK_EQUAL( d.size(), sizeof(data)/sizeof(data[0]) ); BOOST_CHECK_EQUAL( *(i+sizeof(data)/sizeof(data[0])-1), 0xf7u ); - BOOST_CHECK_EQUAL( std::distance(i,senf::safe_data_iterator(d,d.end())), + BOOST_CHECK_EQUAL( std::distance(i,senf::safe_data_iterator(d,d.end())), senf::PacketData::difference_type(d.size()) ); *(++i) = 0x01u; BOOST_CHECK_EQUAL( d[1], 0x01u ); diff --git a/senf/Packets/PacketImpl.cc b/senf/Packets/PacketImpl.cc index 5fc7bf9..4639a05 100644 --- a/senf/Packets/PacketImpl.cc +++ b/senf/Packets/PacketImpl.cc @@ -40,7 +40,7 @@ unsigned senf::detail::AnnotationIndexerBase::maxAnnotations (0); prefix_ void senf::detail::AnnotationIndexerBase::dump(PacketImpl * p, std::ostream & os) { - for(std::vector::const_iterator + for(std::vector::const_iterator i (registry().begin()), i_end (registry().end()); i != i_end; ++i) (*i)->v_dump(p,os); diff --git a/senf/Packets/PacketImpl.cci b/senf/Packets/PacketImpl.cci index 690414f..d7a2ec3 100644 --- a/senf/Packets/PacketImpl.cci +++ b/senf/Packets/PacketImpl.cci @@ -201,7 +201,7 @@ prefix_ void senf::detail::PacketImpl::dumpAnnotations(std::ostream & os) AnnotationIndexerBase::dump(this, os); } -// This function has a problem being inlined. Somehow, often when calling this, the size of the +// This function has a problem being inlined. Somehow, often when calling this, the size of the // resulting inlined code would be huge? prefix_ void senf::detail::PacketImpl::release(refcount_t n) diff --git a/senf/Packets/PacketImpl.hh b/senf/Packets/PacketImpl.hh index e98a8c6..8c64647 100644 --- a/senf/Packets/PacketImpl.hh +++ b/senf/Packets/PacketImpl.hh @@ -91,8 +91,8 @@ namespace detail { }; template - struct AnnotationIndexer - : public senf::singleton< AnnotationIndexer >, + struct AnnotationIndexer + : public senf::singleton< AnnotationIndexer >, public AnnotationIndexerBase { AnnotationIndexer(); @@ -105,7 +105,7 @@ namespace detail { # if 0 // The test is difficult since it does not work with user-defined trivial constructors # ifdef BOOST_HAS_TYPE_TRAITS_INTRINSICS - BOOST_STATIC_ASSERT(( (boost::has_trivial_constructor::value + BOOST_STATIC_ASSERT(( (boost::has_trivial_constructor::value && boost::has_trivial_destructor::value) || Complex )); @@ -221,7 +221,7 @@ namespace detail { refcount_t refcount_; raw_container data_; interpreter_list interpreters_; - + typedef std::vector Annotations; Annotations annotations_; diff --git a/senf/Packets/PacketImpl.test.cc b/senf/Packets/PacketImpl.test.cc index 2a2b74a..6305d93 100644 --- a/senf/Packets/PacketImpl.test.cc +++ b/senf/Packets/PacketImpl.test.cc @@ -106,7 +106,7 @@ SENF_AUTO_UNIT_TEST(packetImpl_data) senf::PacketInterpreterBase::ptr pi (senf::PacketInterpreter::create()); senf::detail::PacketImpl * p (senf::detail::packet::test::TestDriver::impl(pi)); - senf::detail::PacketImpl::byte data[] = + senf::detail::PacketImpl::byte data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; p->insert(&pi->data(),p->begin(),data, data+sizeof(data)); @@ -114,7 +114,7 @@ SENF_AUTO_UNIT_TEST(packetImpl_data) BOOST_CHECK_EQUAL(p->begin()[0], 0x00u); BOOST_CHECK_EQUAL(p->begin()[7], 0x07u); BOOST_CHECK_EQUAL(pi->data().size(), p->size()); - + p->insert(&pi->data(),p->begin()+2,0xf0u); BOOST_CHECK_EQUAL(p->size(),9u); BOOST_CHECK_EQUAL(p->begin()[8], 0x07u); @@ -131,7 +131,7 @@ SENF_AUTO_UNIT_TEST(packetImpl_data) BOOST_CHECK_EQUAL(p->size(),16u); BOOST_CHECK_EQUAL(p->begin()[0], 0x01u); BOOST_CHECK_EQUAL(pi->data().size(), p->size()); - + p->erase(&pi->data(),p->begin()+2, p->begin()+7); BOOST_CHECK_EQUAL(p->size(),11u); BOOST_CHECK_EQUAL(p->begin()[2], 0x07u); @@ -185,12 +185,12 @@ SENF_AUTO_UNIT_TEST(packetImpl_interpreters) BOOST_CHECK( pi1->data().begin() == p->begin() ); BOOST_CHECK( pi2->data().begin() == p->begin() ); BOOST_CHECK( pi3->data().begin() == p->end() ); - + p->insert(&pi3->data(),p->end(), 0x00u); BOOST_CHECK_EQUAL(pi1->data().size(), 11u); BOOST_CHECK_EQUAL(pi2->data().size(), 11u); BOOST_CHECK_EQUAL(pi3->data().size(), 1u); - + p->insert(&pi1->data(),p->end(), 2, 0x00u); BOOST_CHECK_EQUAL(pi1->data().size(), 13u); BOOST_CHECK_EQUAL(pi2->data().size(), 11u); diff --git a/senf/Packets/PacketInterpreter.cc b/senf/Packets/PacketInterpreter.cc index 9c7e3b2..285ed9a 100644 --- a/senf/Packets/PacketInterpreter.cc +++ b/senf/Packets/PacketInterpreter.cc @@ -55,11 +55,11 @@ prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::append(ptr { if (next()) impl().truncateInterpreters(next().get()); - + optional_range r (nextPacketRange()); if (!r) throw InvalidPacketChainException(); - + ptr rv (packet->appendClone(&impl(), *r)); rv->data().resize(packet->data().size()); std::copy(packet->data().begin(), packet->data().end(), rv->data().begin()); diff --git a/senf/Packets/PacketInterpreter.cci b/senf/Packets/PacketInterpreter.cci index 7eec8e5..71bf36d 100644 --- a/senf/Packets/PacketInterpreter.cci +++ b/senf/Packets/PacketInterpreter.cci @@ -154,7 +154,7 @@ prefix_ void senf::PacketInterpreterBase::add_ref() prefix_ bool senf::PacketInterpreterBase::release() { - if (impl_) + if (impl_) // This call will set impl_ to 0 if we just removed the last reference ... impl_->release(); return intrusive_refcount_t::release() && !impl_; diff --git a/senf/Packets/PacketInterpreter.ct b/senf/Packets/PacketInterpreter.ct index 2278181..428f54f 100644 --- a/senf/Packets/PacketInterpreter.ct +++ b/senf/Packets/PacketInterpreter.ct @@ -43,11 +43,11 @@ senf::PacketInterpreterBase::parseNextAs() optional_range r (nextPacketRange()); if (!r) throw InvalidPacketChainException(); - + if (next()) impl().truncateInterpreters(next().get()); - typename PacketInterpreter::ptr pi + typename PacketInterpreter::ptr pi (PacketInterpreter::create(&impl(),r->begin(),r->end(),Append)); return pi; } @@ -118,7 +118,7 @@ senf::PacketInterpreter::createAfter(PacketInterpreterBase::ptr pack optional_range r (packet->nextPacketRange()); if (!r) throw InvalidPacketChainException(); - + if (packet->next()) packet->impl().truncateInterpreters(packet->next().get()); @@ -379,7 +379,7 @@ senf::PacketInterpreter::FactoryImpl::parseNext(PacketInterpreterBas optional_range r (packet->nextPacketRange()); if (!r) throw InvalidPacketChainException(); - + if (packet->next()) packet->impl().truncateInterpreters(packet->next().get()); @@ -387,7 +387,7 @@ senf::PacketInterpreter::FactoryImpl::parseNext(PacketInterpreterBas } template -const typename senf::PacketInterpreter::FactoryImpl +const typename senf::PacketInterpreter::FactoryImpl senf::PacketInterpreter::factory_; ///////////////////////////////ct.e//////////////////////////////////////// diff --git a/senf/Packets/PacketInterpreter.hh b/senf/Packets/PacketInterpreter.hh index 0a546a6..d0fcca4 100644 --- a/senf/Packets/PacketInterpreter.hh +++ b/senf/Packets/PacketInterpreter.hh @@ -44,14 +44,14 @@ namespace senf { template class PacketInterpreter; /** \brief Internal: Base packet interpreter class - + \internal This is the base class for the persistent interpreter. This class encapsulates all the functionality accessible via the packet handle, most handle operations are just forwarded. */ class PacketInterpreterBase - : protected PacketData, + : protected PacketData, public detail::packet::interpreter_list_base, public intrusive_refcount_t { @@ -83,7 +83,7 @@ namespace senf { almost any one of the create / createAfter / createBefore static PacketInterpreter without static information on the type of packet to create. */ - struct Factory { + struct Factory { virtual ~Factory(); // Create completely new packet @@ -94,18 +94,18 @@ namespace senf { virtual ptr create(size_type size, senf::NoInit_t) const = 0; template ptr create(ForwardReadableRange const & range) const; - + // Create packet as new packet after a given packet virtual ptr createAfter(PacketInterpreterBase::ptr packet) const = 0; virtual ptr createAfter(PacketInterpreterBase::ptr packet, senf::NoInit_t) const = 0; virtual ptr createAfter(PacketInterpreterBase::ptr packet, size_type size) const = 0; - virtual ptr createAfter(PacketInterpreterBase::ptr packet, size_type size, + virtual ptr createAfter(PacketInterpreterBase::ptr packet, size_type size, senf::NoInit_t) const = 0; template - ptr createAfter(PacketInterpreterBase::ptr packet, + ptr createAfter(PacketInterpreterBase::ptr packet, ForwardReadableRange const & range) const; - + // Create packet as new packet (header) const before a given packet virtual ptr createBefore(PacketInterpreterBase::ptr packet) const = 0; @@ -132,9 +132,9 @@ namespace senf { virtual ~PacketInterpreterBase(); static factory_t no_factory(); - + ptr clone(); - + ///@} /////////////////////////////////////////////////////////////////////////// @@ -160,7 +160,7 @@ namespace senf { using PacketData::valid; PacketData & data(); - + ///@} ///\name Annotations @@ -278,7 +278,7 @@ namespace senf { static ptr createAfter(PacketInterpreterBase::ptr packet, size_type size); static ptr createAfter(PacketInterpreterBase::ptr packet, size_type size, senf::NoInit_t); template - static ptr createAfter(PacketInterpreterBase::ptr packet, + static ptr createAfter(PacketInterpreterBase::ptr packet, ForwardReadableRange const & range); // Create packet as new packet (header) before a given packet @@ -327,7 +327,7 @@ namespace senf { // virtual interface virtual optional_range v_nextPacketRange(); - virtual PacketInterpreterBase::ptr v_appendClone(detail::PacketImpl * impl, + virtual PacketInterpreterBase::ptr v_appendClone(detail::PacketImpl * impl, iterator base, iterator new_base); virtual PacketInterpreterBase::ptr v_appendClone(detail::PacketImpl * impl, range r); virtual void v_finalize(); @@ -339,7 +339,7 @@ namespace senf { // factory /** \brief Internal: Implementation of abstract factory interface - + \internal Implements the abstract factory interface for \a PacketType @@ -351,27 +351,27 @@ namespace senf { virtual PacketInterpreterBase::ptr create(senf::NoInit_t) const; virtual PacketInterpreterBase::ptr create(size_type size) const; virtual PacketInterpreterBase::ptr create(size_type size,senf::NoInit_t) const; - + // Create packet as new packet after a given packet - virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet) + virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet) const; - virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet, + virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet, senf::NoInit_t) const; - virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet, + virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet, size_type size) const; - virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet, + virtual PacketInterpreterBase::ptr createAfter(PacketInterpreterBase::ptr packet, size_type size, senf::NoInit_t) const; - + // Create packet as new packet (header) before a given packet - virtual PacketInterpreterBase::ptr createBefore(PacketInterpreterBase::ptr packet) + virtual PacketInterpreterBase::ptr createBefore(PacketInterpreterBase::ptr packet) const; virtual PacketInterpreterBase::ptr createBefore(PacketInterpreterBase::ptr packet, - senf::NoInit_t) + senf::NoInit_t) const; - virtual PacketInterpreterBase::ptr createInsertBefore(PacketInterpreterBase::ptr packet) + virtual PacketInterpreterBase::ptr createInsertBefore(PacketInterpreterBase::ptr packet) const; virtual PacketInterpreterBase::ptr createInsertBefore(PacketInterpreterBase::ptr packet, senf::NoInit_t) @@ -379,7 +379,7 @@ namespace senf { // Parse next packet in chain - virtual PacketInterpreterBase::ptr parseNext(PacketInterpreterBase::ptr packet) + virtual PacketInterpreterBase::ptr parseNext(PacketInterpreterBase::ptr packet) const; }; @@ -393,11 +393,11 @@ namespace senf { /** \brief Invalid packet chain operation This exception signals an invalid operation on the chain like trying to find a non-existent - chain member and other similar error conditions. + chain member and other similar error conditions. */ struct InvalidPacketChainException : public senf::Exception { InvalidPacketChainException() : senf::Exception("invalid packet chain") {} }; - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Packets/PacketParser.cc b/senf/Packets/PacketParser.cc index c97421f..f61ae20 100644 --- a/senf/Packets/PacketParser.cc +++ b/senf/Packets/PacketParser.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/PacketParser.cci b/senf/Packets/PacketParser.cci index 0fa3347..db3939d 100644 --- a/senf/Packets/PacketParser.cci +++ b/senf/Packets/PacketParser.cci @@ -50,26 +50,26 @@ prefix_ senf::PacketParserBase::data_iterator senf::PacketParserBase::end() } prefix_ senf::PacketParserBase::ParserProtector::ParserProtector(PacketParserBase const * p) - : safe_i_( *p), parser_(p) + : safe_i_( *p), parser_(p) {} prefix_ senf::PacketParserBase::ParserProtector::ParserProtector(ParserProtector const & other_) - : safe_i_( *other_.parser_), parser_(other_.parser_) + : safe_i_( *other_.parser_), parser_(other_.parser_) { other_.parser_ = 0; } -prefix_ senf::PacketParserBase::ParserProtector::~ParserProtector() -{ - if (parser_) const_cast(parser_)->i_ = safe_i_; +prefix_ senf::PacketParserBase::ParserProtector::~ParserProtector() +{ + if (parser_) const_cast(parser_)->i_ = safe_i_; } // protected members prefix_ senf::PacketParserBase::ParserProtector senf::PacketParserBase::protect() const -{ - return ParserProtector(this); +{ + return ParserProtector(this); } prefix_ bool senf::PacketParserBase::check(size_type size) @@ -78,7 +78,7 @@ prefix_ bool senf::PacketParserBase::check(size_type size) return size <= size_type(std::distance(i(),end())); } -prefix_ void senf::PacketParserBase::validate(size_type size) +prefix_ void senf::PacketParserBase::validate(size_type size) const { if (! check(size)) @@ -89,7 +89,7 @@ prefix_ senf::PacketParserBase::PacketParserBase(data_iterator i, state_type s) : i_ (i), data_ (s) {} -prefix_ senf::PacketParserBase::PacketParserBase(data_iterator i, state_type s, +prefix_ senf::PacketParserBase::PacketParserBase(data_iterator i, state_type s, size_type size) : i_ (i), data_ (s) { diff --git a/senf/Packets/PacketParser.ct b/senf/Packets/PacketParser.ct index f025d54..01569dd 100644 --- a/senf/Packets/PacketParser.ct +++ b/senf/Packets/PacketParser.ct @@ -32,7 +32,7 @@ #ifndef DOXYGEN template -prefix_ typename boost::enable_if< +prefix_ typename boost::enable_if< boost::is_base_of, Parser >::type senf::operator<<(Parser target, Parser source) { diff --git a/senf/Packets/PacketParser.cti b/senf/Packets/PacketParser.cti index abbc3d7..fb53bb1 100644 --- a/senf/Packets/PacketParser.cti +++ b/senf/Packets/PacketParser.cti @@ -74,8 +74,8 @@ prefix_ senf::PacketParserBase::size_type senf::bytes(Parser p) #ifndef DOXYGEN template -prefix_ typename boost::enable_if_c < - boost::is_base_of::value +prefix_ typename boost::enable_if_c < + boost::is_base_of::value && ! boost::is_base_of::value, Parser >::type senf::operator<<(Parser target, Value const & value) { @@ -90,8 +90,8 @@ prefix_ Parser senf::operator<<(Parser target, Value const & value) #ifndef DOXYGEN template -prefix_ typename boost::enable_if_c < - boost::is_base_of::value +prefix_ typename boost::enable_if_c < + boost::is_base_of::value && ! boost::is_base_of::value, Parser >::type senf::operator<<(Parser target, boost::optional const & value) { diff --git a/senf/Packets/PacketParser.hh b/senf/Packets/PacketParser.hh index ea2d64f..2e8547c 100644 --- a/senf/Packets/PacketParser.hh +++ b/senf/Packets/PacketParser.hh @@ -24,7 +24,7 @@ \brief PacketParser public header */ /** \defgroup packetparser The PacketParser facility - + The PacketParser facility provides a framework to implement very lightweight classes which parse the raw content of a packet into meaningful values. PacketParsers are always passed around by value, they can be understood as pointers into the packet data with added type @@ -61,7 +61,7 @@ the field name. Each returns a parser object. Simple parsers can be used like their corresponding basic type (e.g. a UInt16Parser field can be used like an unsigned integer), more complex parsers provide type specific access members. Assigning a value to a parser will change - the underlying representation (the packet data). + the underlying representation (the packet data). Parsers can be grouped into several categories. These categories are not all defined rigorously but are nevertheless helpful when working with the parsers: @@ -86,7 +86,7 @@ processing fields in some way and so on). You should however be very wary to access data outside the range assigned to the packet (the range starting at \c i() and with a size of senf::bytes() bytes). - + Each parser type has specific features \subsection parserimpl_value Value parsers @@ -95,7 +95,7 @@ \code // SomeParser must have a 'value_type', The 'value_type' must be default constructible, copy // constructible and assignable - SomeParser::value_type v; + SomeParser::value_type v; // An instance of 'SomeParser' must have a 'value' member which returns a value which may be // assigned to a variable of type 'value_type' @@ -127,7 +127,7 @@ \see parsecollection \subsection parserimpl_composite Composite parsers - + If possible, composite parsers should be implemented using the \ref packetparsermacros. In addition to the normal parser requirements, these macros ensure, that for each field, fieldname_t is a typedef for the fields parser and @@ -169,7 +169,7 @@ namespace senf { class Packet; - + /** \brief Parser Base class Parsers come in two flavors: fixed and dynamically sized parsers. A fixed size @@ -180,7 +180,7 @@ namespace senf { A dynamically sized parser on the other hand infers it's size from the contents of the data parsed. Any parser containing at least one dynamically sized sub-parser will itself be dynamically sized. - + Both kinds of parser need to derive from PacketParserBase and implement several required members. Which members to implement depends on the parsers flavor. There are two ways how to do this. @@ -215,7 +215,7 @@ namespace senf { // //////////////////////////////////////////////////////////////////////// - // Add here members returning (sub-)parsers for the fields. The 'parse' member is + // Add here members returning (sub-)parsers for the fields. The 'parse' member is // used to construct the sub-parsers. This member either takes an iterator to the // data to be parsed or just an offset in bytes. @@ -223,7 +223,7 @@ namespace senf { senf::UInt16Parser size() const { return parse( 2 ); } }; \endcode - + You should never call the \c bytes() member of a parser directly. Instead you should use the freestanding senf::bytes() function. This function will return the correct size irrespective of the parsers flavor. You may access \c fixed_bytes directly, however be aware that this @@ -271,8 +271,8 @@ namespace senf { offset. However, the parser checks, that the iterator is still within range of the raw data container. Otherwise a TruncatedPacketException is - thrown. - + thrown. + \throws TruncatedPacketException if the raw data container does not hold at least \a offset bytes starting at i(). */ @@ -295,20 +295,20 @@ namespace senf { struct ParserProtector { senf::safe_data_iterator safe_i_; mutable PacketParserBase const * parser_; - + ParserProtector( PacketParserBase const * parser); ParserProtector(ParserProtector const & other_); ~ParserProtector(); }; protected: ParserProtector protect() const; - + PacketParserBase(data_iterator i, state_type s); ///< Standard constructor /**< This is the constructor used by most parsers. The parameters are just forwarded from the derived classes constructor parameters. */ - PacketParserBase(data_iterator i, state_type s, size_type size); + PacketParserBase(data_iterator i, state_type s, size_type size); ///< Size checking constructor /**< In addition to the standard constructor, this constructor will validate, that there is enough data in @@ -387,7 +387,7 @@ namespace senf { }; /** \brief Return raw size parsed by the given parser object - + This function will either call p.bytes() or return Parser::fixed_bytes depending on the type of parser. @@ -402,7 +402,7 @@ namespace senf { */ template PacketParserBase::size_type bytes(Parser p); - + namespace detail { template class ParserInitBytes; } namespace detail { template class ParserIsFixed; } @@ -445,7 +445,7 @@ namespace senf { # ifndef DOXYGEN template - typename boost::enable_if< + typename boost::enable_if< boost::is_base_of, Parser >::type operator<<(Parser target, Parser source); @@ -469,17 +469,17 @@ namespace senf { # ifndef DOXYGEN template - typename boost::enable_if_c < - boost::is_base_of::value + typename boost::enable_if_c < + boost::is_base_of::value && ! boost::is_base_of::value, Parser >::type operator<<(Parser target, Value const & value); -# else +# else /** \brief Generic parser value assignment This operator allows to assign a value to parsers which implement a value(\a value) member. This operator allows to use a common syntax for assigning values or - parsers to a parser. + parsers to a parser. \ingroup packetparser */ @@ -489,17 +489,17 @@ namespace senf { # ifndef DOXYGEN template - typename boost::enable_if_c < - boost::is_base_of::value + typename boost::enable_if_c < + boost::is_base_of::value && ! boost::is_base_of::value, Parser >::type operator<<(Parser target, boost::optional const & value); -# else +# else /** \brief Generic parser value assignment This operator allows to assign a value to parsers which implement a value(\a value) member. This special version allows to assign optional values: IF the - optional value is not set, the assignment will be skipped. + optional value is not set, the assignment will be skipped. This operator allows to use a common syntax for assigning values or parsers to a parser. @@ -511,7 +511,7 @@ namespace senf { /** \brief Default parser parsing nothing */ - struct VoidPacketParser + struct VoidPacketParser : public PacketParserBase { # include SENF_FIXED_PARSER() diff --git a/senf/Packets/PacketParser.ih b/senf/Packets/PacketParser.ih index a44fe83..2eb95af 100644 --- a/senf/Packets/PacketParser.ih +++ b/senf/Packets/PacketParser.ih @@ -40,7 +40,7 @@ namespace detail { // Use SFINAE to check, if Parser has an integer-valued fixed_bytes member. If not, // 'Parser_TakeNum' fails and the overload is removed from the overload - // set. + // set. template PacketParserBase::size_type packetParserSize( Parser p, int, senf::mpl::take_uint * = 0); @@ -61,7 +61,7 @@ namespace detail { // This version of ParserInitBytes_Choose uses 'Parser::init_bytes' to provide 'value' (via // 'boost::integral_constant') template - struct ParserInitBytes_Choose + struct ParserInitBytes_Choose : public boost::integral_constant {}; // ^^-- g++ error signaled here: // error: 'fixed_bytes' is not a member of 'some-class-name' diff --git a/senf/Packets/PacketRegistry.cci b/senf/Packets/PacketRegistry.cci index 2e0c48f..b1280c5 100644 --- a/senf/Packets/PacketRegistry.cci +++ b/senf/Packets/PacketRegistry.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/PacketRegistry.hh b/senf/Packets/PacketRegistry.hh index 882f693..fe21ab5 100644 --- a/senf/Packets/PacketRegistry.hh +++ b/senf/Packets/PacketRegistry.hh @@ -78,7 +78,7 @@ namespace senf { static registration only works when the symbol is included into the final binary. To force this inclusion, you should not put packet registrations into a library but into an object file. - + To simplify static registration the SENF_PACKET_REGISTRY_REGISTER macro can be used: \code SENF_PACKET_REGISTRY_REGISTER(SomeTag, SomePacket, key_of_somePacket); diff --git a/senf/Packets/PacketRegistry.test.cc b/senf/Packets/PacketRegistry.test.cc index 0e320f9..9c596e9 100644 --- a/senf/Packets/PacketRegistry.test.cc +++ b/senf/Packets/PacketRegistry.test.cc @@ -68,7 +68,7 @@ SENF_AUTO_UNIT_TEST(packetRegistry_test) BOOST_CHECK_EQUAL( PacketRegistry::key(), 1u ); BOOST_CHECK_EQUAL( PacketRegistry::key(), 2u ); - BOOST_CHECK_THROW( PacketRegistry::key(), + BOOST_CHECK_THROW( PacketRegistry::key(), PacketTypeNotRegisteredException ); BOOST_CHECK_EQUAL( PacketRegistry::key(), "foo" ); diff --git a/senf/Packets/PacketType.ct b/senf/Packets/PacketType.ct index caec158..2358810 100644 --- a/senf/Packets/PacketType.ct +++ b/senf/Packets/PacketType.ct @@ -42,8 +42,8 @@ senf::PacketTypeMixin::nextPacketRange(Packet const & p) /// (the function address) Self::initHeadSize is different from PacketTypeBase::initHeadSize if (sz == PacketTypeBase::size_type(-1)) { typename Self::size_type headsz (bytes(p.as< ConcretePacket >().parser())); - return p.data().size() < headsz ? - PacketTypeBase::no_range() : + return p.data().size() < headsz ? + PacketTypeBase::no_range() : PacketInterpreterBase::optional_range( PacketTypeBase::range(boost::next(p.data().begin(), headsz), p.data().end())); @@ -56,7 +56,7 @@ senf::PacketTypeMixin::nextPacketRange(Packet const & p) // // So, the helper only works with fixed-size parsers if the packet has a trailer. return p.data().size() < Self::initSize() ? - PacketTypeBase::no_range() : + PacketTypeBase::no_range() : PacketInterpreterBase::optional_range( PacketTypeBase::range(boost::next(p.data().begin(),sz), boost::prior(p.data().end(),Self::initSize()-sz))); diff --git a/senf/Packets/PacketType.hh b/senf/Packets/PacketType.hh index 931ef4b..c6b4cfc 100644 --- a/senf/Packets/PacketType.hh +++ b/senf/Packets/PacketType.hh @@ -49,7 +49,7 @@ namespace senf { { typedef senf::ConcretePacket packet; typedef SomePacketParser parser; - + static size_type initSize() { // This value can in most cases be taken from the parser @@ -109,7 +109,7 @@ namespace senf { struct PacketTypeBase { typedef Packet packet; - + typedef senf::detail::packet::iterator iterator; typedef senf::detail::packet::const_iterator const_iterator; typedef senf::detail::packet::size_type size_type; @@ -127,7 +127,7 @@ namespace senf { typedef VoidPacketParser parser; ///< Parser to parser packet fields /**< This typedef has to be set to the parser of the packet - + The default is a VoidPacketParser which does not parse any field. */ @@ -142,8 +142,8 @@ namespace senf { /**< This function gives the index within a newly created, empty packet where a sub-packet is to be placed. - The default implementation returns initSize(). - + The default implementation returns initSize(). + \implementation Ok, it does not really return initSize(), it returns size_type(-1) which is interpreted to mean initSize(). It can't return @@ -160,14 +160,14 @@ namespace senf { The default implementation does nothing. */ - + static optional_range nextPacketRange(packet p); ///< Get next packet placement /**< nextPacketRange returns the iterator range where the next packet (header) is placed within the current packet. - + The default implementation always returns no_range(). @@ -184,7 +184,7 @@ namespace senf { ///< Get type of next packet /**< nextPacketType retrieves the type of the next packet returning a factory to create that packet. - + The default implementation always returns no_factory(). @@ -200,8 +200,8 @@ namespace senf { /**< finalize() will be called to complete a packet after it has been modified. This function must calculate any checksums, set size fields from the interpreter chain - etc. - + etc. + The default implementation does nothing. */ static void dump(packet p, std::ostream & os); @@ -217,25 +217,25 @@ namespace senf { /** \brief Mixin to provide standard implementations for nextPacketRange and nextPacketType This mixin class simplifies the definition of simple packets: - + \li The packets consist of three sections: The header, the payload and an optional trailer. \li If the packet has a trailer, both the header and the trailer must have a fixed size. This mixin provides the nextPacketRange() member as well as initSize() and init(). If you additionally provide the optional \a Registry argument, PacketTypeMixin provides a simple - implementation of nextPacketType(). + implementation of nextPacketType(). When using the PacketTypeMixin, the implementation of a packet is simplified to: \code // Here 'SomeRegistryTag' is optional - struct SimplePacketType + struct SimplePacketType : public senf::PacketTypeBase, public senf::PacketTypeMixin { typedef senf::PacketTypeMixin mixin; typedef senf::ConcretePacket packet; typedef SomePacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; // Only if the optional 'Registry' argument is provided using mixin::initSize; @@ -251,7 +251,7 @@ namespace senf { static void finalize(packet p) { - // Set the type field by querying the type of the next packet. This is an + // Set the type field by querying the type of the next packet. This is an // optional assignment: If the key is not found, the value returned by 'key' // is an empty optional and the assignment will be skipped. p->typeField << key(p.next(senf::nothrow)); @@ -278,16 +278,16 @@ namespace senf { Most of the members are optional, which reduces the minimal implementation of a packet to: \code - struct SimplePacketType + struct SimplePacketType : public senf::PacketTypeBase, public senf::PacketTypeMixin { typedef senf::PacketTypeMixin mixin; typedef senf::ConcretePacket packet; typedef SomePacketParser parser; - + using mixin::nextPacketRange; - using mixin::nextPacketType; + using mixin::nextPacketType; using mixin::initSize; using mixin::init; @@ -319,8 +319,8 @@ namespace senf { next packet from information stored in the current packets header, the key() member will look up the type of packet \a p in the registry and return it's - key. - + key. + If either \a p is an in - valid() packet or the packet type is not found in the registry, the returned optional value will be empty. */ @@ -337,7 +337,7 @@ namespace senf { static PacketInterpreterBase::factory_t nextPacketType (Packet const & p); static PacketInterpreterBase::size_type initSize (); static void init (Packet const & p); - + ///@} }; diff --git a/senf/Packets/PacketTypes.hh b/senf/Packets/PacketTypes.hh index 87c6df4..162bf39 100644 --- a/senf/Packets/PacketTypes.hh +++ b/senf/Packets/PacketTypes.hh @@ -55,7 +55,7 @@ namespace packet { struct smart_pointer { typedef boost::intrusive_ptr ptr_t; }; - + struct interpreter_list_tag; typedef boost::intrusive::ilist_base_hook interpreter_list_base; typedef interpreter_list_base::value_traits interpreter_list_type; @@ -66,7 +66,7 @@ namespace packet { typedef std::vector raw_container; typedef raw_container::size_type size_type; typedef raw_container::difference_type difference_type; - + typedef raw_container::iterator iterator; typedef raw_container::const_iterator const_iterator; typedef long refcount_t; // This is long since boost uses long for refcounts .. hmm .. diff --git a/senf/Packets/ParseHelpers.dox b/senf/Packets/ParseHelpers.dox index 2ff88af..0faba76 100644 --- a/senf/Packets/ParseHelpers.dox +++ b/senf/Packets/ParseHelpers.dox @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -77,7 +77,7 @@ SENF_MPL_SLOT_INIT_ZERO(bitfield_size); SENF_MPL_SLOT_INIT_ZERO(group); - void init_chain (senf::mpl::rv <0> *) const {} + void init_chain (senf::mpl::rv <0> *) const {} size_type field_offset_ (senf::mpl::rv <0> *) const { return 0; } // ///////////////////////////////////////////////////////////////////////// @@ -104,13 +104,13 @@ void init_chain (senf::mpl::rv *) const { init_chain (static_cast *>(0)); - } + } public: size_type type_offset() const { return field_offset_(static_cast *>(0)) - - SENF_MPL_SLOT_GET(bitfield_size); + SENF_MPL_SLOT_GET(bitfield_size); } static size_type const type_init_bytes = SENF_MPL_SLOT_GET(init_bytes) - SENF_MPL_SLOT_GET(bitfield_size); @@ -158,7 +158,7 @@ return 1; } template - struct content__key_value_template + struct content__key_value_template : public senf::detail::VariantKey {}; template friend class senf::detail::VariantKey; typedef senf::detail::VariantKeyTransform< @@ -171,16 +171,16 @@ // start SENF_PARSER_COLLECTION_I static bool const content__aux_fixed = (SENF_MPL_SLOT_GET(group) - type_group) == 0; - typedef senf::detail::ParserAuxPolicySelect < - type_t, + typedef senf::detail::ParserAuxPolicySelect < + type_t, SENF_MPL_SLOT_GET(init_bytes) - type_init_bytes, - content__aux_fixed + content__aux_fixed >::type content__aux_policy; typedef content__traits::parser::type content__collection_t; SENF_MPL_SLOT_SET(bit, 0); SENF_MPL_SLOT_SET(bitfield_size, 0); - typedef content__collection_t content__t; + typedef content__collection_t content__t; static size_type const content__index = SENF_MPL_SLOT_GET(index) + 1; SENF_MPL_SLOT_SET(index, content__index); void init_chain (senf::mpl::rv *) const @@ -204,7 +204,7 @@ return content__next_offset(); } SENF_MPL_SLOT_SET(init_bytes, content__next_init_bytes); - static size_type const content__group = + static size_type const content__group = SENF_MPL_SLOT_GET(group) + (senf::is_fixed::value ? 0 : 1); SENF_MPL_SLOET_SET(group, content__group); template < class T > @@ -242,7 +242,7 @@ void init_content() const { content_().init<1>(); - } + } bool has_content() const { return content_().variant() == 1; @@ -260,9 +260,9 @@ {} private: - template + template void init(T) const - { + { defaultInit (); } diff --git a/senf/Packets/ParseHelpers.hh b/senf/Packets/ParseHelpers.hh index 0fa7a00..5e9683f 100644 --- a/senf/Packets/ParseHelpers.hh +++ b/senf/Packets/ParseHelpers.hh @@ -64,7 +64,7 @@ The macros take care of the following: \li They define the accessor functions returning parsers of the given type. \li They automatically calculate the offset of the fields from the preceding fields. - \li The macros provide a definition for \c init() + \li The macros provide a definition for \c init() \li The macros define the \c bytes(), \c fixed_bytes and \c init_bytes members as needed. You may define either a fixed or a dynamically sized parser. Fixed size parsers are defined by @@ -103,14 +103,14 @@ # include SENF_FIXED_PARSER() SENF_PARSER_FIELD ( table_id , UInt8Parser ); - + SENF_PARSER_BITFIELD ( ssi , 1 , bool ); SENF_PARSER_BITFIELD ( private_indicator , 1 , bool ); SENF_PARSER_SKIP_BITS( 2 ); SENF_PARSER_BITFIELD ( sec_length , 12 , unsigned ); - + SENF_PARSER_FIELD ( table_id_extension , UInt16Parser ); - + SENF_PARSER_FINALIZE( Parse_DSMCCSection ); }; @@ -134,7 +134,7 @@ This code defines two parsers, the second of which is based on the first. Both are fixed size parsers. The definition of \c Parse_DSMCCSection is straight forward (more on bit fields - below). + below). The derived parser is a little bit more complex. It starts out the same defining itself as a fixed size parser. Then the base class is imported. Among other things, this call sets the @@ -197,7 +197,7 @@ the \e name() accessor member is not the parser but the parsers value and therefore it does not allow assignment to the field. - \par \c PRIVATE: Fields private to the parser class + \par \c PRIVATE: Fields private to the parser class A private field will not be accessible from the outside (it is made \c private to the parser class). This is very handy when providing other accessor members to access a field in a manner more suitable for the specific field, when combining several fields into a single @@ -218,7 +218,7 @@ \subsection parsermacrosbitfields Bit-fields - \par "" + \par "" \ref SENF_PARSER_BITFIELD(), \ref SENF_PARSER_BITFIELD_RO(), \ref SENF_PARSER_PRIVATE_BITFIELD()\n @@ -254,7 +254,7 @@ \ref SENF_PARSER_SKIP(), \ref SENF_PARSER_SKIP_BITS(), \ref SENF_PARSER_GOTO(), \ref SENF_PARSER_GOTO_OFFSET(), \ref SENF_PARSER_LABEL() - To define more complex parsers, there are some macro commands which change the current offset. + To define more complex parsers, there are some macro commands which change the current offset. \ref SENF_PARSER_SKIP(\e bytes) will skip the given number of bytes. \ref SENF_PARSER_SKIP_BITS(\e bits) will work within bitfield definition to skip that number of bits. @@ -269,7 +269,7 @@ then later be referenced using \ref SENF_PARSER_GOTO(). This also defines name_offset as a constant or member (for fixed respectively dynamically sized parsers). - + It is very important to recognize, that the size of the parser is defined by the current offset at the time \ref SENF_PARSER_FINALIZE() is called. This allows to arbitrarily manipulate the size of the parser by changing the current offset accordingly. For dynamically @@ -285,7 +285,7 @@ ///@{ /** \brief Define fixed size parser - + This macro must be called using \c \#include at the beginning of every fixed size parser using the packet parser helper macros: @@ -302,7 +302,7 @@ #define SENF_FIXED_PARSER() SENF_ABSOLUTE_INCLUDE_PATH(Packets/parse_fixed_setup.hh) /** \brief Define dynamically sized parser - + This macro must be called using \c \#include at the beginning of every dynamically sized parser using the packet parser helper macros: @@ -353,7 +353,7 @@ SENF_PARSER_INHERIT(BaseParser) \endcode - + If you want to define collection fields which reference auxiliary fields in the base parser, you must define the base parser as a variable parser not a fixed parser. @@ -368,9 +368,9 @@ constructor, parser size, parser initialization). \ref SENF_PARSER_FINALIZE() needs not be the last macro command within the parser though it will often be the last command since \ref SENF_PARSER_FINALIZE() does not account for fields defined later. - + \ref SENF_PARSER_FINALIZE() uses the information from \ref SENF_PARSER_INHERIT() to construct - the parsers base class (which must be a valid parser class). + the parsers base class (which must be a valid parser class). \c defaultInit() is defined to initialize all fields defined before the call to \ref SENF_PARSER_FINALIZE(). Fields defined later will \e not be initialized. If \ref @@ -424,10 +424,10 @@ \see \ref SENF_PARSER_FIELD_RO(), \ref SENF_PARSER_PRIVATE_FIELD() \hideinitializer */ -#define SENF_PARSER_FIELD(name, type) +#define SENF_PARSER_FIELD(name, type) /** \brief Define parser field (read-only) - + Define read-only parser field. Read-only fields may only be defined for \a type's which are value parsers: The parser \a type must have a \c value_type typedef member and a \c value() member, which returns the current value of the field. @@ -435,11 +435,11 @@ Defining such a field really defines \e two accessors: A read/write \e private field and a read-only \e public accessor. The name of the private read/write field is given by adding a trailing '_' to \a name. The read-only public accessor is called \a name. - - \see SENF_PARSER_FIELD() + + \see SENF_PARSER_FIELD() \hideinitializer */ -#define SENF_PARSER_FIELD_RO(name, type) +#define SENF_PARSER_FIELD_RO(name, type) /** \brief Define parser field (private) @@ -449,7 +449,7 @@ \see SENF_PARSER_FIELD() \hideinitializer */ -#define SENF_PARSER_PRIVATE_FIELD(name, type) +#define SENF_PARSER_PRIVATE_FIELD(name, type) /** \brief Define custom field accessor @@ -462,11 +462,11 @@ return parse( xyz_offset ); } \endcode - + The macro defines the same auxiliary symbols defined by \ref SENF_PARSER_FIELD(\a name, \a type), the accessor method however is provided by the user. - \a size depends on the type of parser being defined: + \a size depends on the type of parser being defined: \li If defining a fixed parser, \a size is a single value \a bytes which must be a constant integral expression giving the fixed size of the field. @@ -480,7 +480,7 @@ \param[in] size size of the field, either a single value \a bytes for fixed size parsers or two separate arguments \a bytes and \a init_bytes for dynamically sized parsers */ -#define SENF_PARSER_CUSTOM_FIELD(name, type, size) +#define SENF_PARSER_CUSTOM_FIELD(name, type, size) ///@} @@ -491,13 +491,13 @@ Bit fields are supported by a special family of parser macros. These macros simplify defining fields using the senf::IntFieldParser, senf::UIntFieldParser and senf::FlagParser parsers by - keeping track of the current bit position and automatically creating the correct template + keeping track of the current bit position and automatically creating the correct template parameters. - + The \a type parameter specifies the type of bitfield to define. This value is one of \li \c signed, for signed bit fields (senf::IntFieldParser) - \li \c unsigned, for unsigned bit fields (senf::UIntFieldParser) or - \li \c bool, for single-bit flags (senf::FlagParser). + \li \c unsigned, for unsigned bit fields (senf::UIntFieldParser) or + \li \c bool, for single-bit flags (senf::FlagParser). The \a bits parameter specifies the number of bits the field covers. For \c signed or \c unsigned fields, this value may be any numeric value from 1 to 32, for \c bool fields, this @@ -512,18 +512,18 @@ \see \ref SENF_PARSER_BITFIELD_RO(), \ref SENF_PARSER_PRIVATE_BITFIELD() \hideinitializer */ -#define SENF_PARSER_BITFIELD(name, bits, type) +#define SENF_PARSER_BITFIELD(name, bits, type) -/** \brief Define bit-field (read-only) +/** \brief Define bit-field (read-only) Define read-only bit field. This is for bit-fields what \ref SENF_PARSER_FIELD_RO is for ordinary fields. \see \ref SENF_PARSER_BITFIELD() \n \ref SENF_PARSER_FIELD_RO() \hideinitializer */ -#define SENF_PARSER_BITFIELD_RO(name, bits, type) +#define SENF_PARSER_BITFIELD_RO(name, bits, type) -/** \brief Define bit-field (private) +/** \brief Define bit-field (private) Define a bit field which is marked as \c private and may only be accessed from the parser class itself. @@ -531,7 +531,7 @@ \see \ref SENF_PARSER_BITFIELD() \hideinitializer */ -#define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type) +#define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type) ///@} @@ -588,8 +588,8 @@ /** \brief Change current offset to explicit value \ref SENF_PARSER_GOTO_OFFSET() allows to change the current offset manually to an arbitrary - value. The \a offset parameter depends on the type of field currently being defined. - + value. The \a offset parameter depends on the type of field currently being defined. + \li If defining a fixed size parser, the \a offset argument is a single \a bytes value which is an integral constant expression to which the offset will be set. \li If defining a dynamically sized parser, the \a offset argument is given by two @@ -608,7 +608,7 @@ This command defines \a name as a label for the current offset. The member name_offset is defined (either as a constant for fixed size parsers or as a member function for dynamically sized parsers) to return the position at the point of label - definition. + definition. \ref SENF_PARSER_GOTO() can later be used to jump to a position which has previously been labeled with \ref SENF_PARSER_LABEL() @@ -648,7 +648,7 @@ #define SENF_PARSER_FIXED_OFFSET(name) /** \brief Get current fixed offset, if possible - + This macro will return the current fixed offset, a compile-time constant expression. This is always possible when defining a fixed size parser. diff --git a/senf/Packets/ParseHelpers.test.cc b/senf/Packets/ParseHelpers.test.cc index d04b474..e840603 100644 --- a/senf/Packets/ParseHelpers.test.cc +++ b/senf/Packets/ParseHelpers.test.cc @@ -47,7 +47,7 @@ namespace { SENF_PARSER_CUSTOM_FIELD ( customField , int, 2 ) { return parse(customField_offset); } - + SENF_PARSER_BITFIELD ( signedBitfield , 4, signed ); SENF_PARSER_BITFIELD ( unsignedBitfield , 3, unsigned ); SENF_PARSER_BITFIELD ( boolBitfield , 1, bool ); @@ -67,7 +67,7 @@ namespace { SENF_PARSER_PRIVATE_FIELD ( privLowbyteOfNormalField , senf::UInt8Parser ); - unsigned lowbyteOfNormalField() { + unsigned lowbyteOfNormalField() { return privLowbyteOfNormalField(); } @@ -81,14 +81,14 @@ namespace { # include SENF_FIXED_PARSER() SENF_PARSER_INHERIT( FixedBaseParser ); - + SENF_PARSER_FIELD ( derivedField , senf::UInt16Parser ); SENF_PARSER_LABEL( end ); SENF_PARSER_GOTO( signedBitfield ); SENF_PARSER_FIELD ( anotherOverlay , senf::UInt16Parser ); - + SENF_PARSER_GOTO( end ); SENF_PARSER_FINALIZE( FixedDerivedParser ) @@ -140,7 +140,7 @@ SENF_AUTO_UNIT_TEST(fixedParser) BOOST_CHECK_EQUAL ( derivedParser.overlayOfRoField() , 0x0304 ); BOOST_CHECK_EQUAL ( derivedParser.overlayOfBitfield() , 0x83u ); BOOST_CHECK_EQUAL ( derivedParser.lowbyteOfNormalField() , 0x02u ); - + BOOST_CHECK_EQUAL ( derivedParser.derivedField() , 0x0708u ); BOOST_CHECK_EQUAL ( derivedParser.anotherOverlay() , 0x8384u ); } @@ -157,7 +157,7 @@ namespace { SENF_PARSER_CUSTOM_FIELD ( customField , int, 2, 2 ) { return parse(customField_offset()); } - + SENF_PARSER_BITFIELD ( signedBitfield , 4, signed ); SENF_PARSER_BITFIELD ( unsignedBitfield , 3, unsigned ); SENF_PARSER_BITFIELD ( boolBitfield , 1, bool ); @@ -177,7 +177,7 @@ namespace { SENF_PARSER_PRIVATE_FIELD ( privLowbyteOfNormalField , senf::UInt8Parser ); - unsigned lowbyteOfNormalField() { + unsigned lowbyteOfNormalField() { return privLowbyteOfNormalField(); } @@ -191,14 +191,14 @@ namespace { # include SENF_PARSER() SENF_PARSER_INHERIT( VariableBaseParser ); - + SENF_PARSER_FIELD ( derivedField , senf::UInt16Parser ); SENF_PARSER_LABEL( end ); SENF_PARSER_GOTO( signedBitfield ); SENF_PARSER_FIELD ( anotherOverlay , senf::UInt16Parser ); - + SENF_PARSER_GOTO( end ); SENF_PARSER_FINALIZE( VariableDerivedParser ); @@ -212,7 +212,7 @@ SENF_AUTO_UNIT_TEST(variableParser) senf::DataPacket p (senf::DataPacket::create(data)); VariableBaseParser baseParser (p.data().begin(), &p.data()); - + BOOST_CHECK_EQUAL ( senf::bytes(baseParser), 8u ); BOOST_CHECK_EQUAL ( baseParser.normalField() , 0x0102u ); @@ -250,7 +250,7 @@ SENF_AUTO_UNIT_TEST(variableParser) BOOST_CHECK_EQUAL ( derivedParser.overlayOfRoField() , 0x0304 ); BOOST_CHECK_EQUAL ( derivedParser.overlayOfBitfield() , 0x83u ); BOOST_CHECK_EQUAL ( derivedParser.lowbyteOfNormalField() , 0x02u ); - + BOOST_CHECK_EQUAL ( derivedParser.derivedField() , 0x0708u ); BOOST_CHECK_EQUAL ( derivedParser.anotherOverlay() , 0x8384u ); } diff --git a/senf/Packets/SafeIterator.cci b/senf/Packets/SafeIterator.cci index dbd1264..b703ede 100644 --- a/senf/Packets/SafeIterator.cci +++ b/senf/Packets/SafeIterator.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/SafeIterator.cti b/senf/Packets/SafeIterator.cti index a798945..0f551aa 100644 --- a/senf/Packets/SafeIterator.cti +++ b/senf/Packets/SafeIterator.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/SafeIterator.hh b/senf/Packets/SafeIterator.hh index b0ff4bf..b182b83 100644 --- a/senf/Packets/SafeIterator.hh +++ b/senf/Packets/SafeIterator.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -59,7 +59,7 @@ namespace senf { typedef PacketData::size_type size_type; safe_data_iterator(); ///< Make uninitialized iterator - explicit safe_data_iterator(PacketData & data); + explicit safe_data_iterator(PacketData & data); ///< Construct iterator only setting the data container safe_data_iterator(PacketData & data, PacketData::iterator i); ///< Initialize iterator to given position diff --git a/senf/Packets/StringParser.cti b/senf/Packets/StringParser.cti index 11c50ee..3391466 100644 --- a/senf/Packets/StringParser.cti +++ b/senf/Packets/StringParser.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -32,30 +32,30 @@ template prefix_ senf::StringParser::StringParser(data_iterator i, state_type s) - : PacketParserBase(i, s, init_bytes) + : PacketParserBase(i, s, init_bytes) {} template prefix_ typename senf::StringParser::size_type senf::StringParser::bytes() const -{ - return length().value() + senf::bytes(length()); +{ + return length().value() + senf::bytes(length()); } template prefix_ typename senf::StringParser::value_type senf::StringParser::value() const -{ - validate(bytes()); - return std::string(i()+senf::bytes(length()), i()+bytes()); +{ + validate(bytes()); + return std::string(i()+senf::bytes(length()), i()+bytes()); } template prefix_ void senf::StringParser::value(value_type v) -{ +{ validate(bytes()); - resize(bytes(), v.size()+senf::bytes(length())); - length() << v.size(); + resize(bytes(), v.size()+senf::bytes(length())); + length() << v.size(); std::copy(v.begin(), v.end(), i()+senf::bytes(length())); } @@ -63,13 +63,13 @@ template prefix_ senf::StringParser::operator value_type() const { - return value(); + return value(); } template prefix_ typename senf::StringParser const & senf::StringParser::operator=(value_type other) -{ - value(other); return *this; +{ + value(other); return *this; } template diff --git a/senf/Packets/StringParser.hh b/senf/Packets/StringParser.hh index 022f25f..e44560e 100644 --- a/senf/Packets/StringParser.hh +++ b/senf/Packets/StringParser.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - + template class StringParser : public PacketParserBase @@ -49,11 +49,11 @@ namespace senf { # include SENF_PARSER() SENF_PARSER_PRIVATE_FIELD ( length, LengthParser ); - + typedef std::string value_type; static const size_type init_bytes = senf::init_bytes::value; size_type bytes() const; - + value_type value() const; void value(value_type v); operator value_type() const; @@ -62,7 +62,7 @@ namespace senf { template std::ostream & operator<<(std::ostream & os, StringParser const & value); - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Packets/StringParser.test.cc b/senf/Packets/StringParser.test.cc index f6fa8b0..b1a0532 100644 --- a/senf/Packets/StringParser.test.cc +++ b/senf/Packets/StringParser.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -38,7 +38,7 @@ namespace { struct VoidPacket : public senf::PacketTypeBase {}; - + typedef senf::StringParser MyStringParser; } diff --git a/senf/Packets/VariantParser.cti b/senf/Packets/VariantParser.cti index 4ae950c..5a582e6 100644 --- a/senf/Packets/VariantParser.cti +++ b/senf/Packets/VariantParser.cti @@ -74,7 +74,7 @@ prefix_ unsigned senf::VariantParser::variant() template template prefix_ typename boost::mpl::at< - typename senf::VariantParser::parsers, + typename senf::VariantParser::parsers, boost::mpl::int_ >::type senf::VariantParser::get() const diff --git a/senf/Packets/VariantParser.hh b/senf/Packets/VariantParser.hh index 24f0097..02b65a5 100644 --- a/senf/Packets/VariantParser.hh +++ b/senf/Packets/VariantParser.hh @@ -60,8 +60,8 @@ namespace senf { defined condition. This is the parser to use, if the type and/or number of fields of a packet change depending on some condition. \code - typedef senf::VariantParser< - MyAuxPolicy, + typedef senf::VariantParser< + MyAuxPolicy, senf::mpl::vector > MyVariantParser; \endcode This typedef defines a variant parser choosing one of three sub @@ -71,13 +71,13 @@ namespace senf { When creating a new packet containing a variant parser, the variant parser will always be initialized to the first sub-parser. - \see + \see ExampleAuxPolicy on how to implement the \a AuxPolicy \n \ref SENF_PARSER_VARIANT() on how to integrate the parser into another parser \ingroup parsecollection */ template - class VariantParser + class VariantParser : public PacketParserBase, private AuxPolicy { typedef Parsers parsers; @@ -91,9 +91,9 @@ namespace senf { size_type bytes() const; void init(); - - static const size_type init_bytes = senf::init_bytes< - typename boost::mpl::at >::type>::value + + static const size_type init_bytes = senf::init_bytes< + typename boost::mpl::at >::type>::value + AuxPolicy::aux_bytes; ///\} @@ -105,7 +105,7 @@ namespace senf { \returns Index of currently selected variant. Integer in the range from 0 to (number-of-sub-parsers - 1) */ - + template typename boost::mpl::at< parsers, boost::mpl::int_ >::type get() const; ///< Access sub-parser @@ -130,7 +130,7 @@ namespace senf { struct SomeParser : public PacketParserBase { # include SENF_PARSER() - + SENF_PARSER_PRIVATE_FIELD( type, senf::UInt8Parser ); SENF_PARSER_VARIANT( content, type, (novalue( disable, senf::VoidPacketParser )) @@ -141,10 +141,10 @@ namespace senf { SENF_PARSER_FINALIZE(SomeParser); }; - \endcode - + \endcode + The variant \c content chooses one of the sub parsers depending on the \c type field. If \c - type is 0, senf::VoidPacketParser is selected, if it is 1, senf::UInt8Parser and so on. + type is 0, senf::VoidPacketParser is selected, if it is 1, senf::UInt8Parser and so on. \warning Realize, that the \a chooser field is controlled by the variant parser. This field should therefore be declared either read-only or private and must be changed only via @@ -193,7 +193,7 @@ namespace senf { void init_name()Set the variant to have a value of this type. If the field is \c novalue, the \c init_ prefix is omitted. - + bool has_name()Return \c true, if the variant currently holds this kind of value, \c false otherwise. Only if not \c novalue. @@ -231,13 +231,13 @@ namespace senf { (senf::UInt24Parser) (senf::UInt32Parser) ); \endcode - + \param[in] name name of the field \param[in] chooser name of the field choosing the variant to use \param[in] types a Boost.Preprocessor style sequence of sub-parser types - \see - senf::VariantParser for the VariantParser API\n + \see + senf::VariantParser for the VariantParser API\n \ref SENF_PARSER_PRIVATE_VARIANT() \hideinitializer \ingroup packetparsermacros @@ -246,7 +246,7 @@ namespace senf { SENF_PARSER_VARIANT_I(public, name, chooser, types) /** \brief Define private VariantParser field - + \see \ref SENF_PARSER_VARIANT() \hideinitializer \ingroup packetparsermacros diff --git a/senf/Packets/VariantParser.ih b/senf/Packets/VariantParser.ih index f485bb2..f32ae57 100644 --- a/senf/Packets/VariantParser.ih +++ b/senf/Packets/VariantParser.ih @@ -63,7 +63,7 @@ namespace detail { template struct VariantParserPolicy - : public VariantParserPolicy< void, + : public VariantParserPolicy< void, TransformAuxParserPolicy, AuxTag > {}; @@ -75,8 +75,8 @@ namespace detail { template struct VariantParserPolicy > { typedef TransformAuxParserPolicy type; @@ -93,8 +93,8 @@ namespace detail { }; }; - template - struct VariantKey + template + struct VariantKey { static T key() { return (*KeyFn)(); } }; @@ -121,7 +121,7 @@ namespace detail { static Out get(In v); static In set(Out v); }; - + # define SENF_PARSER_VARIANT_I(access, name, chooser, types) \ SENF_PARSER_REQUIRE_VAR(variant) \ protected: \ @@ -185,7 +185,7 @@ namespace detail { # define SENF_PARSER_VARIANT_IFNOTNA(id, x) \ BOOST_PP_EXPR_IIF( BOOST_PP_NOT( SENF_PARSER_VARIANT_NA(id) ), x ) - + # define SENF_PARSER_VARIANT_MAKEACCESSOR_VALUE(name, i, elem, id) \ SENF_PARSER_VARIANT_IFNOTNA( id, \ typedef SENF_PARSER_VARIANT_GETTYPE(elem) \ @@ -193,7 +193,7 @@ namespace detail { BOOST_PP_CAT(id, _t) id() const \ { return name().get(); } \ ) - + # define SENF_PARSER_VARIANT_MAKEACCESSOR_HAS(name, i, elem, id) \ SENF_PARSER_VARIANT_IFNOTNA( id, \ bool id() const \ diff --git a/senf/Packets/VariantParser.test.cc b/senf/Packets/VariantParser.test.cc index 20dfc13..8498300 100644 --- a/senf/Packets/VariantParser.test.cc +++ b/senf/Packets/VariantParser.test.cc @@ -40,7 +40,7 @@ SENF_AUTO_UNIT_TEST(VariantParser) typedef senf::ArrayParser<10, senf::UInt8Parser> Array10; typedef senf::VariantParser< senf::detail::FixedAuxParserPolicy, boost::mpl::vector > Variant; - + unsigned char data[] = { 0x01, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B }; senf::DataPacket p (senf::DataPacket::create(data)); @@ -55,7 +55,7 @@ SENF_AUTO_UNIT_TEST(VariantParser) BOOST_REQUIRE_EQUAL( p.data().size(), 11u ); BOOST_REQUIRE_EQUAL( v.variant(), 0u ); BOOST_CHECK_EQUAL( senf::bytes(v), 0u ); - + v.init<2>(); // v invalidated } @@ -78,13 +78,13 @@ SENF_AUTO_UNIT_TEST(VariantParser) }; } -// We can't use the unnamed namespace here since there's a bug in gcc-4.2.3 which is +// We can't use the unnamed namespace here since there's a bug in gcc-4.2.3 which is // the default version of gcc on ubuntu hardy :-( // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34213 namespace VariantParser_test_cc_anon_namespace { - + struct SubParser : public senf::PacketParserBase - { + { # include SENF_FIXED_PARSER() SENF_PARSER_FIELD( foo, senf::UInt32Parser ); @@ -100,7 +100,7 @@ namespace VariantParser_test_cc_anon_namespace { SENF_PARSER_BITFIELD_RO( len, 4, unsigned ); SENF_PARSER_BITFIELD_RO( type, 4, unsigned ); // just here so the second variant is 'var' - SENF_PARSER_VARIANT( value, len, + SENF_PARSER_VARIANT( value, len, (senf::VoidPacketParser) (senf::UInt8Parser) (senf::UInt16Parser) @@ -113,14 +113,14 @@ namespace VariantParser_test_cc_anon_namespace { SENF_PARSER_FINALIZE(TestParser); }; - + } using namespace VariantParser_test_cc_anon_namespace; SENF_AUTO_UNIT_TEST(VariantParserMacro) { senf::DataPacket p (senf::DataPacket::create(senf::init_bytes::value)); - + { TestParser v (p.data().begin(), & p.data()); v.init(); diff --git a/senf/Packets/VectorParser.ct b/senf/Packets/VectorParser.ct index e98d027..e6cf32f 100644 --- a/senf/Packets/VectorParser.ct +++ b/senf/Packets/VectorParser.ct @@ -75,7 +75,7 @@ prefix_ void senf::VectorParser_Container::insert(itera size_type n, Value const & t) { - for (iterator j (shift(pos,n)); n; --n, ++j) + for (iterator j (shift(pos,n)); n; --n, ++j) *j << t; } diff --git a/senf/Packets/VectorParser.cti b/senf/Packets/VectorParser.cti index 45faf91..f6d9714 100644 --- a/senf/Packets/VectorParser.cti +++ b/senf/Packets/VectorParser.cti @@ -175,7 +175,7 @@ prefix_ void senf::VectorParser::resize(size_type n, Va template prefix_ senf::VectorParser_Container:: VectorParser_Container(parser_type const & vector) - : AuxPolicy::WrapperPolicy(static_cast(vector)), state_ (vector.state()), + : AuxPolicy::WrapperPolicy(static_cast(vector)), state_ (vector.state()), i_ (std::distance(data().begin(),vector.i())) {} diff --git a/senf/Packets/VectorParser.hh b/senf/Packets/VectorParser.hh index fda789e..c3fabc6 100644 --- a/senf/Packets/VectorParser.hh +++ b/senf/Packets/VectorParser.hh @@ -47,7 +47,7 @@ namespace senf { A Vector is a collection of fixed-size elements of which the size of the collection can be determined directly (that is without traversing the collection). This allows very efficient random access to the elements of the collection. - + A vector is a model of an STL random-access sequence. The parser only provides a reduced interface, the container wrapper however completes this interface. @@ -58,7 +58,7 @@ namespace senf { Some basic vector access methods are defined as parser members. To access the complete list API however you will need to instantiate a container wrapper for the vector. See \ref packet_usage_fields_collection. - + \see \ref How to access \ref packet_usage_fields_collection \n SENF_PARSER_VECTOR() macro used to define vector fields \n @@ -67,8 +67,8 @@ namespace senf { \ingroup parsecollection */ template - struct VectorParser - : public PacketParserBase, + struct VectorParser + : public PacketParserBase, private AuxPolicy { VectorParser(data_iterator i, state_type s); @@ -101,11 +101,11 @@ namespace senf { value_type back() const; // Mutators - + // The mutators provided here are those which don't take an iterator argument. // If you need to pass an iterator it is much simpler and cleaner to use the // 'container' wrapper - + template void push_back (Value const & value, size_type n=1) const; value_type push_back_space (size_type n=1) const; template void push_front (Value const & value, size_type n=1) const; @@ -127,7 +127,7 @@ namespace senf { the vector in the packet data). The vector container wrapper provides a complete STL random-access sequence interface. - + \code SomePacket p (...); SomePacket::aVectorCollection_t::container c (p->aVectorCollection()); @@ -221,7 +221,7 @@ namespace senf { size_type bytes() const; void init() const; - + ///@} protected: @@ -234,7 +234,7 @@ namespace senf { }; /** \brief Define VectorParser field - + This macro is a special helper to define a senf::VectorParser type field, a vector of elements of type \a elt_type (a parser) which size is given by the \a size field. @@ -255,7 +255,7 @@ namespace senf { - + @@ -280,12 +280,12 @@ namespace senf { SENF_PARSER_VECTOR ( vec, transform(MyTransform, vec_size_), senf::UInt32Parser ); SENF_PARSER_VECTOR ( vec, packetSize(), senf::UInt32Parser ); \endcode - + \param[in] name field name \param[in] size name of field giving the vector size \param[in] elt_type vector element type - \see + \see How to use \ref packet_usage_fields_collection \n senf::VectorParser the vector parser API for vector field access senf::VectorParser_Container the vector parser container API for vector field access diff --git a/senf/Packets/VectorParser.ih b/senf/Packets/VectorParser.ih index bd46aa1..6f84ed5 100644 --- a/senf/Packets/VectorParser.ih +++ b/senf/Packets/VectorParser.ih @@ -46,7 +46,7 @@ namespace detail { }; template - struct VectorParserPolicy > { @@ -65,7 +65,7 @@ namespace detail { struct VectorParserPolicy { typedef senf::detail::TransformAuxParserPolicy< - AuxPolicy, + AuxPolicy, VectorParserBytesTransform > type; }; @@ -75,7 +75,7 @@ namespace detail { template struct parser { typedef senf::VectorParser< - ElementParser, + ElementParser, typename VectorParserPolicy::type > type; }; }; @@ -91,7 +91,7 @@ namespace detail { #endif }} - + ///////////////////////////////ih.e//////////////////////////////////////// #endif diff --git a/senf/Packets/VectorParser.test.cc b/senf/Packets/VectorParser.test.cc index 9c7185b..5d137a8 100644 --- a/senf/Packets/VectorParser.test.cc +++ b/senf/Packets/VectorParser.test.cc @@ -54,7 +54,7 @@ SENF_AUTO_UNIT_TEST(VectorParser) { UInt16VectorParser v (boost::next(p->data().begin(), 1), &p->data()); - + BOOST_CHECK_EQUAL( v[0], 0x1011 ); BOOST_CHECK_EQUAL( v[2], 0x1415 ); BOOST_CHECK_EQUAL( v.size(), 3u ); @@ -63,7 +63,7 @@ SENF_AUTO_UNIT_TEST(VectorParser) p->data()[0] = 0x06; BOOST_CHECK_EQUAL( v.size(), 6u ); BOOST_CHECK_EQUAL( v.bytes(), 12u ); - + UInt16VectorParser::iterator b (v.begin()); UInt16VectorParser::iterator e (v.end()); BOOST_CHECK_EQUAL(std::distance(b,e), UInt16VectorParser::difference_type(v.size())); @@ -85,7 +85,7 @@ SENF_AUTO_UNIT_TEST(VectorParser) v.push_back_space() = 37u; BOOST_CHECK_EQUAL( v.size(), 9u ); BOOST_CHECK_EQUAL( v[8], 37u ); - + v.push_front(0xf3f4u); BOOST_CHECK_EQUAL( v.size(), 10u ); BOOST_CHECK_EQUAL( v[0], 0xf3f4u ); @@ -134,7 +134,7 @@ SENF_AUTO_UNIT_TEST(VectorParser_wrapper) BOOST_CHECK_EQUAL( w.size(), 3u ); p->data()[0] = 0x06; BOOST_CHECK_EQUAL( w.size(), 6u ); - BOOST_CHECK_EQUAL( std::distance(w.begin(),w.end()), + BOOST_CHECK_EQUAL( std::distance(w.begin(),w.end()), UInt16VectorParser::difference_type(w.size()) ); w.shift(w.begin()+1); @@ -188,7 +188,7 @@ SENF_AUTO_UNIT_TEST(dynamicPolicyVector) UInt16VectorParser v (senf::UInt8Parser(p->data().begin(), &p->data()), boost::next(p->data().begin(),1), &p->data()); UInt16VectorParser::container w (v); - + BOOST_CHECK_EQUAL( v.size(), 3u ); BOOST_CHECK_EQUAL( w.size(), 3u ); @@ -208,7 +208,7 @@ namespace { static unsigned set(unsigned v) { return v+2; } }; - struct TestVectorParser + struct TestVectorParser : public senf::PacketParserBase { # include SENF_PARSER() @@ -221,7 +221,7 @@ namespace { SENF_PARSER_FINALIZE( TestVectorParser ); }; - + struct TestVectorPacketType : public senf::PacketTypeBase, public senf::PacketTypeMixin @@ -231,7 +231,7 @@ namespace { using mixin::nextPacketRange; using mixin::init; - using mixin::initSize; + using mixin::initSize; }; typedef senf::ConcretePacket TestVectorPacket; @@ -250,7 +250,7 @@ SENF_AUTO_UNIT_TEST(vectorMacro_parse) senf::DataPacket p (senf::DataPacket::create(data)); TestVectorParser parser (p.data().begin(), &p.data()); - + BOOST_CHECK_EQUAL( parser.vec1().size(), 3u ); BOOST_CHECK_EQUAL( parser.vec2().size(), 2u ); BOOST_CHECK_EQUAL( parser.dummy(), 0x01020304u ); @@ -271,8 +271,8 @@ SENF_AUTO_UNIT_TEST(vectorMacro_create) p->vec2().push_back( 0x0B0Cu); p->vec2().push_back( 0x0D0Eu); p.finalizeAll(); - - unsigned char data[] = { + + unsigned char data[] = { 0x05, // size1 0x04, // size2 0x01, 0x02, 0x03, 0x04, // dummy @@ -282,13 +282,13 @@ SENF_AUTO_UNIT_TEST(vectorMacro_create) 0x0B, 0x0C, // vec2[0] 0x0D, 0x0E // vec2[1] }; - SENF_CHECK_EQUAL_COLLECTIONS( + SENF_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), p.data().begin(), p.data().end() ); } namespace { - - struct TestVectorBaseParser + + struct TestVectorBaseParser : public senf::PacketParserBase { # include SENF_PARSER() @@ -328,7 +328,7 @@ SENF_AUTO_UNIT_TEST(vectorMacro_inherit) senf::DataPacket p (senf::DataPacket::create(data)); TestVectorDerivedParser parser (p.data().begin(), &p.data()); - + BOOST_CHECK_EQUAL( parser.vec1().size(), 3u ); BOOST_CHECK_EQUAL( parser.vec2().size(), 2u ); BOOST_CHECK_EQUAL( parser.dummy(), 0x01020304u ); @@ -347,7 +347,7 @@ namespace { # include SENF_PARSER() SENF_PARSER_VECTOR ( vec , packetSize() , senf::UInt16Parser ); - + SENF_PARSER_FINALIZE( TestPacketSizeVectorParser ); }; diff --git a/senf/Packets/bundledump.cc b/senf/Packets/bundledump.cc index c90f9a5..15bfcf7 100644 --- a/senf/Packets/bundledump.cc +++ b/senf/Packets/bundledump.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Packets/extra-tests/AllBundles.test.cc b/senf/Packets/extra-tests/AllBundles.test.cc index 63b69b6..cd031fc 100644 --- a/senf/Packets/extra-tests/AllBundles.test.cc +++ b/senf/Packets/extra-tests/AllBundles.test.cc @@ -37,18 +37,18 @@ SENF_AUTO_UNIT_TEST(packetLink) { // This test shall test, if there is now duplicated packet registration in AllBundles. // The test will fail at the start with an assertion error in this case. - + boost::uint8_t data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // source mac 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // target mac 0x86, 0xdd, // ethertype - 0x60, 0x00, 0x00, 0x00, // IP version, class, + 0x60, 0x00, 0x00, 0x00, // IP version, class, // flow label 0x00, 0x00, // payload length 0x3B, // no next header 0x10, // hop limit 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // source ip - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // target ip 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; diff --git a/senf/Scheduler/ClockService.hh b/senf/Scheduler/ClockService.hh index 3bb09f9..1ad6e26 100644 --- a/senf/Scheduler/ClockService.hh +++ b/senf/Scheduler/ClockService.hh @@ -27,7 +27,7 @@ #define HH_SENF_Scheduler_ClockService_ 1 // Custom includes -#include +#include #include #include #include @@ -51,7 +51,7 @@ namespace senf { // To allow conversion between clock value and absolute time, the ClockService samples the // absolute current time and the clock value when the conversion is performed. This is done at // most once per second on a if-needed basis. - + /** \brief Reliable high precision monotonous clock source The ClockService provides a highly accurate monotonous clock source based on @@ -69,7 +69,7 @@ namespace senf { // Types /** \brief ClockService timer data type - + Unsigned integer type representing scheduler time. Scheduler time is measured in nanoseconds relative to some implementation defined reference time. */ @@ -96,7 +96,7 @@ namespace senf { /////////////////////////////////////////////////////////////////////////// static clock_type now(); ///< Return current clock value - + static abstime_type abstime(clock_type clock); ///< Convert clock to absolute time /**< This member converts a clock value into an absolute Boost.DateTime value. @@ -116,12 +116,12 @@ namespace senf { corresponding clock value. \see abstime */ - static clock_type from_time_t(time_t const & time); + static clock_type from_time_t(time_t const & time); ///< Convert legacy time_t to clock value - /**< This member converts an absolute time value + /**< This member converts an absolute time value represented as a time_t value into a clock value */ - static clock_type from_timeval(timeval const & time); + static clock_type from_timeval(timeval const & time); ///< Convert legacy timeval to clock value /**< This member converts an absolute time value represented as a timeval value into a clock value */ @@ -197,7 +197,7 @@ namespace senf {
\c bytes(\a size)\a size gives the size of the vector in bytes not the number of contained elements
\c packetSize()Use the size of the packet to get the vector size. The vector will occupy all space up to the end of the packet.
2md(very unusual) 2 milli-days
*/ - void parseClockServiceInterval(console::ParseCommandInfo::TokensRange const & tokens, + void parseClockServiceInterval(console::ParseCommandInfo::TokensRange const & tokens, ClockService::clock_type & out); void formatClockServiceInterval(ClockService::clock_type interval, std::ostream & os); diff --git a/senf/Scheduler/ClockService.test.cc b/senf/Scheduler/ClockService.test.cc index d634c05..77039be 100644 --- a/senf/Scheduler/ClockService.test.cc +++ b/senf/Scheduler/ClockService.test.cc @@ -38,7 +38,7 @@ namespace { - bool is_close_clock(senf::ClockService::clock_type a, senf::ClockService::clock_type b, + bool is_close_clock(senf::ClockService::clock_type a, senf::ClockService::clock_type b, senf::ClockService::clock_type delta) { return (a diff --git a/senf/Scheduler/EventHook.cci b/senf/Scheduler/EventHook.cci index 8cbec85..7c36f72 100644 --- a/senf/Scheduler/EventHook.cci +++ b/senf/Scheduler/EventHook.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/EventHook.hh b/senf/Scheduler/EventHook.hh index bec8be1..5ad9e4e 100644 --- a/senf/Scheduler/EventHook.hh +++ b/senf/Scheduler/EventHook.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -92,7 +92,7 @@ namespace scheduler { informational) \param[in] cb Callback to call \param[in] initiallyEnabled if set \c false, do not - enable callback automatically. + enable callback automatically. \param[in] priority event priority, defaults to POST */ ~EventHook(); diff --git a/senf/Scheduler/EventHook.ih b/senf/Scheduler/EventHook.ih index f430c95..4d410b3 100644 --- a/senf/Scheduler/EventHook.ih +++ b/senf/Scheduler/EventHook.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ namespace scheduler { void restart(); namespace detail { - + class EventHookDispatcher : public singleton { @@ -56,7 +56,7 @@ namespace detail { EventHookDispatcher(); ~EventHookDispatcher(); - typedef boost::intrusive::ilist< + typedef boost::intrusive::ilist< EventHookListBase::value_traits, false > EventList; EventList events_; diff --git a/senf/Scheduler/EventManager.cc b/senf/Scheduler/EventManager.cc index 4dd2064..3f755af 100644 --- a/senf/Scheduler/EventManager.cc +++ b/senf/Scheduler/EventManager.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -73,9 +73,9 @@ prefix_ void senf::scheduler::detail::EventManager::listEvents(std::ostream & os FIFORunner::iterator i (FIFORunner::instance().begin()); FIFORunner::iterator const i_end (FIFORunner::instance().end()); for (; i != i_end; ++i) - os << fmt + os << fmt % i->type() - % i->name() + % i->name() % reinterpret_cast(&(*i)) % i->runCount() % (i->runnable() ? "R" : "W") @@ -88,7 +88,7 @@ prefix_ void senf::scheduler::detail::EventManager::listEvents(std::ostream & os if (! i->enabled()) os << fmt % i->type() - % i->name() + % i->name() % reinterpret_cast(&(*i)) % i->runCount() % "-" diff --git a/senf/Scheduler/EventManager.cci b/senf/Scheduler/EventManager.cci index 8399ef8..c2ac185 100644 --- a/senf/Scheduler/EventManager.cci +++ b/senf/Scheduler/EventManager.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/EventManager.hh b/senf/Scheduler/EventManager.hh index 729b249..5495f6f 100644 --- a/senf/Scheduler/EventManager.hh +++ b/senf/Scheduler/EventManager.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -58,7 +58,7 @@ namespace detail { /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ - + explicit Event(std::string const & name); virtual ~Event(); @@ -91,7 +91,7 @@ namespace detail { public: using singleton::instance; using singleton::alive; - + struct IteratorFilter { bool operator()(Event const & e); }; diff --git a/senf/Scheduler/EventManager.test.cc b/senf/Scheduler/EventManager.test.cc index 744cfac..d9abf1d 100644 --- a/senf/Scheduler/EventManager.test.cc +++ b/senf/Scheduler/EventManager.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/FIFORunner.cc b/senf/Scheduler/FIFORunner.cc index 9908e91..62e14f5 100644 --- a/senf/Scheduler/FIFORunner.cc +++ b/senf/Scheduler/FIFORunner.cc @@ -34,7 +34,7 @@ #include #include #ifdef SENF_DEBUG - #include + #include #endif #include #include diff --git a/senf/Scheduler/FIFORunner.cci b/senf/Scheduler/FIFORunner.cci index 043c7ed..89fb2d8 100644 --- a/senf/Scheduler/FIFORunner.cci +++ b/senf/Scheduler/FIFORunner.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -73,7 +73,7 @@ prefix_ bool senf::scheduler::detail::FIFORunner::TaskInfo::v_enabled() // senf::scheduler::detail::FIFORunner::NullTask prefix_ senf::scheduler::detail::FIFORunner::NullTask::NullTask() - : senf::scheduler::detail::FIFORunner::TaskInfo ("") + : senf::scheduler::detail::FIFORunner::TaskInfo ("") {} prefix_ senf::scheduler::detail::FIFORunner::NullTask::~NullTask() diff --git a/senf/Scheduler/FIFORunner.hh b/senf/Scheduler/FIFORunner.hh index 7f9f655..0b13363 100644 --- a/senf/Scheduler/FIFORunner.hh +++ b/senf/Scheduler/FIFORunner.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ //#include "FIFORunner.mpp" ///////////////////////////////hh.p//////////////////////////////////////// -namespace senf { +namespace senf { namespace scheduler { void restart(); @@ -56,8 +56,8 @@ namespace detail { typedef boost::intrusive::ilist, false> TaskList; public: - class TaskInfo - : public Event, + class TaskInfo + : public Event, public TaskListBase { public: @@ -72,7 +72,7 @@ namespace detail { protected: void setRunnable(); - + private: virtual void v_run() = 0; virtual bool v_enabled() const; @@ -94,7 +94,7 @@ namespace detail { void enqueue(TaskInfo * task); void dequeue(TaskInfo * task); - + void run(); void taskTimeout(unsigned ms); @@ -123,7 +123,7 @@ namespace detail { TaskList::iterator priorityEnd(TaskInfo::Priority p); void run(TaskList::iterator f, TaskList::iterator l); - + struct NullTask : public TaskInfo { NullTask(); @@ -138,7 +138,7 @@ namespace detail { NullTask normalPriorityEnd_; NullTask highPriorityEnd_; - + timer_t watchdogId_; bool watchdogRunning_; unsigned watchdogMs_; diff --git a/senf/Scheduler/FdEvent.cci b/senf/Scheduler/FdEvent.cci index 50256a0..1951111 100644 --- a/senf/Scheduler/FdEvent.cci +++ b/senf/Scheduler/FdEvent.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/FdEvent.ct b/senf/Scheduler/FdEvent.ct index f70a35c..e8c7300 100644 --- a/senf/Scheduler/FdEvent.ct +++ b/senf/Scheduler/FdEvent.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/FdEvent.cti b/senf/Scheduler/FdEvent.cti index ff752bc..40279aa 100644 --- a/senf/Scheduler/FdEvent.cti +++ b/senf/Scheduler/FdEvent.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ template prefix_ senf::scheduler::FdEvent::FdEvent(std::string const & name, Callback const & cb, Handle const & handle, int events, bool initiallyEnabled) - : detail::FIFORunner::TaskInfo (name), cb_ (cb), fd_ (detail::get_descriptor(handle)), + : detail::FIFORunner::TaskInfo (name), cb_ (cb), fd_ (detail::get_descriptor(handle)), pollable_ (true), events_ (events) { if (initiallyEnabled) diff --git a/senf/Scheduler/FdEvent.hh b/senf/Scheduler/FdEvent.hh index fed1446..0705137 100644 --- a/senf/Scheduler/FdEvent.hh +++ b/senf/Scheduler/FdEvent.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -61,13 +61,13 @@ namespace scheduler { The callback will be called with one additional argument. This argument is the event mask of type int. This mask will tell, which of the registered events are signaled. There are some additional flags which can be set when calling the handler callback: - + \li \c EV_HUP: The other end has closed the connection \li \c EV_ERR: Transport error Only a single handler may be registered for any combination of file descriptor and event otherwise a DuplicateEventRegistrationException is thrown. - + The file descriptor is specified using an arbitrary handle type which supports the \c retrieve_filehandle() protocol: There must be a global function \c retrieve_filehandle callable with the handle type. This function must return the file descriptor associated with @@ -84,21 +84,21 @@ namespace scheduler { public detail::FdSetBase, public detail::FdManager::Event { - public: + public: /////////////////////////////////////////////////////////////////////////// // Types typedef boost::function Callback; - enum Events { + enum Events { EV_NONE = 0 ///< No event , EV_READ = detail::FdManager::EV_READ ///< fd readable (or EOF) , EV_PRIO = detail::FdManager::EV_PRIO ///< OOB data available for read , EV_WRITE = detail::FdManager::EV_WRITE ///< fd writable , EV_HUP = detail::FdManager::EV_HUP ///< remote end closed connection , EV_ERR = detail::FdManager::EV_ERR ///< transport error - , EV_ALL = (detail::FdManager::EV_READ - | detail::FdManager::EV_WRITE + , EV_ALL = (detail::FdManager::EV_READ + | detail::FdManager::EV_WRITE | detail::FdManager::EV_PRIO) ///< register all events (read, prio and write) }; @@ -132,7 +132,7 @@ namespace scheduler { explicitly be set to \c 0 if the value cannot be initialized. */ ~FdEvent(); - + ///@} /////////////////////////////////////////////////////////////////////////// @@ -145,7 +145,7 @@ namespace scheduler { FdEvent & addEvents(int events); ///< Add additional events to event mask FdEvent & removeEvents(int events); ///< Remove events from event mask int events(); ///< Current event mask - + template FdEvent & handle(Handle const & handle); ///< Change event file handle diff --git a/senf/Scheduler/FdEvent.ih b/senf/Scheduler/FdEvent.ih index 039ee76..d662b7d 100644 --- a/senf/Scheduler/FdEvent.ih +++ b/senf/Scheduler/FdEvent.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -49,14 +49,14 @@ namespace detail { bool operator()(int a, FdEvent const & b) const { return a < b.fd_; } }; - + class FdDispatcher : public senf::singleton { public: using senf::singleton::instance; using senf::singleton::alive; - + bool add(FdEvent & event); void remove(FdEvent & event); diff --git a/senf/Scheduler/FdEvent.test.cc b/senf/Scheduler/FdEvent.test.cc index ea0f0e0..d66b27e 100644 --- a/senf/Scheduler/FdEvent.test.cc +++ b/senf/Scheduler/FdEvent.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -185,7 +185,7 @@ SENF_AUTO_UNIT_TEST(fdDispatcher) error("connect"); BOOST_FAIL("connect"); } - + { senf::scheduler::FdEvent sockread ("testHandler", boost::bind(&callback, sock, _1), sock, senf::scheduler::FdEvent::EV_READ); @@ -221,7 +221,7 @@ SENF_AUTO_UNIT_TEST(fdDispatcher) BOOST_CHECK_EQUAL( calls, 3 ); SENF_CHECK_NO_THROW( senf::scheduler::detail::FIFORunner::instance().run() ); BOOST_CHECK_EQUAL( calls, 3 ); - + // Ensure, removing an already closed file-descriptor doesn't wreak havoc close(sock); } @@ -254,15 +254,15 @@ SENF_AUTO_UNIT_TEST(fileDispatcher) senf::scheduler::detail::FileDispatcher::instance().timeout(500); int fd (open("test.empty.file", O_RDWR|O_CREAT|O_TRUNC, 0600)); - + senf::ClockService::clock_type t (senf::ClockService::now()); try { - senf::scheduler::FdEvent fde ("testHandler", &handler, + senf::scheduler::FdEvent fde ("testHandler", &handler, fd, senf::scheduler::FdEvent::EV_READ); SENF_CHECK_NO_THROW( senf::scheduler::detail::FdManager::instance().processOnce() ); SENF_CHECK_NO_THROW( senf::scheduler::detail::FileDispatcher::instance().prepareRun() ); SENF_CHECK_NO_THROW( senf::scheduler::detail::FIFORunner::instance().run() ); - + BOOST_CHECK( called ); if (enabled) BOOST_CHECK_PREDICATE( is_close, (t)(senf::ClockService::now()) ); @@ -281,7 +281,7 @@ SENF_AUTO_UNIT_TEST(fileDispatcher) BOOST_CHECK( ! called ); if (enabled) - BOOST_CHECK_PREDICATE( + BOOST_CHECK_PREDICATE( is_close, (t+senf::ClockService::milliseconds(500))(senf::ClockService::now()) ); unlink("test.empty.file"); diff --git a/senf/Scheduler/FdManager.cc b/senf/Scheduler/FdManager.cc index 68cf31f..9b37133 100644 --- a/senf/Scheduler/FdManager.cc +++ b/senf/Scheduler/FdManager.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/FdManager.cci b/senf/Scheduler/FdManager.cci index 79001fe..33c630b 100644 --- a/senf/Scheduler/FdManager.cci +++ b/senf/Scheduler/FdManager.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/FdManager.hh b/senf/Scheduler/FdManager.hh index 538acac..283ade6 100644 --- a/senf/Scheduler/FdManager.hh +++ b/senf/Scheduler/FdManager.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -51,9 +51,9 @@ namespace detail { virtual void signal(int events) = 0; ///< Called when the given event is posted }; - enum Events { + enum Events { EV_READ = Poller::EV_READ, EV_PRIO = Poller::EV_PRIO, EV_WRITE = Poller::EV_WRITE, - EV_HUP = Poller::EV_HUP, EV_ERR = Poller::EV_ERR + EV_HUP = Poller::EV_HUP, EV_ERR = Poller::EV_ERR }; using singleton::instance; @@ -70,7 +70,7 @@ namespace detail { /**< This call waits until at least one event is posted but no longer than the current timeout(). */ ClockService::clock_type eventTime() const; ///< Time of last event - + protected: private: diff --git a/senf/Scheduler/IdleEvent.cc b/senf/Scheduler/IdleEvent.cc index daaef4a..8d7c48f 100644 --- a/senf/Scheduler/IdleEvent.cc +++ b/senf/Scheduler/IdleEvent.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/IdleEvent.cci b/senf/Scheduler/IdleEvent.cci index 71e82e7..bdd6ac6 100644 --- a/senf/Scheduler/IdleEvent.cci +++ b/senf/Scheduler/IdleEvent.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/IdleEvent.hh b/senf/Scheduler/IdleEvent.hh index ead11de..3982e5a 100644 --- a/senf/Scheduler/IdleEvent.hh +++ b/senf/Scheduler/IdleEvent.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -56,8 +56,8 @@ namespace detail { /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///\{ - - IdleEvent(std::string const & name, Callback const & cb, + + IdleEvent(std::string const & name, Callback const & cb, bool initiallyEnabled = true); ~IdleEvent(); @@ -77,10 +77,10 @@ namespace detail { virtual std::string v_info() const; Callback cb_; - + friend class detail::IdleEventDispatcher; }; - + }} ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Scheduler/IdleEvent.ih b/senf/Scheduler/IdleEvent.ih index 2a97a6a..64293b0 100644 --- a/senf/Scheduler/IdleEvent.ih +++ b/senf/Scheduler/IdleEvent.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ namespace scheduler { void restart(); namespace detail { - + class IdleEventDispatcher : public singleton { @@ -47,7 +47,7 @@ namespace detail { void add(IdleEvent & event); void remove(IdleEvent & event); - + void prepareRun(); // Called by PollTimerSource diff --git a/senf/Scheduler/IdleEvent.test.cc b/senf/Scheduler/IdleEvent.test.cc index f3e4236..40c1c7d 100644 --- a/senf/Scheduler/IdleEvent.test.cc +++ b/senf/Scheduler/IdleEvent.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/Mainpage.dox b/senf/Scheduler/Mainpage.dox index e67784a..f1b6c97 100644 --- a/senf/Scheduler/Mainpage.dox +++ b/senf/Scheduler/Mainpage.dox @@ -53,7 +53,7 @@ is met (e.g. number of chars read or a specific character sequence is found in the input). \li senf::WriteHelper writes data to an arbitrary file descriptor until all provided data has been written. - + \section scheduler_i Implementation \seechapter \ref scheduler_implementation @@ -75,7 +75,7 @@ \li There is a dispatcher for each event type. This dispatcher manages the event specific registration and unregistration. The dispatcher is owns the event (and task) objects. - + \li Every registered event is represented by an event specific event class instance. \li The Dispatcher ultimately registeres with the senf::scheduler::detail::FdManager. Since the @@ -93,7 +93,7 @@ \section scheduler_i_dispatchers Dispatchers - + There is a dispatcher for each event type \li senf::scheduler::detail::FdDispatcher manages poll-able file descriptors. This does \e not @@ -110,7 +110,7 @@ manage the events. This makes the Scheduler itself be completely devoid of dynamic memory allocations. - + \section scheduler_i_mainloop The main loop The application mainloop senf::scheduler::process() is constructed by calling the correct diff --git a/senf/Scheduler/Poller.ct b/senf/Scheduler/Poller.ct index bbe5c31..c9ea3dd 100644 --- a/senf/Scheduler/Poller.ct +++ b/senf/Scheduler/Poller.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -36,7 +36,7 @@ template prefix_ bool senf::scheduler::detail::Poller::set(int fd, int events, Value * data) { struct epoll_event ev = { events, { data } }; - if (epoll_ctl(epollFd_, EPOLL_CTL_ADD, fd, &ev) != -1) + if (epoll_ctl(epollFd_, EPOLL_CTL_ADD, fd, &ev) != -1) return true; if (errno == EEXIST) if (epoll_ctl(epollFd_, EPOLL_CTL_MOD, fd, &ev) != -1) diff --git a/senf/Scheduler/Poller.cti b/senf/Scheduler/Poller.cti index 56e6c42..dfcc291 100644 --- a/senf/Scheduler/Poller.cti +++ b/senf/Scheduler/Poller.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/Poller.hh b/senf/Scheduler/Poller.hh index bc29953..b18c0bf 100644 --- a/senf/Scheduler/Poller.hh +++ b/senf/Scheduler/Poller.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -62,16 +62,16 @@ namespace detail { public: /////////////////////////////////////////////////////////////////////////// // Types - + typedef Value value_type; typedef boost::transform_iterator iterator; typedef boost::iterator_range range; - enum Events { + enum Events { EV_READ = EPOLLIN, EV_PRIO = EPOLLPRI, EV_WRITE = EPOLLOUT, - EV_HUP = EPOLLHUP, EV_ERR = EPOLLERR + EV_HUP = EPOLLHUP, EV_ERR = EPOLLERR }; - + /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ @@ -90,7 +90,7 @@ namespace detail { range wait(); ///< Wait for one event /**< \returns a range of iterators which iterate over the data values registered with the event */ - + void timeout(int t); ///< Set event timeout to \a t milliseconds int timeout() const; ///< Current event timeout diff --git a/senf/Scheduler/Poller.test.cc b/senf/Scheduler/Poller.test.cc index 44a2c33..3d74832 100644 --- a/senf/Scheduler/Poller.test.cc +++ b/senf/Scheduler/Poller.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/ReadHelper.ct b/senf/Scheduler/ReadHelper.ct index 6547474..b29b2a8 100644 --- a/senf/Scheduler/ReadHelper.ct +++ b/senf/Scheduler/ReadHelper.ct @@ -35,7 +35,7 @@ template prefix_ senf::ReadHelper::ReadHelper(Handle handle, std::string::size_type maxSize, InternalPredicate * predicate, Callback cb) - : handle_(handle), + : handle_(handle), fde_("senf::ReadHelper", boost::bind(&ReadHelper::dispatchProcess,ptr(this), handle, _1), handle, senf::scheduler::FdEvent::EV_READ), maxSize_(maxSize), predicate_(predicate), callback_(cb), errno_(0), complete_(false) diff --git a/senf/Scheduler/ReadHelper.hh b/senf/Scheduler/ReadHelper.hh index 3271801..ee91997 100644 --- a/senf/Scheduler/ReadHelper.hh +++ b/senf/Scheduler/ReadHelper.hh @@ -129,7 +129,7 @@ namespace senf { private: struct InternalPredicate; - ReadHelper(Handle handle, std::string::size_type maxSize, + ReadHelper(Handle handle, std::string::size_type maxSize, InternalPredicate * predicate, Callback cb); static void dispatchProcess(ptr helper, Handle handle, int event); diff --git a/senf/Scheduler/Scheduler.cc b/senf/Scheduler/Scheduler.cc index 1f94643..fe32596 100644 --- a/senf/Scheduler/Scheduler.cc +++ b/senf/Scheduler/Scheduler.cc @@ -65,12 +65,12 @@ prefix_ senf::ClockService::clock_type senf::scheduler::now() } namespace { - + // We don't want try { } catch(...) { ... throw; } since that will make debugging more // difficult: the stack backtrace for an unexpected exception would always end here. struct SchedulerScopedInit { - SchedulerScopedInit() + SchedulerScopedInit() { senf::scheduler::detail::FIFORunner::instance().startWatchdog(); senf::scheduler::detail::SignalDispatcher::instance().unblockSignals(); @@ -126,7 +126,7 @@ prefix_ void senf::scheduler::restart() fdd->~FdDispatcher(); ffr->~FIFORunner(); fdm->~FdManager(); - + new (fdm) detail::FdManager(); new (ffr) detail::FIFORunner(); new (fdd) detail::FdDispatcher(); @@ -139,7 +139,7 @@ prefix_ void senf::scheduler::restart() prefix_ bool senf::scheduler::empty() { - return detail::FdDispatcher::instance().empty() + return detail::FdDispatcher::instance().empty() && detail::TimerDispatcher::instance().empty() && detail::FileDispatcher::instance().empty() && detail::SignalDispatcher::instance().empty() diff --git a/senf/Scheduler/Scheduler.hh b/senf/Scheduler/Scheduler.hh index f83a8d0..69c30ab 100644 --- a/senf/Scheduler/Scheduler.hh +++ b/senf/Scheduler/Scheduler.hh @@ -80,7 +80,7 @@ namespace senf { public: SomeServer(SomeSocketHandle handle) - : handle_ (handle), + : handle_ (handle), event_ ("SomeServer handler", senf::membind(&SomeServer::readData, this), handle, senf::scheduler::FdEvent::EV_READ) {} @@ -115,7 +115,7 @@ namespace senf { // Handle callback function void callback(UDPv4ClientSocketHandle handle, senf::Scheduler::EventId event) {..} // Pass 'handle' as additional first argument to callback() - senf::scheduler::FdEvent event ("name", boost::bind(&callback, handle, _1), + senf::scheduler::FdEvent event ("name", boost::bind(&callback, handle, _1), handle, senf::scheduler::FdEvent::EV_READ); // Timeout function void timeout( int n) {..} @@ -130,7 +130,7 @@ namespace senf { // e.g. in Foo::Foo() constructor: Foo::Foo() : handle_ (...), - readevent_ ("Foo read", senf::membind(&Foo::callback, this), + readevent_ ("Foo read", senf::membind(&Foo::callback, this), handle_, senf::scheduler::FdEvent::EV_READ) { ... } \endcode @@ -142,7 +142,7 @@ namespace senf { \section sched_exec Executing the Scheduler To enter the scheduler main-loop, call - + \code senf::scheduler::process(); \endcode @@ -163,15 +163,15 @@ namespace senf { \code #include #include - + class Foo { public: void add(int fd) { fdEvents.insert( - fd, - new senf::scheduler::FdEvent("foo", boost::bind(&callback, this, fd, _1), fd, + fd, + new senf::scheduler::FdEvent("foo", boost::bind(&callback, this, fd, _1), fd, senf::scheduler::FdEvent::EV_READ) ); } @@ -207,7 +207,7 @@ namespace senf { can produce an informative message and optionally the program can be aborted. The watchdog is controlled using the watchdogTimeout(), watchdogEvents() and watchdogAbort(). - functions. + functions. The watchdog is implemented using a free running interval timer. The watchdog signal (\c SIGURG) must \e not be blocked. If signals need to be blocked for some reason, those regions will not be @@ -227,13 +227,13 @@ namespace senf { */ namespace scheduler { - /** \brief Event handler main loop - + /** \brief Event handler main loop + This member must be called at some time to enter the event handler main loop. Only while this function is running any events are handled. The call will return if \li a callback calls terminate() - \li the run queue becomes empty. - */ + \li the run queue becomes empty. + */ void process(); /** \brief \c true, if scheduler is running, \c false otherwise */ @@ -242,9 +242,9 @@ namespace scheduler { /** \brief Called by callbacks to terminate the main loop This member may be called by any callback to tell the main loop to terminate. The main loop - will return to it's caller after the currently running callback returns. + will return to it's caller after the currently running callback returns. */ - void terminate(); + void terminate(); /** \brief Immediately rescheduler @@ -256,9 +256,9 @@ namespace scheduler { /** \brief Return timestamp of last event This is the timestamp, the last event has been signaled. This is the real time at which the - event is delivered \e not the time it should have been delivered (in the case of timers). + event is delivered \e not the time it should have been delivered (in the case of timers). */ - ClockService::clock_type eventTime(); + ClockService::clock_type eventTime(); /** \brief Return (approximate) current time @@ -270,22 +270,22 @@ namespace scheduler { ClockService::clock_type now(); /** \brief Set watchdog timeout to \a ms milliseconds. - + Setting the watchdog timeout to 0 will disable the watchdog. */ - void watchdogTimeout(unsigned ms); + void watchdogTimeout(unsigned ms); /** \brief Current watchdog timeout in milliseconds */ - unsigned watchdogTimeout(); + unsigned watchdogTimeout(); - /** \brief Number of watchdog events + /** \brief Number of watchdog events calling watchtogEvents() will reset the counter to 0 */ - unsigned watchdogEvents(); + unsigned watchdogEvents(); /** \brief Enable/disable abort on watchdog event. - + Calling watchdogAbort(\c true) will enable aborting the program execution on a watchdog event. */ @@ -295,7 +295,7 @@ namespace scheduler { bool watchdogAbort(); /** \brief Switch to using hi resolution timers - + By default, timers are implemented directly using epoll. This however restricts the timer resolution to that of the kernel HZ value. @@ -325,12 +325,12 @@ namespace scheduler { bool usingHiresTimers(); /** \brief Restart scheduler - + This call will restart all scheduler dispatchers (timers, signals, file descriptors). This is necessary after a fork(). \warning This call will \e remove all registered events from the scheduler */ - void restart(); + void restart(); /** \brief Return \c true, if no event is registered, \c false otherwise. */ bool empty(); @@ -356,7 +356,7 @@ namespace scheduler { /** \brief Temporarily block all signals This class is used to temporarily block all signals in a critical section. - + \code // Begin critical section { @@ -379,7 +379,7 @@ namespace scheduler { /**< \param[in] initiallyBlocked set to \c false to not automatically block signals initially */ ~BlockSignals(); ///< Release all signal blocks - + void block(); ///< Block signals if not blocked void unblock(); ///< Unblock signals if blocked bool blocked() const; ///< \c true, if signals currently blocked, \c false diff --git a/senf/Scheduler/Scheduler.test.cc b/senf/Scheduler/Scheduler.test.cc index 0dfbc99..7e6d543 100644 --- a/senf/Scheduler/Scheduler.test.cc +++ b/senf/Scheduler/Scheduler.test.cc @@ -189,7 +189,7 @@ namespace { { return (a= 8u ); - + /////////////////////////////////////////////////////////////////////////// close(sock); @@ -365,7 +365,7 @@ SENF_AUTO_UNIT_TEST(testSchedulerPOSIXTimers) } namespace { - + void sigme() { senf::scheduler::BlockSignals signalBlocker; @@ -390,18 +390,18 @@ SENF_AUTO_UNIT_TEST(blockSignals) senf::scheduler::TimerEvent timer ( "testWatchdog", &timeout, senf::ClockService::now()+senf::ClockService::milliseconds(400)); senf::scheduler::SignalEvent sig (SIGUSR1, &sigusr); - + senf::ClockService::clock_type t = senf::ClockService::now(); - SENF_CHECK_NO_THROW( senf::scheduler::process() ); + SENF_CHECK_NO_THROW( senf::scheduler::process() ); if (enabled) { - BOOST_CHECK_PREDICATE( is_close, - (senf::ClockService::now()) + BOOST_CHECK_PREDICATE( is_close, + (senf::ClockService::now()) (t+senf::ClockService::milliseconds(200)) ); BOOST_CHECK_PREDICATE( is_close, (sigtime) (t+senf::ClockService::milliseconds(200)) ); } - SENF_CHECK_NO_THROW( senf::scheduler::process() ); + SENF_CHECK_NO_THROW( senf::scheduler::process() ); } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Scheduler/SignalEvent.cci b/senf/Scheduler/SignalEvent.cci index 5bac1a1..39d6bd6 100644 --- a/senf/Scheduler/SignalEvent.cci +++ b/senf/Scheduler/SignalEvent.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/SignalEvent.hh b/senf/Scheduler/SignalEvent.hh index d3ff3ab..fc01abb 100644 --- a/senf/Scheduler/SignalEvent.hh +++ b/senf/Scheduler/SignalEvent.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -61,7 +61,7 @@ namespace scheduler { */ class SignalEvent : public detail::FIFORunner::TaskInfo, - public detail::SignalSetBase + public detail::SignalSetBase { public: /////////////////////////////////////////////////////////////////////////// @@ -98,7 +98,7 @@ namespace scheduler { virtual void v_run(); virtual char const * v_type() const; virtual std::string v_info() const; - + int signal_; Callback cb_; siginfo_t siginfo_; diff --git a/senf/Scheduler/SignalEvent.ih b/senf/Scheduler/SignalEvent.ih index 96f9261..fa875c2 100644 --- a/senf/Scheduler/SignalEvent.ih +++ b/senf/Scheduler/SignalEvent.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -48,7 +48,7 @@ namespace detail { struct FindNumericSignal { bool operator()(SignalEvent const & a, int b) const - { return a.signal_ < b; } + { return a.signal_ < b; } bool operator()(int a, SignalEvent const & b) const { return a < b.signal_; } }; @@ -73,7 +73,7 @@ namespace detail { bool empty() const; struct DuplicateSignalRegistrationException : public Exception - { DuplicateSignalRegistrationException() + { DuplicateSignalRegistrationException() : Exception("duplicate signal registration") {} }; protected: diff --git a/senf/Scheduler/SignalEvent.test.cc b/senf/Scheduler/SignalEvent.test.cc index 16f94ec..1cfd965 100644 --- a/senf/Scheduler/SignalEvent.test.cc +++ b/senf/Scheduler/SignalEvent.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -36,7 +36,7 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - + bool called = false; void handler(siginfo_t const &) { diff --git a/senf/Scheduler/TimerEvent.cc b/senf/Scheduler/TimerEvent.cc index 437aae3..f8d8365 100644 --- a/senf/Scheduler/TimerEvent.cc +++ b/senf/Scheduler/TimerEvent.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/TimerEvent.cci b/senf/Scheduler/TimerEvent.cci index ad671db..91f4055 100644 --- a/senf/Scheduler/TimerEvent.cci +++ b/senf/Scheduler/TimerEvent.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -70,7 +70,7 @@ prefix_ void senf::scheduler::TimerEvent::action(Callback const & cb) cb_ = cb; } -prefix_ void senf::scheduler::TimerEvent::timeout(ClockService::clock_type timeout, +prefix_ void senf::scheduler::TimerEvent::timeout(ClockService::clock_type timeout, bool initiallyEnabled) { disable(); diff --git a/senf/Scheduler/TimerEvent.ih b/senf/Scheduler/TimerEvent.ih index 5ce5b74..dafb142 100644 --- a/senf/Scheduler/TimerEvent.ih +++ b/senf/Scheduler/TimerEvent.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -49,7 +49,7 @@ namespace detail { : public singleton { SENF_LOG_CLASS_AREA(); - + public: using singleton::instance; using singleton::alive; diff --git a/senf/Scheduler/TimerEvent.test.cc b/senf/Scheduler/TimerEvent.test.cc index 4b1f481..8b31110 100644 --- a/senf/Scheduler/TimerEvent.test.cc +++ b/senf/Scheduler/TimerEvent.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -44,7 +44,7 @@ namespace { { return (a -prefix_ senf::scheduler::TimerEventProxy::TimerEventProxy() +prefix_ senf::scheduler::TimerEventProxy::TimerEventProxy() : entrySetById( entrySet.template get()), entrySetByTimeout( entrySet.template get ()), timer( "TimerEventProxy", membind(&TimerEventProxy::timerEvent, this), 0, false) { } template -prefix_ senf::scheduler::TimerEventProxy::TimerEventProxy(std::string const & name, console::DirectoryNode & node) +prefix_ senf::scheduler::TimerEventProxy::TimerEventProxy(std::string const & name, console::DirectoryNode & node) : entrySetById( entrySet.template get()), entrySetByTimeout( entrySet.template get ()), timer( "TimerEventProxy", membind(&TimerEventProxy::timerEvent, this), 0, false) diff --git a/senf/Scheduler/TimerEventProxy.hh b/senf/Scheduler/TimerEventProxy.hh index 08301ec..3517db6 100644 --- a/senf/Scheduler/TimerEventProxy.hh +++ b/senf/Scheduler/TimerEventProxy.hh @@ -50,7 +50,7 @@ namespace scheduler { host a big count of timers. */ template - class TimerEventProxy + class TimerEventProxy { public: typedef boost::function Callback; @@ -59,18 +59,18 @@ namespace scheduler { TimerEventProxy(std::string const & name, console::DirectoryNode & node); /**< \brief Instantiate a TimerEventProxy and add the list command to the give DirectoryNode */ - + void add(ClockService::clock_type timeout, IdType const & id, Callback cb); ///< Add new deadline timer - + bool remove(IdType const & id); ///< Remove timer by given \a id. - + std::vector > list() const; ///< Returns a vector of all active timers with timeout and id. - + ClockService::clock_type timeout(IdType const & id) const; ///< Returns timeout for given id - /**< if no timer for this id is registered \a 0 is returned. */ + /**< if no timer for this id is registered \a 0 is returned. */ private: #ifndef DOXYGEN struct Entry { @@ -90,11 +90,11 @@ namespace scheduler { boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag, - boost::multi_index::member + boost::multi_index::member >, boost::multi_index::ordered_unique< boost::multi_index::tag, - boost::multi_index::member + boost::multi_index::member > > > EntrySet_t; @@ -104,7 +104,7 @@ namespace scheduler { EntrySet_t entrySet; EntrySetById_t & entrySetById; EntrySetByTimeout_t & entrySetByTimeout; - + scheduler::TimerEvent timer; void timerEvent(); // callback for the Scheduler timer event diff --git a/senf/Scheduler/TimerEventProxy.test.cc b/senf/Scheduler/TimerEventProxy.test.cc index 49aa142..992af10 100644 --- a/senf/Scheduler/TimerEventProxy.test.cc +++ b/senf/Scheduler/TimerEventProxy.test.cc @@ -69,7 +69,7 @@ SENF_AUTO_UNIT_TEST(timerEventProxy) BOOST_CHECK( timers.remove( 4)); BOOST_CHECK(! timers.remove( 4)); timers.add( t + senf::ClockService::milliseconds(700), 2, &handler); - + BOOST_CHECK_EQUAL( timers.timeout(1), t + senf::ClockService::milliseconds(200)); BOOST_CHECK_EQUAL( timers.timeout(2), t + senf::ClockService::milliseconds(700)); BOOST_CHECK_EQUAL( timers.timeout(4), 0); @@ -78,7 +78,7 @@ SENF_AUTO_UNIT_TEST(timerEventProxy) BOOST_CHECK( mask == 3); } - + senf::scheduler::TimerEventProxy timers ("test", senf::console::ScopedDirectory<>()); } diff --git a/senf/Scheduler/TimerSource.cci b/senf/Scheduler/TimerSource.cci index de09775..63a8cec 100644 --- a/senf/Scheduler/TimerSource.cci +++ b/senf/Scheduler/TimerSource.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Scheduler/TimerSource.hh b/senf/Scheduler/TimerSource.hh index c520348..8c4cbef 100644 --- a/senf/Scheduler/TimerSource.hh +++ b/senf/Scheduler/TimerSource.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -39,7 +39,7 @@ namespace senf { namespace scheduler { namespace detail { - class TimerSource + class TimerSource : boost::noncopyable { public: diff --git a/senf/Scheduler/WriteHelper.ct b/senf/Scheduler/WriteHelper.ct index fe92ee2..b9ba80b 100644 --- a/senf/Scheduler/WriteHelper.ct +++ b/senf/Scheduler/WriteHelper.ct @@ -35,8 +35,8 @@ template prefix_ senf::WriteHelper::WriteHelper(Handle handle, std::string const & data, Callback callback) - : handle_(handle), - fde_("WriteHelper", boost::bind(&WriteHelper::dispatchProcess, ptr(this), _1, _2), + : handle_(handle), + fde_("WriteHelper", boost::bind(&WriteHelper::dispatchProcess, ptr(this), _1, _2), handle, scheduler::FdEvent::EV_WRITE), data_(data), callback_(callback), offset_(data_.begin()), errno_(0) {} diff --git a/senf/Scheduler/WriteHelper.hh b/senf/Scheduler/WriteHelper.hh index 56e1467..2a19577 100644 --- a/senf/Scheduler/WriteHelper.hh +++ b/senf/Scheduler/WriteHelper.hh @@ -97,7 +97,7 @@ namespace senf { private: WriteHelper(Handle handle, std::string const & data, Callback callback); - static void dispatchProcess(ptr helper, Handle handle, + static void dispatchProcess(ptr helper, Handle handle, senf::scheduler::FdEvent::Events event); void process(Handle handle, senf::scheduler::FdEvent::Events event); void done(); diff --git a/senf/Socket.hh b/senf/Socket.hh index ff5fd51..add63f0 100644 --- a/senf/Socket.hh +++ b/senf/Socket.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2007 +// Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund diff --git a/senf/Socket/ClientSocketHandle.ct b/senf/Socket/ClientSocketHandle.ct index 5fc331f..4a22c91 100644 --- a/senf/Socket/ClientSocketHandle.ct +++ b/senf/Socket/ClientSocketHandle.ct @@ -106,10 +106,10 @@ template template prefix_ void senf::ClientSocketHandle::read(Sequence & container, unsigned limit) { - if (limit == 0) + if (limit == 0) limit = available(); container.resize(limit); - container.erase(read( std::make_pair(container.begin(), container.end()) ), + container.erase(read( std::make_pair(container.begin(), container.end()) ), container.end()); } @@ -134,7 +134,7 @@ prefix_ void senf::ClientSocketHandle::readfrom(Sequence & container, A if (limit>0 && nread>limit) nread = limit; container.resize(nread); - container.erase(readfrom( std::make_pair(container.begin(), container.end()), from ), + container.erase(readfrom( std::make_pair(container.begin(), container.end()), from ), container.end()); } diff --git a/senf/Socket/ClientSocketHandle.hh b/senf/Socket/ClientSocketHandle.hh index 92635f9..9bcbcb7 100644 --- a/senf/Socket/ClientSocketHandle.hh +++ b/senf/Socket/ClientSocketHandle.hh @@ -136,7 +136,7 @@ namespace senf { # else template ClientSocketHandle const & operator=(ClientSocketHandle other); -# endif +# endif ///@} /////////////////////////////////////////////////////////////////////////// @@ -163,7 +163,7 @@ namespace senf { the other end) and will block, if no data is available now. If you do not want to block, you \e must make the socket non-blocking (using FileHandle::blocking()). - \throws senf::SystemException + \throws senf::SystemException This variant will read up to \c limit bytes from the @@ -191,9 +191,9 @@ namespace senf { range. read returns a past-the-end iterator after the last character read. This iterator will point to somewhere within the input range. - \param[in,out] range Range to store data in + \param[in,out] range Range to store data in \returns past-the-end iterator pointer to after the - last read character + last read character \see \ref read() \n Boost.Range */ # endif @@ -219,7 +219,7 @@ namespace senf { work, the container must be a model of 'Sequence' as defined in the STL documentation \param[out] container Container to write data to - \param[in] limit Maximum number of characters to read + \param[in] limit Maximum number of characters to read \see \ref read() */ char * read (char * start, char * end); ///< Read data into memory area @@ -260,11 +260,11 @@ namespace senf { range. read returns a past-the-end iterator after the last character read. This iterator will point to somewhere within the input range. - \param[in,out] range Range to store data in + \param[in,out] range Range to store data in \param[out] from peers address from which the data was received \returns past-the-end iterator pointer to after the - last read character + last read character \see \ref readfrom() \n Boost.Range */ template @@ -282,7 +282,7 @@ namespace senf { work, the container must be a model of 'Sequence' as defined in the STL documentation \param[out] container Container to write data to - \param[in] limit Maximum number of characters to read + \param[in] limit Maximum number of characters to read \param[out] from peers address from which the data was received \see \ref readfrom() */ diff --git a/senf/Socket/ClientSocketHandle.ih b/senf/Socket/ClientSocketHandle.ih index 2d1c6be..accf4e0 100644 --- a/senf/Socket/ClientSocketHandle.ih +++ b/senf/Socket/ClientSocketHandle.ih @@ -45,7 +45,7 @@ namespace detail { range, otherwise a temporary storage area is used. */ template - struct ReadRange + struct ReadRange { static typename boost::range_iterator::type read(Handle & handle, ForwardWritableRange & range); @@ -83,7 +83,7 @@ namespace detail { { static typename boost::range_const_iterator::type write(Handle & handle, ForwardReadableRange & range); - + static typename boost::range_const_iterator::type writeto(Handle & handle, ForwardReadableRange & range, typename Handle::Address const & addr); @@ -96,7 +96,7 @@ namespace detail { { static typename boost::range_const_iterator::type write(Handle & handle, ForwardReadableRange & range); - + static typename boost::range_const_iterator::type writeto(Handle & handle, ForwardReadableRange & range, typename Handle::Address const & addr); diff --git a/senf/Socket/FileHandle.cci b/senf/Socket/FileHandle.cci index 09628f8..9de38d1 100644 --- a/senf/Socket/FileHandle.cci +++ b/senf/Socket/FileHandle.cci @@ -77,7 +77,7 @@ prefix_ bool senf::FileBody::readable() prefix_ bool senf::FileBody::waitReadable(senf::ClockService::clock_type timeout) const { - return pollCheck(fd(), true, + return pollCheck(fd(), true, (timeout==-1?-1:senf::ClockService::in_milliseconds(timeout)) ); } @@ -90,7 +90,7 @@ prefix_ bool senf::FileBody::writeable() prefix_ bool senf::FileBody::waitWriteable(senf::ClockService::clock_type timeout) const { - return pollCheck(fd(), false, + return pollCheck(fd(), false, (timeout==-1?-1:senf::ClockService::in_milliseconds(timeout)) ); } @@ -103,7 +103,7 @@ prefix_ bool senf::FileBody::oobReadable() prefix_ bool senf::FileBody::waitOOBReadable(senf::ClockService::clock_type timeout) const { - return pollCheck(fd(), true, + return pollCheck(fd(), true, (timeout==-1?-1:senf::ClockService::in_milliseconds(timeout)), true); } diff --git a/senf/Socket/FileHandle.hh b/senf/Socket/FileHandle.hh index 0667051..50ddaaf 100644 --- a/senf/Socket/FileHandle.hh +++ b/senf/Socket/FileHandle.hh @@ -25,7 +25,7 @@ */ /** \defgroup handle_group The Handle Hierarchy - + \diaimage FhHierarchy.dia The senf::FileHandle class is the base of a hierarchy of socket handle classes (realized as @@ -130,11 +130,11 @@ namespace senf { bool readable() const; ///< Check, whether a read on the handle would not block ///< (ignoring blocking state) - bool waitReadable(senf::ClockService::clock_type timeout = -1) const; + bool waitReadable(senf::ClockService::clock_type timeout = -1) const; ///< Wait, until read on the handle would not block (ignoring ///< blocking state) /**< \param[in] timeout max time to wait, default is to wait - forever. + forever. \returns \c true, if handle became readable or \c false on timeout. */ bool writeable() const; ///< Check, whether a write on the handle would not block @@ -143,16 +143,16 @@ namespace senf { ///< Wait, until a write on the handle would not block ///< (ignoring blocking state) /**< \param[in] timeout max time to wait, default is to wait - forever. + forever. \returns \c true, if handle became writable or \c false on timeout. */ - bool oobReadable() const; ///< Check, whether a read of prioritized data on the handle + bool oobReadable() const; ///< Check, whether a read of prioritized data on the handle ///< would not block (ignoring blocking state) - bool waitOOBReadable(senf::ClockService::clock_type timeout = -1) const; + bool waitOOBReadable(senf::ClockService::clock_type timeout = -1) const; ///< Wait, until read of prioritized data on the handle does ///< not block (ignoring blocking state) /**< \param[in] timeout max time to wait, default is to wait - forever. + forever. \returns \c true, if handle became readable for out-of-band data or \c false on timeout. */ diff --git a/senf/Socket/FileHandle.ih b/senf/Socket/FileHandle.ih index 748b2d1..7b71629 100644 --- a/senf/Socket/FileHandle.ih +++ b/senf/Socket/FileHandle.ih @@ -65,7 +65,7 @@ namespace senf { \e must also derive from senf::pool_alloc_mixin */ class FileBody - : public senf::intrusive_refcount, + : public senf::intrusive_refcount, public senf::pool_alloc_mixin { public: diff --git a/senf/Socket/Mainpage.dox b/senf/Socket/Mainpage.dox index b819521..edc8b31 100644 --- a/senf/Socket/Mainpage.dox +++ b/senf/Socket/Mainpage.dox @@ -25,14 +25,14 @@ namespace senf { /** \mainpage The SENF Socket Library The Socket library provides a high level and object oriented abstraction based on the BSD socket - API (but not limited to it). - + API (but not limited to it). + \autotoc - + \section socket_intro Introduction \seechapter \ref structure \n \seechapter \ref usage - + The socket library abstraction is based on several concepts: \li The basic visible interface is a \link handle_group handle object\endlink @@ -54,7 +54,7 @@ namespace senf { symbol). However, more generic kinds of handles can be defined for more generic functionality. - + \section socket_policy The Policy interface \seechapter \ref policy_group @@ -62,10 +62,10 @@ namespace senf { provides. This offers highly efficient access to the most important socket functions (like reading and writing). The policy interface however is a \e static, non-polymorphic interface. - + \section socket_protocol The Protocol interface \seechapter \ref protocol_group - + The protocol interface provides further protocol dependent and (possibly) polymorphic access to further socket funcitonality. On the other hand, this type of interface is not as flexible, @@ -73,7 +73,7 @@ namespace senf { \section socket_addr Auxilliary Addressing classes \seechapter \ref addr_group - + To supplement the socket library, there are a multitude of addressing classes. These come in two basic groups: \li Protocol specific addresses (e.g. INet4Address, MACAddress) @@ -81,8 +81,8 @@ namespace senf { Whereas the protocol specific addresses are custom value types which represent their corresponding low-level address, the socket addresses are based on the corresponding \c sockaddr - structures. - + structures. + \section socket_further Going further \seechapter \ref extend \n \seechapter \ref implementation @@ -122,7 +122,7 @@ namespace senf { reducing the policy interface to a minimal sensible subset of the complete API. \section over_policy The Policy Interface - + The policy of a Socket consists of several parts, called policy axis. Each axis corresponds to one specific interface aspect of the Socket. The exact meaning of the policy axis are defined elsewhere (see \ref policy_group). The Protocol will always provide a complete set @@ -138,7 +138,7 @@ namespace senf { defined match those defined in that Socket's protocol. Using such a generic handle decouples the implementation parts using this handle from the other socket aspects (e.g. you may define a generic socket handle for TCP based communication leaving the addressingPolicy undefined which - makes your code independent of the type of addressing, IPv4 or IPv6). + makes your code independent of the type of addressing, IPv4 or IPv6). This can be described as generalized compile-time polymorphism: A base class reference to some derived class will only give access to a reduced interface (the base class interface) of a @@ -201,7 +201,7 @@ namespace senf { To make your code more flexible, you should not pass around your socket in this form. Most of your code will be using only a small subset of the ProtocolClientSocketHandle or ProtocolServerSocketHandle API. - + If instead of using the fully specified handle type you use a more incomplete type, you allow your code to be used with all sockets which fulfill the minimal requirements of your code. These types are based on the ClientSocketHandle and ServerSocketHandle templates which implement the diff --git a/senf/Socket/NetdeviceController.hh b/senf/Socket/NetdeviceController.hh index b7b4259..3699f77 100644 --- a/senf/Socket/NetdeviceController.hh +++ b/senf/Socket/NetdeviceController.hh @@ -70,16 +70,16 @@ namespace senf { void interfaceName(const std::string &newName); ///< set interface name /**< Changes the name of the interface. - Note, that setting the name is a privileged operation. - It is only allowed when the interface is not up. If - the interface is up, this call will cause an + Note, that setting the name is a privileged operation. + It is only allowed when the interface is not up. If + the interface is up, this call will cause an SystemException to be thrown. */ int mtu() const; ///< return the Maximum Transmission Unit void mtu(int new_mtu); ///< set the Maximum Transmission Unit /**< Set the MTU (Maximum Transfer Unit) of the device. Note, that this is a privileged operation. - Setting the MTU to too small values may cause kernel + Setting the MTU to too small values may cause kernel crashes. */ bool promisc() const; ///< return \c true if interface is in promiscuous mode diff --git a/senf/Socket/NetdeviceController.test.cc b/senf/Socket/NetdeviceController.test.cc index c3546bf..585907a 100644 --- a/senf/Socket/NetdeviceController.test.cc +++ b/senf/Socket/NetdeviceController.test.cc @@ -46,15 +46,15 @@ SENF_AUTO_UNIT_TEST(NetdeviceController) { int index = ctrl.interfaceIndex(); BOOST_CHECK_EQUAL( index, senf::NetdeviceController(index).interfaceIndex() ); BOOST_CHECK_EQUAL( index, if_nametoindex( ifname.c_str()) ); - + BOOST_CHECK_THROW( senf::NetdeviceController("invalid_interfacename"), senf::SystemException ); - + int oldMTU (0); SENF_CHECK_NO_THROW( oldMTU = ctrl.mtu()); - + bool promisc (false); SENF_CHECK_NO_THROW( promisc = ctrl.promisc()); - + BOOST_CHECK( ctrl.isUp()); if (getuid() != 0) { @@ -66,7 +66,7 @@ SENF_AUTO_UNIT_TEST(NetdeviceController) { BOOST_CHECK_EQUAL( ctrl.mtu(), oldMTU-16); SENF_CHECK_NO_THROW( ctrl.mtu(oldMTU)); BOOST_CHECK_EQUAL( ctrl.mtu(), oldMTU); - + SENF_CHECK_NO_THROW( ctrl.promisc( !promisc)); BOOST_CHECK_EQUAL( ctrl.promisc(), !promisc); SENF_CHECK_NO_THROW( ctrl.promisc( promisc)); diff --git a/senf/Socket/Protocols/AddressExceptions.hh b/senf/Socket/Protocols/AddressExceptions.hh index bf7f605..fb9e556 100644 --- a/senf/Socket/Protocols/AddressExceptions.hh +++ b/senf/Socket/Protocols/AddressExceptions.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -52,13 +52,13 @@ namespace senf { /** \brief Resolver failure */ struct UnknownHostnameException : public AddressException - { - UnknownHostnameException() : AddressException("failed to resolve hostname") {} + { + UnknownHostnameException() : AddressException("failed to resolve hostname") {} UnknownHostnameException(const std::string &hostname) : AddressException("Failed to resolve hostname (\"" + hostname + "\")") {} }; -} +} ///////////////////////////////hh.e//////////////////////////////////////// //#include "AddressExceptions.cci" diff --git a/senf/Socket/Protocols/BSDAddressingPolicy.test.cc b/senf/Socket/Protocols/BSDAddressingPolicy.test.cc index f0e4e21..5630f77 100644 --- a/senf/Socket/Protocols/BSDAddressingPolicy.test.cc +++ b/senf/Socket/Protocols/BSDAddressingPolicy.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/BSDSocketAddress.cc b/senf/Socket/Protocols/BSDSocketAddress.cc index af50ee0..7d2c6ed 100644 --- a/senf/Socket/Protocols/BSDSocketAddress.cc +++ b/senf/Socket/Protocols/BSDSocketAddress.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/BSDSocketAddress.cci b/senf/Socket/Protocols/BSDSocketAddress.cci index fb15e6e..f52445e 100644 --- a/senf/Socket/Protocols/BSDSocketAddress.cci +++ b/senf/Socket/Protocols/BSDSocketAddress.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/BSDSocketAddress.hh b/senf/Socket/Protocols/BSDSocketAddress.hh index 16e6465..e8bd942 100644 --- a/senf/Socket/Protocols/BSDSocketAddress.hh +++ b/senf/Socket/Protocols/BSDSocketAddress.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,7 +40,7 @@ namespace senf { /** \brief Socket addressing, BSD style - + BSDSocketAddress is the base class of all BSD \c sockaddr based addressing classes. The \c sockaddr addressing interface is split into several parts @@ -66,7 +66,7 @@ namespace senf { } } \endcode - + All these classes provide a generic \c sockaddr API to interface with legacy \c sockaddr based code (e.g. the BSD socket API). In this base-class, this interface is read-only, the derived classes however provide a read-write interface. @@ -153,7 +153,7 @@ namespace senf { /** \brief Output generic socket address This stream operator will output a generic BSDSocketAddress in a family depending format. - + \related BSDSocketAddress */ std::ostream & operator<<(std::ostream & os, BSDSocketAddress const & addr); @@ -162,7 +162,7 @@ namespace senf { While BSDSocketAddress provides read-only generic \c sockaddr access, GenericBSDSocketAddress allows to store (write) arbitrary socket addresses. (It is - internally based on \c sockaddr_storage). + internally based on \c sockaddr_storage). To access the stored address, use sockaddr_cast to cast the GenericBSDSocketAddress to the correct family specific address class. @@ -183,7 +183,7 @@ namespace senf { GenericBSDSocketAddress(const GenericBSDSocketAddress& other); GenericBSDSocketAddress& operator=(const GenericBSDSocketAddress& other); - + ///@} /////////////////////////////////////////////////////////////////////////// ///\name Generic sockaddr interface diff --git a/senf/Socket/Protocols/BSDSocketAddress.test.cc b/senf/Socket/Protocols/BSDSocketAddress.test.cc index 82329d3..df69808 100644 --- a/senf/Socket/Protocols/BSDSocketAddress.test.cc +++ b/senf/Socket/Protocols/BSDSocketAddress.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/BSDSocketProtocol.hh b/senf/Socket/Protocols/BSDSocketProtocol.hh index 3511708..5f2159e 100644 --- a/senf/Socket/Protocols/BSDSocketProtocol.hh +++ b/senf/Socket/Protocols/BSDSocketProtocol.hh @@ -77,7 +77,7 @@ namespace senf { the network (e.g. via ICMP). */ unsigned rcvbuf() const; ///< Check receive buffer size - /**< \returns size of receive buffer in bytes + /**< \returns size of receive buffer in bytes \internal Linux doubles the buffer size internally when changing it to cater for additional space needed by the linux kernel. This call will therefore return @@ -86,14 +86,14 @@ namespace senf { /**< \param[in] size new receive buffer size */ unsigned sndbuf() const; ///< Check send buffer size - /**< \returns size of send buffer in bytes + /**< \returns size of send buffer in bytes \internal Linux doubles the buffer size internally when changing it to cater for additional space needed by the linux kernel. This call will therefore return only half the value reported by the kernel. */ void sndbuf(unsigned size) const; ///< Change size of send buffer /**< \param[in] size new send buffer size */ - + }; /** \brief Protocol facet providing basic connection oriented BSD socket functions diff --git a/senf/Socket/Protocols/DVB/DVBConfigParser.cc b/senf/Socket/Protocols/DVB/DVBConfigParser.cc index 1521c34..3efafde 100644 --- a/senf/Socket/Protocols/DVB/DVBConfigParser.cc +++ b/senf/Socket/Protocols/DVB/DVBConfigParser.cc @@ -9,16 +9,16 @@ senf::DVBConfigParser::DVBParams const senf::DVBConfigParser::params; prefix_ senf::DVBConfigParser::DVBParams::DVBParams() { - - boost::assign::insert(inversion) + + boost::assign::insert(inversion) ( "INVERSION_OFF", INVERSION_OFF ) - ( "INVERSION_ON", INVERSION_ON ) + ( "INVERSION_ON", INVERSION_ON ) ( "INVERSION_AUTO", INVERSION_AUTO ); - boost::assign::insert(bandwidth) + boost::assign::insert(bandwidth) ( "BANDWIDTH_6_MHZ", BANDWIDTH_6_MHZ) ( "BANDWIDTH_7_MHZ", BANDWIDTH_7_MHZ) ( "BANDWIDTH_8_MHZ", BANDWIDTH_8_MHZ); - boost::assign::insert(code_rate) + boost::assign::insert(code_rate) ( "FEC_1_2", FEC_1_2) ( "FEC_2_3", FEC_2_3) ( "FEC_3_4", FEC_3_4) @@ -29,30 +29,30 @@ prefix_ senf::DVBConfigParser::DVBParams::DVBParams() ( "FEC_8_9", FEC_8_9) ( "FEC_AUTO", FEC_AUTO) ( "FEC_NONE", FEC_NONE); - boost::assign::insert(guard_interval) + boost::assign::insert(guard_interval) ( "GUARD_INTERVAL_1_16", GUARD_INTERVAL_1_16) ( "GUARD_INTERVAL_1_32", GUARD_INTERVAL_1_32) ( "GUARD_INTERVAL_1_4", GUARD_INTERVAL_1_4) ( "GUARD_INTERVAL_1_8", GUARD_INTERVAL_1_8); - boost::assign::insert(hierarchy) + boost::assign::insert(hierarchy) ( "HIERARCHY_1", HIERARCHY_1) ( "HIERARCHY_2", HIERARCHY_2) ( "HIERARCHY_4", HIERARCHY_4) ( "HIERARCHY_NONE", HIERARCHY_NONE); - boost::assign::insert(modulation) + boost::assign::insert(modulation) ( "QPSK", QPSK) ( "QAM_128", QAM_128) ( "QAM_16", QAM_16) ( "QAM_256", QAM_256) ( "QAM_32", QAM_32) ( "QAM_64", QAM_64); - boost::assign::insert(transmit_mode) + boost::assign::insert(transmit_mode) ( "TRANSMISSION_MODE_2K", TRANSMISSION_MODE_2K) ( "TRANSMISSION_MODE_8K", TRANSMISSION_MODE_8K); } -senf::DVBConfigParser::DVBConfigParser(fe_type_t type_, const string & configFilePath_) : - type(type_), +senf::DVBConfigParser::DVBConfigParser(fe_type_t type_, const string & configFilePath_) : + type(type_), configFile() { initConfigFile(configFilePath_); @@ -95,18 +95,18 @@ prefix_ string senf::DVBConfigParser::getConfigLine(string channel) string configLine; size_t pos; transform(channel.begin(), channel.end(), channel.begin(), ::toupper); - + configFile.open( configFilePath.c_str(), ios_base::in); if (configFile.bad()) SENF_THROW_SYSTEM_EXCEPTION("Could not read channels file: ") << configFilePath << "."; - + while (configFile.good()) { getline( configFile, configLine ); SENF_LOG((senf::log::NOTICE) ("configLine: " << configLine )); transform(configLine.begin(), configLine.end(), configLine.begin(), ::toupper); pos = configLine.find(channel); - - if (pos != string::npos && pos == 0) { // only first matching number should be interpreted as channel number + + if (pos != string::npos && pos == 0) { // only first matching number should be interpreted as channel number configFile.close(); return configLine; // Line found! } @@ -146,50 +146,50 @@ senf::DVBConfigParser::getFrontendParamDVB_T(const tokenizer & tokens) int number; enum { p_Frequency=1, p_Inversion, p_Bandwidth, p_hp_code_rate, p_lp_code_rate, p_Mudualtion, p_Transmission, p_guard, p_hierarchy}; vector words( tokens.begin(), tokens.end() ); - + ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); - + /*if (words.size() < 10) SENF_THROW_SYSTEM_EXCEPTION("Too few arguments! There must be at least 10, but there are only: ") << words.size();*/ - + isst.str(words[p_Frequency]); isst >> number; if (isst.fail()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse frequency"); frontend.frequency = number; - + if (params.inversion.find(words[p_Inversion]) == params.inversion.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse inversion"); frontend.inversion = params.inversion.find(words[p_Inversion])->second; - + if (params.bandwidth.find(words[p_Bandwidth]) == params.bandwidth.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse bandwidth"); frontend.u.ofdm.bandwidth = params.bandwidth.find(words[p_Bandwidth])->second; - + if (params.code_rate.find(words[p_hp_code_rate]) == params.code_rate.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse high priority stream code rate"); frontend.u.ofdm.code_rate_HP = params.code_rate.find(words[p_hp_code_rate])->second; - + if (params.code_rate.find(words[p_lp_code_rate]) == params.code_rate.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse low priority stream code rate"); frontend.u.ofdm.code_rate_LP = params.code_rate.find(words[p_lp_code_rate])->second; - + if (params.modulation.find(words[p_Mudualtion]) == params.modulation.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse modulation"); frontend.u.ofdm.constellation = params.modulation.find(words[p_Mudualtion])->second; - + if (params.transmit_mode.find(words[p_Transmission]) == params.transmit_mode.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse transmission mode"); frontend.u.ofdm.transmission_mode = params.transmit_mode.find(words[p_Transmission])->second; - + if (params.guard_interval.find(words[p_guard]) == params.guard_interval.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse guard interval"); - frontend.u.ofdm.guard_interval = params.guard_interval.find(words[p_guard])->second; - + frontend.u.ofdm.guard_interval = params.guard_interval.find(words[p_guard])->second; + if (params.hierarchy.find(words[p_hierarchy]) == params.hierarchy.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse hierarchy"); frontend.u.ofdm.hierarchy_information = params.hierarchy.find(words[p_hierarchy])->second; - + return frontend; } @@ -201,22 +201,22 @@ senf::DVBConfigParser::getFrontendParamDVB_S(const tokenizer & tokens) int number; enum { p_Frequency=1, p_Inversion, p_Symbole, p_code_rate}; vector words( tokens.begin(), tokens.end() ) ; - + ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); - + if (words.size() < 5) SENF_THROW_SYSTEM_EXCEPTION("Too few arguments! There must be at least 5, but there are only: ") << words.size(); - + isst.str(words[p_Frequency]); isst >> number; if (isst.fail()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse frequency"); frontend.frequency = number; - + if (params.inversion.find(words[p_Inversion]) == params.inversion.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse inversion"); frontend.inversion = params.inversion.find(words[p_Inversion])->second; - + isst.str(words[p_Symbole]); isst >> number; if (isst.fail()) @@ -226,7 +226,7 @@ senf::DVBConfigParser::getFrontendParamDVB_S(const tokenizer & tokens) if (params.code_rate.find(words[p_code_rate]) == params.code_rate.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse code rate"); frontend.u.qpsk.fec_inner = params.code_rate.find(words[p_code_rate])->second; - + return frontend; } @@ -237,36 +237,36 @@ senf::DVBConfigParser::getFrontendParamDVB_C(const tokenizer & tokens) istringstream isst; int number; enum { p_Frequency=1, p_Inversion, p_Symbole, p_code_rate, p_modulation}; - vector words( ++tokens.begin(), tokens.end() ) ; - + vector words( ++tokens.begin(), tokens.end() ) ; + ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); - + if (words.size() < 6) SENF_THROW_SYSTEM_EXCEPTION("Too few arguments! There must be at least 6, but there are only: ") << words.size(); - + isst.str(words[p_Frequency]); isst >> number; if (isst.fail()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse frequency"); frontend.frequency = number; - + if (params.inversion.find(words[p_Inversion]) == params.inversion.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse inversion"); frontend.inversion = params.inversion.find(words[p_Inversion])->second; - + isst.str(words[p_Symbole]); isst >> number; if (isst.fail()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse symbole rate"); frontend.u.qam.symbol_rate = number; - + if (params.code_rate.find(words[p_code_rate]) == params.code_rate.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse code rate"); frontend.u.qam.fec_inner = params.code_rate.find(words[p_code_rate])->second; - + if (params.modulation.find(words[p_modulation]) == params.modulation.end()) SENF_THROW_SYSTEM_EXCEPTION("Cant parse modulation"); frontend.u.qam.modulation = params.modulation.find(words[p_modulation])->second; - + return frontend; } diff --git a/senf/Socket/Protocols/DVB/DVBConfigParser.hh b/senf/Socket/Protocols/DVB/DVBConfigParser.hh index 4b03ea1..7684c44 100644 --- a/senf/Socket/Protocols/DVB/DVBConfigParser.hh +++ b/senf/Socket/Protocols/DVB/DVBConfigParser.hh @@ -37,7 +37,7 @@ namespace senf { - class DVBConfigParser + class DVBConfigParser { struct DVBParams { std::map inversion; @@ -47,17 +47,17 @@ namespace senf { std::map hierarchy; std::map modulation; std::map transmit_mode; - DVBParams(); + DVBParams(); }; static const DVBParams params; typedef boost::tokenizer > tokenizer; - + public: DVBConfigParser(fe_type_t type_, const std::string & configFilePath = ""); ~DVBConfigParser(); std::string getConfigLine(std::string channel); - + dvb_frontend_parameters getFrontendParam(std::string configLine); private: @@ -73,4 +73,4 @@ namespace senf { }; } -#endif +#endif diff --git a/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc b/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc index e1a769f..b19d520 100644 --- a/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc +++ b/senf/Socket/Protocols/DVB/DVBDemuxHandles.cc @@ -68,7 +68,7 @@ prefix_ void senf::DVBDemuxSectionSocketProtocol::setSectionFilter(unsigned shor sec_filter.filter.mask[0] = mask; sec_filter.filter.mode[0] = mode; sec_filter.flags = flags; - + if (::ioctl(fd(), DMX_SET_FILTER, &sec_filter) < 0) SENF_THROW_SYSTEM_EXCEPTION("Could not set section filter of DVB adapter."); } @@ -95,7 +95,7 @@ prefix_ unsigned senf::DVBDemuxPESSocketProtocol::available() prefix_ void senf::DVBDemuxPESSocketProtocol::setPESFilter(unsigned short int pid, dmx_input_t input, dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags) const { - + struct dmx_pes_filter_params pes_filter; ::memset(&pes_filter, 0, sizeof(struct dmx_pes_filter_params)); pes_filter.pid = pid; @@ -103,7 +103,7 @@ prefix_ void senf::DVBDemuxPESSocketProtocol::setPESFilter(unsigned short int pi pes_filter.output = output; pes_filter.pes_type = pesType; pes_filter.flags = flags; - + if (::ioctl(fd(), DMX_SET_PES_FILTER, &pes_filter) < 0) SENF_THROW_SYSTEM_EXCEPTION("Could not set PES filter of DVB adapter."); } diff --git a/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh b/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh index 7de18e8..dbc9a88 100644 --- a/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh +++ b/senf/Socket/Protocols/DVB/DVBDemuxHandles.hh @@ -52,14 +52,14 @@ namespace senf { NotWriteablePolicy >::policy DVBDemux_Policy; ///< Socket Policy for xxxx - /** \brief Baseclass of various DVBProtocolWrappers which are defined in DVBProtocolWrapper.hh + /** \brief Baseclass of various DVBProtocolWrappers which are defined in DVBProtocolWrapper.hh */ class DVBProtocolWrapper :public boost::enable_shared_from_this { public: DVBProtocolWrapper() {} virtual ~DVBProtocolWrapper() {} }; - /** \brief Baseclass for DVBSocketProtocols which want use Wrappers for console. + /** \brief Baseclass for DVBSocketProtocols which want use Wrappers for console. */ class DVBSocketProtocol : public virtual SocketProtocol { private: @@ -67,9 +67,9 @@ private: public: DVBSocketProtocol() {} ~DVBSocketProtocol() {} - - void addWrapper(boost::shared_ptr wrap)/**< Binds a wrapper to a DVBProtocol, - so if it is closed the functionality of the wrapper is automatically removed from console.*/ + + void addWrapper(boost::shared_ptr wrap)/**< Binds a wrapper to a DVBProtocol, + so if it is closed the functionality of the wrapper is automatically removed from console.*/ { wrap_ = wrap; } @@ -80,14 +80,14 @@ public: } }; - - + + class DVBDemuxSectionSocketProtocol : public ConcreteSocketProtocol, - public DVBDemuxSocketProtocol, + public DVBDemuxSocketProtocol, public DVBSocketProtocol { - + public: /////////////////////////////////////////////////////////////////////////// // internal interface @@ -103,24 +103,24 @@ public: ///@} ///\name Abstract Interface Implementation ///@{ - + unsigned available() const; ///@} - - void setSectionFilter(unsigned short int pid, + + void setSectionFilter(unsigned short int pid, unsigned char filter= 0x3e, - unsigned int flags= DMX_IMMEDIATE_START | DMX_CHECK_CRC, - unsigned char mask = 0xff, + unsigned int flags= DMX_IMMEDIATE_START | DMX_CHECK_CRC, + unsigned char mask = 0xff, unsigned char mode =0x00, unsigned int timeout =0x00) const; - + }; typedef ProtocolClientSocketHandle DVBDemuxSectionHandle; - + // ---------------------------------------------------------------- - + /** \brief xxx */ class DVBDemuxPESSocketProtocol @@ -143,20 +143,20 @@ public: ///@} ///\name Abstract Interface Implementation ///@{ - + unsigned available() const; ///@} - - void setPESFilter(unsigned short int pid, dmx_input_t input, dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags)const; + + void setPESFilter(unsigned short int pid, dmx_input_t input, dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags)const; }; typedef ProtocolClientSocketHandle DVBDemuxPESHandle; - + // ---------------------------------------------------------------- - - + + /** \brief xxx */ class DVBDvrSocketProtocol @@ -178,7 +178,7 @@ public: ///@} ///\name Abstract Interface Implementation ///@{ - + unsigned available() const; ///@} @@ -187,7 +187,7 @@ public: typedef ProtocolClientSocketHandle DVBDvrHandle; ///@} - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Socket/Protocols/DVB/DVBDemuxSocketProtocol.hh b/senf/Socket/Protocols/DVB/DVBDemuxSocketProtocol.hh index a3b4f33..fcfea35 100644 --- a/senf/Socket/Protocols/DVB/DVBDemuxSocketProtocol.hh +++ b/senf/Socket/Protocols/DVB/DVBDemuxSocketProtocol.hh @@ -26,7 +26,7 @@ #ifndef HH_SENF_Socket_Protocols_DVB_DVBDemuxSocketProtocol_ #define HH_SENF_Socket_Protocols_DVB_DVBDemuxSocketProtocol_ 1 -#include +#include // Custom includes #include @@ -45,7 +45,7 @@ namespace senf { : public virtual SocketProtocol { public: - void setBufferSize(unsigned long size) const; + void setBufferSize(unsigned long size) const; ///< set the size of the circular buffer used for filtered data. /**< The default size is two maximum sized sections, i.e. if this function is not called a buffer size of 2 * 4096 bytes will @@ -53,10 +53,10 @@ namespace senf { \param[in] size Size of circular buffer. */ void startFiltering() const; void stopFiltering() const; - + ///\name Abstract Interface Implementation ///@{ - + bool eof() const; ///@} diff --git a/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc b/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc index deaf5f1..c9aaa39 100644 --- a/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc +++ b/senf/Socket/Protocols/DVB/DVBFrontendHandle.cc @@ -65,20 +65,20 @@ prefix_ bool senf::DVBFrontendSocketProtocol::eof() } prefix_ void senf::DVBFrontendSocketProtocol::tune(const struct dvb_frontend_parameters & frontend) - const + const { // tuning if (::ioctl(fd(), FE_SET_FRONTEND, &frontend) ) SENF_THROW_SYSTEM_EXCEPTION("") << "ioctl FE_SET_FRONTEND failed. Socket should initialized with r/w permissions.";; } -prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_T(unsigned int frequency, +prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_T(unsigned int frequency, fe_spectral_inversion_t inversion, - fe_bandwidth_t bandwidth, + fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, /* high priority stream code rate */ fe_code_rate_t code_rate_LP, /* low priority stream code rate */ fe_modulation_t constellation, /* modulation type */ - fe_transmit_mode_t transmission_mode, + fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, fe_hierarchy_t hierarchy_information ) @@ -86,26 +86,26 @@ prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_T(unsigned int frequency, { struct dvb_ofdm_parameters ofdm; /* DVB-T Parameters */ struct dvb_frontend_parameters frontend; - + ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); ::memset(&ofdm, 0, sizeof(struct dvb_ofdm_parameters)); - + ofdm.bandwidth = bandwidth; ofdm.code_rate_HP = code_rate_HP; ofdm.code_rate_LP = code_rate_LP; - ofdm.constellation = constellation; + ofdm.constellation = constellation; ofdm.guard_interval = guard_interval; ofdm.hierarchy_information = hierarchy_information; - + frontend.frequency = frequency; frontend.inversion = inversion; frontend.u.ofdm = ofdm; - + tune(frontend); - + } -prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_S(unsigned int frequency, - fe_spectral_inversion_t inversion, +prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_S(unsigned int frequency, + fe_spectral_inversion_t inversion, unsigned int symbole_rate, /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner /* forward error correction (see above) */ ) @@ -113,21 +113,21 @@ prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_S(unsigned int frequency, { struct dvb_qpsk_parameters qpsk; /* DVB-S Parameters*/ struct dvb_frontend_parameters frontend; - + ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); ::memset(&qpsk, 0, sizeof(struct dvb_qpsk_parameters)); - + qpsk.symbol_rate = symbole_rate; qpsk.fec_inner = fec_inner; - + frontend.frequency = frequency; frontend.inversion = inversion; frontend.u.qpsk = qpsk; - + tune(frontend); } -prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_C(unsigned int frequency, +prefix_ void senf::DVBFrontendSocketProtocol::tuneDVB_C(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbol_rate, fe_code_rate_t fec_inner, @@ -137,22 +137,22 @@ const { struct dvb_qam_parameters qam; /* DVB-C Parameters*/ struct dvb_frontend_parameters frontend; - + ::memset(&frontend, 0, sizeof(struct dvb_frontend_parameters)); ::memset(&qam, 0, sizeof(struct dvb_qam_parameters)); - + qam.symbol_rate = symbol_rate; qam.fec_inner = fec_inner; qam.modulation = modulation; - - + + frontend.frequency = frequency; frontend.inversion = inversion; frontend.u.qam = qam; - + tune(frontend); } -prefix_ void senf::DVBFrontendSocketProtocol::setNonBlock(bool on) +prefix_ void senf::DVBFrontendSocketProtocol::setNonBlock(bool on) const { if (on) @@ -166,7 +166,7 @@ prefix_ dvb_frontend_info senf::DVBFrontendSocketProtocol::getInfo() { struct dvb_frontend_info info; ::memset(&info, 0, sizeof(struct dvb_frontend_info)); - + if (::ioctl(fd(), FE_GET_INFO, &info)) { SENF_THROW_SYSTEM_EXCEPTION("") << "Could not read on fildescriptor."; } @@ -175,9 +175,9 @@ prefix_ dvb_frontend_info senf::DVBFrontendSocketProtocol::getInfo() prefix_ dvb_frontend_parameters senf::DVBFrontendSocketProtocol::getFrontendParam() const { struct dvb_frontend_parameters frontend_; - + ::memset(&frontend_, 0, sizeof(struct dvb_frontend_parameters)); - + if (::ioctl(fd(), FE_GET_FRONTEND, &frontend_)) { switch(errno) { case EBADF: @@ -198,9 +198,9 @@ prefix_ dvb_frontend_parameters senf::DVBFrontendSocketProtocol::getFrontendPara prefix_ dvb_frontend_event senf::DVBFrontendSocketProtocol::getEvent() const{ struct dvb_frontend_event ev ; - + ::memset(&ev, 0, sizeof(struct dvb_frontend_event)); - + if (::ioctl(fd(), FE_GET_EVENT, &ev)) { switch(errno) { case EBADF: @@ -226,7 +226,7 @@ prefix_ int16_t senf::DVBFrontendSocketProtocol::signalStrength() } prefix_ int16_t senf::DVBFrontendSocketProtocol::signalNoiseRatio() - const + const { int16_t snr; if (::ioctl(fd(), FE_READ_SNR, &snr) < 0) diff --git a/senf/Socket/Protocols/DVB/DVBFrontendHandle.hh b/senf/Socket/Protocols/DVB/DVBFrontendHandle.hh index ffc6cc6..47606e8 100644 --- a/senf/Socket/Protocols/DVB/DVBFrontendHandle.hh +++ b/senf/Socket/Protocols/DVB/DVBFrontendHandle.hh @@ -53,29 +53,29 @@ namespace senf { NotReadablePolicy, NotWriteablePolicy > ::policy DVBFrontend_Policy; ///< Socket Policy for DVBFrontendSocketProtocol - + /** \brief SocketProtocol for the dvb frontend device The DVB frontend device controls the tuner and DVB demodulator hardware. ATTENTION! Some calls are not supported by real life drivers, known issues: - + Cinergy T� getParameter is not supported Cinergy T� in getEvent fe_status_t will be set but dvb_frontend_parameters will be stay untouched Cinergy DT XS bitErrorRate is not supported - + This dues to the lack of driver implementation. There could be restrictions also for other DVB devices! */ - + class DVBFrontendSocketProtocol : public ConcreteSocketProtocol { - private: + private: void tune(const struct dvb_frontend_parameters & frontend) const; public: - - + + /////////////////////////////////////////////////////////////////////////// // internal interface @@ -90,40 +90,40 @@ namespace senf { ///@} void setNonBlock(bool on = true) const; - + void tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) const; ///< Tunes a DVB-S device /**< Tunes a DVB-S device. Needs full configuration */ - void tuneDVB_T(unsigned int frequency, + void tuneDVB_T(unsigned int frequency, fe_spectral_inversion_t inversion, - fe_bandwidth_t bandwidth, + fe_bandwidth_t bandwidth, fe_code_rate_t code_rate_HP, /* high priority stream code rate */ fe_code_rate_t code_rate_LP, /* low priority stream code rate */ fe_modulation_t constellation, /* modulation type (see above) */ - fe_transmit_mode_t transmission_mode, + fe_transmit_mode_t transmission_mode, fe_guard_interval_t guard_interval, fe_hierarchy_t hierarchy_information ) const; ///< Tunes a DVB-T device /**< Tunes a DVB-T device. Needs full configuration */ - void tuneDVB_C(unsigned int frequency, + void tuneDVB_C(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbol_rate, fe_code_rate_t fec_inner, fe_modulation_t modulation - ) const; + ) const; ///< Tunes a DVB-C device /**< Tunes a DVB-C device. Needs full configuration */ dvb_frontend_info getInfo() const; ///< Returns information struct. - /**< Returns information struct, which contains information + /**< Returns information struct, which contains information about the device which is associated with the current frontend.*/ struct dvb_frontend_parameters getFrontendParam() const; ///< Returns dvb_frontend_parameters struct. - /**< Returns dvb_frontend_parameters struct, which contains the actual + /**< Returns dvb_frontend_parameters struct, which contains the actual configuration of the device.*/ ///\name Abstract Interface Implementation ///@{ - + dvb_frontend_event getEvent() const; - + unsigned available() const; ///< Returns always 0 /**< Returns always 0, since the DVB frontend @@ -149,20 +149,20 @@ namespace senf { /**< Returns the bit error rate for the signal currently received/demodulated by the front-end. For this method, read-only access to the device is sufficient. */ - uint32_t uncorrectedBlocks() const; ///< Returns the number of uncorrected blocks - /**< Returns the number of uncorrected blocks + uint32_t uncorrectedBlocks() const; ///< Returns the number of uncorrected blocks + /**< Returns the number of uncorrected blocks * detected by the device driver during its lifetime. - * For meaningful measurements, the increment in block - * count during a specific time interval should be calculated. + * For meaningful measurements, the increment in block + * count during a specific time interval should be calculated. * For this command, read-only access to the device is sufficient. - * Note that the counter will wrap to zero after its maximum count + * Note that the counter will wrap to zero after its maximum count * has been reached.*/ - + fe_status_t status() const; ///< This ioctl call returns status information about the front-end. - /**< This ioctl call returns status information about the - * front-end. This call only requires read-only access + /**< This ioctl call returns status information about the + * front-end. This call only requires read-only access * to the device.*/ - + }; typedef ProtocolClientSocketHandle DVBFrontendHandle; diff --git a/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cc b/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cc index 25abd61..d8fdb6c 100644 --- a/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cc +++ b/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cc @@ -30,83 +30,94 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemuxSectionHandle sh) +prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemuxSectionHandle sh) : protocol(sh.protocol()), dir(this) { namespace kw = senf::console::kw; namespace fty = senf::console::factory; dir.add("buffersize", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this) - .doc("Set the size of the circular buffer used for filtered data.") - .arg("size", "in byte") ); + .doc("Set the size of the circular buffer used for filtered data.") + .arg("size", "in byte") ); dir.add("start", fty::Command(&DVBSectionProtocolWrapper::startFiltering, this) - .doc("Starts filtering") ); + .doc("Starts filtering") ); dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this) - .doc("Stops filtering") ); - - dir.add("filter", - fty::Command, - unsigned, - unsigned, - unsigned) - >(&DVBSectionProtocolWrapper::setSectionFilter, this) - .arg("pid", "pid to filter") - .arg("filter", "filter", - kw::default_value = 62, - kw::default_doc = "0x3e") - .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT", - kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC, - kw::default_doc = "(IMMEDIATE_START CHECK_CRC)") - .arg("mask", "mask", - kw::default_value = 0xff, - kw::default_doc = "0xff") - .arg("mode", "mode", - kw::default_value = 0, - kw::default_doc = "0x00") - .arg("timeout", "timeout", - kw::default_value = 0, - kw::default_doc = "0x00") - .doc("Sets parameters for section filter.") ); + .doc("Stops filtering") ); + + dir.add("filter", + fty::Command, + unsigned, + unsigned, + unsigned) + >(&DVBSectionProtocolWrapper::setSectionFilter, this) + .arg("pid", "pid to filter") + .arg("filter", "filter", + kw::default_value = 62, + kw::default_doc = "0x3e") + .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT", + kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC, + kw::default_doc = "(IMMEDIATE_START CHECK_CRC)") + .arg("mask", "mask", + kw::default_value = 0xff, + kw::default_doc = "0xff") + .arg("mode", "mode", + kw::default_value = 0, + kw::default_doc = "0x00") + .arg("timeout", "timeout", + kw::default_value = 0, + kw::default_doc = "0x00") + .doc("Sets parameters for section filter.") ); dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this) - .doc("Stops filtering") ); + .doc("Stops filtering") ); } -prefix_ senf::DVBPESProtocolWrapper::DVBPESProtocolWrapper(senf::DVBDemuxPESHandle sh) - : protocol(sh.protocol()), dir(this) +prefix_ senf::DVBPESProtocolWrapper::DVBPESProtocolWrapper(senf::DVBDemuxPESHandle sh) + : protocol(sh.protocol()), dir(this) { namespace kw = senf::console::kw; namespace fty = senf::console::factory; - dir.add("filter", - fty::Command) - >(&DVBPESProtocolWrapper::setPESFilter, this) - .arg("pid", "pid to filter") - .arg("input", "input-filter: DMX_IN_FRONTEND DMX_IN_DVR ") - .arg("output", "output-filter: DMX_OUT_DECODER DMX_OUT_TAP DMX_OUT_TS_TAP ") - .arg("pesType", "PES type: DMX_PES_AUDIO[0-3] DMX_PES_VIDEO[0-3] " - "DMX_PES_TELETEXT[0-3], DMX_PES_SUBTITLE[0-3], DMX_PES_PCR[0-3], " - "DMX_PES_OTHER") - .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT", - kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC, - kw::default_doc = "(IMMEDIATE_START CHECK_CRC)") - .doc("Sets parameters for PES filter.") ); - + dir.add("filter", + fty::Command) + >(&DVBPESProtocolWrapper::setPESFilter, this) + .arg("pid", "pid to filter") + .arg("input", "input-filter: DMX_IN_FRONTEND DMX_IN_DVR ") + .arg("output", "output-filter: DMX_OUT_DECODER DMX_OUT_TAP DMX_OUT_TS_TAP ") + .arg("pesType", "PES type: DMX_PES_AUDIO[0-3] DMX_PES_VIDEO[0-3] " + "DMX_PES_TELETEXT[0-3], DMX_PES_SUBTITLE[0-3], DMX_PES_PCR[0-3], " + "DMX_PES_OTHER") + .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT", + kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC, + kw::default_doc = "(IMMEDIATE_START CHECK_CRC)") + .doc("Sets parameters for PES filter.") ); + dir.add("start", fty::Command(&DVBPESProtocolWrapper::startFiltering, this) - .doc("Starts filtering") ); + .doc("Starts filtering") ); dir.add("stop", fty::Command(&DVBPESProtocolWrapper::stopFiltering, this) - .doc("Stops filtering") ); + .doc("Stops filtering") ); } ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cci b/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cci index 7f653f2..b63c768 100644 --- a/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cci +++ b/senf/Socket/Protocols/DVB/DVBProtocolWrapper.cci @@ -25,12 +25,12 @@ // Custom includes -#define prefix_ inline +#define prefix_ inline ///////////////////////////////cci.p//////////////////////////////////////// prefix_ void senf::DVBSectionProtocolWrapper::setSectionFilter( - unsigned short int pid, u_int8_t filter, unsigned int flags, u_int8_t mask, - u_int8_t mode, unsigned int timeout) + unsigned short int pid, u_int8_t filter, unsigned int flags, u_int8_t mask, + u_int8_t mode, unsigned int timeout) { protocol.setSectionFilter(pid, timeout, flags, filter, mask, mode); } @@ -52,7 +52,7 @@ prefix_ void senf::DVBSectionProtocolWrapper::stopFiltering() prefix_ void senf::DVBPESProtocolWrapper::setPESFilter(unsigned short int pid, dmx_input_t input, - dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags) + dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags) { protocol.setPESFilter(pid, input, output, pesType, flags); } diff --git a/senf/Socket/Protocols/DVB/DVBProtocolWrapper.hh b/senf/Socket/Protocols/DVB/DVBProtocolWrapper.hh index e6cf65e..46848fb 100644 --- a/senf/Socket/Protocols/DVB/DVBProtocolWrapper.hh +++ b/senf/Socket/Protocols/DVB/DVBProtocolWrapper.hh @@ -43,7 +43,7 @@ namespace senf { /** \brief Helperclass for configuration and controlling DVB protocol handles. */ - class DVBSectionProtocolWrapper : public DVBProtocolWrapper + class DVBSectionProtocolWrapper : public DVBProtocolWrapper { private: const DVBDemuxSectionSocketProtocol& protocol; @@ -57,11 +57,11 @@ namespace senf { DVBSectionProtocolWrapper(senf::DVBDemuxSectionHandle sh); ~DVBSectionProtocolWrapper() { } - + void setSectionFilter(unsigned short int pid, u_int8_t filter, unsigned int flags, u_int8_t mask, u_int8_t mode, unsigned int timeout); - void setBufferSize(unsigned long size); + void setBufferSize(unsigned long size); ///< Set the size of the circular buffer used for filtered data. /**< The default size is two maximum sized sections, i.e. if this function is not called a buffer size of 2 * 4096 bytes @@ -70,16 +70,16 @@ namespace senf { void startFiltering(); ///< Starts filtering void stopFiltering(); ///< Stops filtering }; - + SENF_CONSOLE_REGISTER_ENUM_MEMBER(DVBSectionProtocolWrapper, Flags, (CHECK_CRC)(ONESHOT)(IMMEDIATE_START)(KERNEL_CLIENT)); - + class DVBPESProtocolWrapper : public senf::DVBProtocolWrapper { private: const senf::DVBDemuxPESSocketProtocol& protocol; - + public: enum Flags {CHECK_CRC = DMX_CHECK_CRC, ONESHOT = DMX_ONESHOT, @@ -95,7 +95,7 @@ namespace senf { void startFiltering(); ///< Starts filtering void stopFiltering(); ///< Stops filtering }; - + SENF_CONSOLE_REGISTER_ENUM_MEMBER(DVBPESProtocolWrapper, Flags, (CHECK_CRC)(ONESHOT)(IMMEDIATE_START)(KERNEL_CLIENT)); } diff --git a/senf/Socket/Protocols/DVB/DVBSocketController.cc b/senf/Socket/Protocols/DVB/DVBSocketController.cc index a525fad..0f4ddcb 100644 --- a/senf/Socket/Protocols/DVB/DVBSocketController.cc +++ b/senf/Socket/Protocols/DVB/DVBSocketController.cc @@ -39,7 +39,8 @@ using namespace std; unsigned int senf::DVBSocketController::controllerNr(0); -senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_, const Callback & cb_) +senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_, + const Callback & cb_) : dir( this ), frontendHandle( frontendHandle_ ), type( frontendHandle.protocol().getInfo().type ), @@ -47,7 +48,9 @@ senf::DVBSocketController::DVBSocketController(DVBFrontendHandle frontendHandle_ cb( cb_ ), sectionNr(1), pesNr(1), - event( "senf::DVBSocketController::readEvent", senf::membind(&DVBSocketController::readEvent, this), frontendHandle, senf::scheduler::FdEvent::EV_PRIO, false ) + event( "senf::DVBSocketController::readEvent", + senf::membind(&DVBSocketController::readEvent, this), frontendHandle, + senf::scheduler::FdEvent::EV_PRIO, false ) { initConsole(); } @@ -59,22 +62,22 @@ prefix_ senf::DVBDemuxSectionHandle senf::DVBSocketController::createDVBDemuxSectionHandle(int adapternumber, int demuxnumber, bool addToConsole) { - DVBDemuxSectionHandle sectionHandle(adapternumber, demuxnumber); + DVBDemuxSectionHandle sectionHandle(adapternumber, demuxnumber); if (addToConsole) this->addToConsole(sectionHandle); return sectionHandle; - + } prefix_ senf::DVBDemuxPESHandle senf::DVBSocketController::createDVBDemuxPESHandle(int adapternumber, int demuxnumber, bool addToConsole) { - DVBDemuxPESHandle pesHandle(adapternumber, demuxnumber); + DVBDemuxPESHandle pesHandle(adapternumber, demuxnumber); if (addToConsole) this->addToConsole(pesHandle); return pesHandle; - + } prefix_ void senf::DVBSocketController::addToConsole(senf::DVBDemuxSectionHandle sh) @@ -112,13 +115,18 @@ prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const st if (mode.c_str()[0]=='a') { switch (type) { case FE_QPSK: - tuneDVB_S(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner); + tuneDVB_S(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, + frontend.u.qpsk.fec_inner); break; case FE_QAM: - tuneDVB_C(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, frontend.u.qam.fec_inner, frontend.u.qam.modulation); + tuneDVB_C(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, + frontend.u.qam.fec_inner, frontend.u.qam.modulation); break; case FE_OFDM: - tuneDVB_T(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, frontend.u.ofdm.guard_interval, frontend.u.ofdm.hierarchy_information); + tuneDVB_T(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, + frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, + frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, + frontend.u.ofdm.guard_interval, frontend.u.ofdm.hierarchy_information); break; default: SENF_THROW_SYSTEM_EXCEPTION("Could not determine type of card."); @@ -127,13 +135,19 @@ prefix_ void senf::DVBSocketController::tuneToCMD(const string & input, const st else { switch (type) { case FE_QPSK: - tuneDVB_S_sync(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner); + tuneDVB_S_sync(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, + frontend.u.qpsk.fec_inner); break; case FE_QAM: - tuneDVB_C_sync(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, frontend.u.qam.fec_inner, frontend.u.qam.modulation); + tuneDVB_C_sync(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, + frontend.u.qam.fec_inner, frontend.u.qam.modulation); break; case FE_OFDM: - tuneDVB_T_sync(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, frontend.u.ofdm.guard_interval, frontend.u.ofdm.hierarchy_information); + tuneDVB_T_sync(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, + frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, + frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, + frontend.u.ofdm.guard_interval, + frontend.u.ofdm.hierarchy_information); break; default: SENF_THROW_SYSTEM_EXCEPTION("Could not determine type of card."); @@ -150,13 +164,18 @@ prefix_ void senf::DVBSocketController::tuneTo(const string & channel) frontend = parser.getFrontendParam(configLine); switch (type) { case FE_QPSK: - tuneDVB_S(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner); + tuneDVB_S(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, + frontend.u.qpsk.fec_inner); break; case FE_QAM: - tuneDVB_C(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, frontend.u.qam.fec_inner, frontend.u.qam.modulation); + tuneDVB_C(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, + frontend.u.qam.fec_inner, frontend.u.qam.modulation); break; case FE_OFDM: - tuneDVB_T(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, frontend.u.ofdm.guard_interval, frontend.u.ofdm.hierarchy_information); + tuneDVB_T(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, + frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, + frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, + frontend.u.ofdm.guard_interval, frontend.u.ofdm.hierarchy_information); break; default: SENF_THROW_SYSTEM_EXCEPTION("Could not determine type of card."); @@ -175,7 +194,8 @@ prefix_ void senf::DVBSocketController::tuneDVB_T(unsigned int frequency, ) { if (type != FE_OFDM) - SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!"; + SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") + << getTypeString() << " for this operation you need a DVB-T Card!"; event.enable(); @@ -191,10 +211,14 @@ prefix_ void senf::DVBSocketController::tuneDVB_T(unsigned int frequency, hierarchy_information); } -prefix_ void senf::DVBSocketController::tuneDVB_S(unsigned int frequency, fe_spectral_inversion_t inversion, unsigned int symbole_rate, fe_code_rate_t code_rate) +prefix_ void senf::DVBSocketController::tuneDVB_S(unsigned int frequency, + fe_spectral_inversion_t inversion, + unsigned int symbole_rate, + fe_code_rate_t code_rate) { if (type != FE_QPSK) - SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!"; + SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") + << getTypeString() << " for this operation you need a DVB-S Card!"; event.enable(); @@ -210,7 +234,8 @@ prefix_ void senf::DVBSocketController::tuneDVB_C(unsigned int frequency, ) { if (type != FE_QAM) - SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!"; + SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") + << getTypeString() << " for this operation you need a DVB-C Card!"; event.enable(); @@ -228,13 +253,19 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneTo_sync(const string & frontend = parser.getFrontendParam(configLine); switch (type) { case FE_QPSK: - ev = tuneDVB_S_sync(frontend.frequency, frontend.inversion, frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner); + ev = tuneDVB_S_sync(frontend.frequency, frontend.inversion, + frontend.u.qpsk.symbol_rate, frontend.u.qpsk.fec_inner); break; case FE_QAM: - ev = tuneDVB_C_sync(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, frontend.u.qam.fec_inner, frontend.u.qam.modulation); + ev = tuneDVB_C_sync(frontend.frequency, frontend.inversion, frontend.u.qam.symbol_rate, + frontend.u.qam.fec_inner, frontend.u.qam.modulation); break; case FE_OFDM: - ev = tuneDVB_T_sync(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, frontend.u.ofdm.guard_interval, frontend.u.ofdm.hierarchy_information); + ev = tuneDVB_T_sync(frontend.frequency, frontend.inversion, frontend.u.ofdm.bandwidth, + frontend.u.ofdm.code_rate_HP, frontend.u.ofdm.code_rate_LP, + frontend.u.ofdm.constellation, frontend.u.ofdm.transmission_mode, + frontend.u.ofdm.guard_interval, + frontend.u.ofdm.hierarchy_information); break; default: SENF_THROW_SYSTEM_EXCEPTION("Could not determine type of card."); @@ -254,7 +285,8 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_T_sync(unsigned in ) { if (type != FE_OFDM) - SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-T Card!"; + SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") + << getTypeString() << " for this operation you need a DVB-T Card!"; event.disable(); @@ -282,7 +314,8 @@ senf::DVBSocketController::tuneDVB_S_sync(unsigned int frequency, unsigned int symbole_rate, fe_code_rate_t code_rate) { if (type != FE_QPSK) - SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-S Card!"; + SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") + << getTypeString() << " for this operation you need a DVB-S Card!"; event.disable(); @@ -303,7 +336,8 @@ prefix_ dvb_frontend_event senf::DVBSocketController::tuneDVB_C_sync(unsigned in ) { if (type != FE_QAM) - SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") << getTypeString() << " for this operation you need a DVB-C Card!"; + SENF_THROW_SYSTEM_EXCEPTION("Type of card is: ") + << getTypeString() << " for this operation you need a DVB-C Card!"; event.disable(); @@ -432,25 +466,36 @@ prefix_ void senf::DVBSocketController::initConsole() ++controllerNr; dir.add("type", fty::Command(&DVBSocketController::getTypeString, this) - .doc("Shows actual type of card DVB-{T, S, C}") ); + .doc("Shows actual type of card DVB-{T, S, C}") ); dir.add("info", fty::Command(&DVBSocketController::getTuneInfo, this) - .doc("Returns a string which shows actual tuning status.\n" - "'S' prints signal strength (in hex)\n" - "'s' prints singal to noise ration (in hex)\n" - "'b' prints bit error rate (in hex)\n" - "'u' prints uncorrected blocks (in hex)\n" - "'f' prints readable overal status e.g. 'Has Lock'\n\n" - "These characters can be used to form the output. Be aware, some\n" - "features may not be supported be your current driver implementation\n" - "and could end in throwing an exception!") - .arg("conf", "Ssbuf", kw::default_value = "Ssbuf") ); + .doc("Returns a string which shows actual tuning status.\n" + "'S' prints signal strength (in hex)\n" + "'s' prints singal to noise ration (in hex)\n" + "'b' prints bit error rate (in hex)\n" + "'u' prints uncorrected blocks (in hex)\n" + "'f' prints readable overal status e.g. 'Has Lock'\n\n" + "These characters can be used to form the output. Be aware, some\n" + "features may not be supported be your current driver implementation\n" + "and could end in throwing an exception!") + .arg("conf", "Ssbuf", kw::default_value = "Ssbuf") ); dir.add("tune", fty::Command(&DVBSocketController::tuneToCMD, this) - .doc("tunes to channel listet in the configfile.") - .arg("channel", "channel to tune") - .arg("mode", "mode 'sync' or 'async'", kw::default_value = "async") ); + .doc("tunes to channel listet in the configfile.") + .arg("channel", "channel to tune") + .arg("mode", "mode 'sync' or 'async'", kw::default_value = "async") ); } ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/senf/Socket/Protocols/DVB/DVBSocketController.hh b/senf/Socket/Protocols/DVB/DVBSocketController.hh index e92cd4c..92a684e 100644 --- a/senf/Socket/Protocols/DVB/DVBSocketController.hh +++ b/senf/Socket/Protocols/DVB/DVBSocketController.hh @@ -53,9 +53,9 @@ namespace senf { You have to find out which parts of these functionality are implemented by your preferred device driver by your own. */ - - - + + + class DVBSocketController : boost::noncopyable { public: @@ -67,26 +67,26 @@ public: DVBSocketController(DVBFrontendHandle frontendHandle_ = DVBFrontendHandle(0,0), const Callback & cb = NULL); ~DVBSocketController(); - + senf::DVBDemuxSectionHandle createDVBDemuxSectionHandle( int adapternumber=0, int demuxnumber=0, bool addToConsole=false ); senf::DVBDemuxPESHandle createDVBDemuxPESHandle( int adapternumber=0, int demuxnumber=0, bool addToConsole=false ); void addToConsole(senf::DVBDemuxSectionHandle sh); - ///< Adds an DVBDemuxSectionHandle to the console - /**< Allocates the functionality of DVBDemuxSectionProtocol - into the folder of the DVBSocketController. If the - protocol is closed, or all handles are discarded the + ///< Adds an DVBDemuxSectionHandle to the console + /**< Allocates the functionality of DVBDemuxSectionProtocol + into the folder of the DVBSocketController. If the + protocol is closed, or all handles are discarded the console support will automatically removed. \param[in] sh handle of a protocol*/ - + void addToConsole(senf::DVBDemuxPESHandle sh); - ///< Adds an DVBDemuxPESHandle to the console + ///< Adds an DVBDemuxPESHandle to the console /**< Allocates the functionality of DVBDemuxPESProtocol into the folder of the DVBSocketController. If the protocol - is closed, or all handles are discarded the console + is closed, or all handles are discarded the console support will automatically removed. \param[in] sh handle of a protocol*/ - + void tuneToCMD( const std::string & input, const std::string & mode = "async"); ///< Tunes a DVB device given by the type of the DVBFrontendHandle /**< Tunes a DVB device by a channel name or complete diff --git a/senf/Socket/Protocols/DatagramSocketProtocol.hh b/senf/Socket/Protocols/DatagramSocketProtocol.hh index a0586b7..84368a3 100644 --- a/senf/Socket/Protocols/DatagramSocketProtocol.hh +++ b/senf/Socket/Protocols/DatagramSocketProtocol.hh @@ -55,7 +55,7 @@ namespace senf { on the socket. \returns timestamp when last packet was received */ }; - + ///\} } diff --git a/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc b/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc index 1fa7222..d4447f3 100644 --- a/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc +++ b/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.cc @@ -83,7 +83,7 @@ senf::ConnectedRawV6SocketProtocol::init_client(int const & protocol, INet6Socke const { init_client(protocol); - if (address.boolean_test()) { + if (address.boolean_test()) { //only connect if socket is not [::]:0, this results in an irreversible binding to the lo interface (linux 2.6.15) clientHandle().connect(address); } diff --git a/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.hh b/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.hh index ad43e92..e1fadbc 100644 --- a/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.hh +++ b/senf/Socket/Protocols/INet/ConnectedRawINetSocketHandle.hh @@ -61,19 +61,20 @@ namespace senf { \par Address Type: INet4SocketAddress - ConnectedRawV4SocketProtocol provides an Internet protocol raw socket based on IPv4 addressing. - This socket will put data written to it onto the IPv4 layer: if you call writeto don't include - the header! - On the other hand `read` will return the packet data including the IP header. - This behaviour is strange and differs from the behaviour of IPv6 RAW sockets and should be - changed in the future. + ConnectedRawV4SocketProtocol provides an Internet protocol raw socket based on IPv4 + addressing. This socket will put data written to it onto the IPv4 layer: if you call + writeto don't include the header! + + On the other hand `read` will return the packet data including the IP header. + This behaviour is strange and differs from the behaviour of IPv6 RAW sockets and should be + changed in the future. This class is utilized as the protocol class of the ProtocolClientSocketHandle via the Socket Handle typedefs above. - \attention - If socket handle with ConnectedRawV4SocketProtocol is connected via INet4SocketAddress, the port number - is interpreted as protocol number for IPv4 layer. Please refer manpage: "man 7 raw". + \attention If socket handle with ConnectedRawV4SocketProtocol is connected via + INet4SocketAddress, the port number is interpreted as protocol number for IPv4 + layer. Please refer manpage: "man 7 raw". \see ConnectedRawV6SocketProtocol \see RawV4SocketProtocol @@ -97,24 +98,27 @@ namespace senf { /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ - void init_client(int const & protocol) const; ///< Create unconnected client socket for protocol - + void init_client(int const & protocol) const; + ///< Create unconnected client socket for protocol + void init_client(int const & protocol, INet4SocketAddress const & address) const; ///< Create client socket and connect - /**< Creates a new client socket for the given protocol and connects to the given - address. - \param[in] protocol Layer 4 protocol to filter for / to send + /**< Creates a new client socket for the given protocol and + connects to the given address. + \param[in] protocol Layer 4 protocol to filter for / to + send \param[in] address local address to connect to */ ///@} }; - typedef ProtocolClientSocketHandle ConnectedRawV4ClientSocketHandle; + typedef ProtocolClientSocketHandle + ConnectedRawV4ClientSocketHandle; -//////////////////////////////////////////////////////////////////// Raw IPv6 Socket ////////////////////////////////////// +//////////////////////////////////////////////// Raw IPv6 Socket //////////////////////////// typedef MakeSocketPolicy< INet6AddressingPolicy, DatagramFramingPolicy, @@ -128,24 +132,25 @@ namespace senf { \par Socket Handle typedefs: \ref ConnectedRawV6ClientSocketHandle (ProtocolClientSocketHandle) - \par Policy Interface: + \par Policy Interface: ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(), ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer() - + \par Address Type: INet6Address - ConnectedRawV6SocketProtocol provides an internet protocol raw socket based on IPv6 addressing which is connected to certain peer. - This socket will put data written to it onto the IPv6 layer: if you call writeto don't inlude the header! - On the other hand `read` will return the packet data on top of the IPv6 layer, excluding the IP header. - Note: This behaviour is differs from the behaviour of IPv4 RAW sockets. + ConnectedRawV6SocketProtocol provides an internet protocol raw socket based on IPv6 + addressing which is connected to certain peer. This socket will put data written to it onto + the IPv6 layer: if you call writeto don't inlude the header! On the other hand `read` will + return the packet data on top of the IPv6 layer, excluding the IP header. Note: This + behaviour is differs from the behaviour of IPv4 RAW sockets. This class is utilized as the protocol class of the ProtocolClientSocketHandle via the Socket Handle typedefs above. - \attention - If socket handle with ConnectedRawV6SocketProtocol is connected via INet6SocketAddress, the port number - is interpreted as protocol number for IPv6 layer. Please refer manpage: "man 7 ipv6". + \attention If socket handle with ConnectedRawV6SocketProtocol is connected via + INet6SocketAddress, the port number is interpreted as protocol number for IPv6 + layer. Please refer manpage: "man 7 ipv6". \see ConnectedRawV4SocketProtocol \see RawV4SocketProtocol @@ -170,25 +175,39 @@ namespace senf { ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ - void init_client(int const & protocol) const; ///< Create unconnected client socket for protocol + void init_client(int const & protocol) const; + ///< Create unconnected client socket for protocol void init_client(int const & protocol, INet6SocketAddress const & address) const; ///< Create client socket and connect - /**< Creates a new client socket for the given protocol and connects to the given - address. - \param[in] protocol Layer 4 protocol to filter for / to send - \param[in] address local address to connect to */ - /**< \note This member is implicitly called from the + /**< Creates a new client socket for the given protocol and + connects to the given address. + \param[in] protocol Layer 4 protocol to filter for / to + send + \param[in] address local address to connect to + \note This member is implicitly called from the // ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor (??) */ ///@} }; - typedef ProtocolClientSocketHandle ConnectedRawV6ClientSocketHandle; + typedef ProtocolClientSocketHandle + ConnectedRawV6ClientSocketHandle; /// @} } #endif /*CONNECTEDHH_SENF_Socket_Protocols_INet_RawINetSocketHandle_*/ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/senf/Socket/Protocols/INet/ConnectedUDPSocketHandle.hh b/senf/Socket/Protocols/INet/ConnectedUDPSocketHandle.hh index 5d938fe..bc9190a 100644 --- a/senf/Socket/Protocols/INet/ConnectedUDPSocketHandle.hh +++ b/senf/Socket/Protocols/INet/ConnectedUDPSocketHandle.hh @@ -67,7 +67,7 @@ namespace senf { \par Address Type: INet4SocketAddress - + ConnectedUDPv4SocketProtocol provides an internet protocol stream socket based on the UDP protocol and IPv4 addressing. @@ -123,7 +123,7 @@ namespace senf { \par Policy Interface: ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(), ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer() - + \par Address Type: INet6Address diff --git a/senf/Socket/Protocols/INet/INet6Address.ct b/senf/Socket/Protocols/INet/INet6Address.ct index d7121a3..fdca56f 100644 --- a/senf/Socket/Protocols/INet/INet6Address.ct +++ b/senf/Socket/Protocols/INet/INet6Address.ct @@ -51,7 +51,7 @@ template prefix_ void senf::detail::apply_mask(unsigned bits, ForwardIterator b, ForwardIterator e, Function fn) { - for(; bits>8 && b != e; bits -= 8, ++b) + for(; bits>8 && b != e; bits -= 8, ++b) fn(*b, boost::lambda::make_const(0xFFu)); if (bits > 0 && b != e) fn( *(b++), boost::lambda::make_const(~ low_bits_mask(8-bits))); @@ -61,10 +61,10 @@ prefix_ void senf::detail::apply_mask(unsigned bits, ForwardIterator b, ForwardI template prefix_ ForwardIterator1 senf::detail::find_if_mask(unsigned bits, ForwardIterator1 b1, - ForwardIterator1 e1, ForwardIterator2 b2, + ForwardIterator1 e1, ForwardIterator2 b2, Function fn) { - for(; bits>8 && b1 != e1; bits -= 8, ++b1, ++b2) + for(; bits>8 && b1 != e1; bits -= 8, ++b1, ++b2) if (fn(*b1, *b2, boost::lambda::make_const(0xFFu))) return b1; if (bits > 0 && b1 != e1) diff --git a/senf/Socket/Protocols/INet/INet6Address.cti b/senf/Socket/Protocols/INet/INet6Address.cti index 1947b12..608a581 100644 --- a/senf/Socket/Protocols/INet/INet6Address.cti +++ b/senf/Socket/Protocols/INet/INet6Address.cti @@ -44,7 +44,7 @@ template prefix_ bool senf::detail::CheckINet6Network_impl5::match(boost::uint8_t v0, boost::uint8_t v1) { - return v0 & ~boost::low_bits_mask_t<8-restbits>::sig_bits + return v0 & ~boost::low_bits_mask_t<8-restbits>::sig_bits == boost::uint8_t(a>>8) & ~boost::low_bits_mask_t<8-restbits>::sig_bits; } @@ -60,11 +60,11 @@ prefix_ bool senf::detail::CheckINet6Network_impl5::match(boost::u boost::uint8_t v1) { return v0 == boost::uint8_t(a>>8) && - v1 & ~boost::low_bits_mask_t<8-restbits>::sig_bits + v1 & ~boost::low_bits_mask_t<8-restbits>::sig_bits == boost::uint8_t(a) & ~boost::low_bits_mask_t<8-restbits>::sig_bits; } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) @@ -72,45 +72,45 @@ match(INet6Address const & addr) return CheckINet6Network_impl4::match(addr[0],addr[1]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && CheckINet6Network_impl4::match(addr[2],addr[3]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) && CheckINet6Network_impl4::match(addr[4],addr[5]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) && addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) && CheckINet6Network_impl4::match(addr[6],addr[7]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) && addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) && @@ -118,12 +118,12 @@ match(INet6Address const & addr) CheckINet6Network_impl4::match(addr[8],addr[9]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) && addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) && @@ -132,12 +132,12 @@ match(INet6Address const & addr) CheckINet6Network_impl4::match(addr[10],addr[11]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) && addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) && @@ -147,12 +147,12 @@ match(INet6Address const & addr) CheckINet6Network_impl4::match(addr[12],addr[13]); } -template prefix_ bool senf::detail::CheckINet6Network_impl3:: match(INet6Address const & addr) { - return + return addr[0] == boost::uint8_t(a0>>8) && addr[1] == boost::uint8_t(a0) && addr[2] == boost::uint8_t(a1>>8) && addr[3] == boost::uint8_t(a1) && addr[4] == boost::uint8_t(a2>>8) && addr[5] == boost::uint8_t(a2) && diff --git a/senf/Socket/Protocols/INet/INet6Address.hh b/senf/Socket/Protocols/INet/INet6Address.hh index 65a32be..f5f700a 100644 --- a/senf/Socket/Protocols/INet/INet6Address.hh +++ b/senf/Socket/Protocols/INet/INet6Address.hh @@ -215,7 +215,7 @@ namespace senf { ///< Construct link-local INet6 address /**< This will construct a link local address of the form fe80::xxxx:xxxx:xxxx:xxxx. */ - + in6_addr toin6_addr() const; ///< get the linux in6_addr struct (convinience only) ///@} diff --git a/senf/Socket/Protocols/INet/INet6Address.ih b/senf/Socket/Protocols/INet/INet6Address.ih index b1908b4..2808186 100644 --- a/senf/Socket/Protocols/INet/INet6Address.ih +++ b/senf/Socket/Protocols/INet/INet6Address.ih @@ -70,7 +70,7 @@ namespace detail { struct CheckINet6Network_impl4 : public CheckINet6Network_impl5 {}; - + template struct CheckINet6Network_impl3 @@ -190,7 +190,7 @@ namespace detail { void apply_mask(unsigned bits, ForwardIterator b, ForwardIterator e, Function fn); template - ForwardIterator1 find_if_mask(unsigned bits, + ForwardIterator1 find_if_mask(unsigned bits, ForwardIterator1 b1, ForwardIterator1 e1, ForwardIterator2 b2, Function fn); diff --git a/senf/Socket/Protocols/INet/INet6Address.test.cc b/senf/Socket/Protocols/INet/INet6Address.test.cc index 1283cba..337feb1 100644 --- a/senf/Socket/Protocols/INet/INet6Address.test.cc +++ b/senf/Socket/Protocols/INet/INet6Address.test.cc @@ -186,7 +186,7 @@ SENF_AUTO_UNIT_TEST(inet6Network) BOOST_CHECK( ! net.match(net2) ); BOOST_CHECK( net2.match(INet6Network("2001:db8:1234::/48")) ); BOOST_CHECK( ! net2.match(INet6Network("2001:db8:1234::/32")) ); - + BOOST_CHECK( ! INet6Network("ff14:1234::1/128").match(INet6Network("ff14:1234::2/128")) ); BOOST_CHECK_EQUAL( senf::str(net2), "2001:db8:1230::/44" ); diff --git a/senf/Socket/Protocols/INet/MulticastSocketProtocol.hh b/senf/Socket/Protocols/INet/MulticastSocketProtocol.hh index 9ba6a00..d55b229 100644 --- a/senf/Socket/Protocols/INet/MulticastSocketProtocol.hh +++ b/senf/Socket/Protocols/INet/MulticastSocketProtocol.hh @@ -38,13 +38,13 @@ namespace senf { ///\addtogroup protocol_facets_group ///\{ - + /** \brief Generic addressing type independent multicast protocol facet \todo implement complete new multicast API from RFC3678 (as far as supported by linux) \bug mcLeaveSSMSource fails with EADDRNOTAVAIL */ - class MulticastSocketProtocol + class MulticastSocketProtocol : public virtual SocketProtocol { public: @@ -63,7 +63,7 @@ namespace senf { unsigned mcTTL() const; ///< Return current multicast TTL void mcTTL(unsigned value) const; ///< Set multicast TTL - bool mcLoop() const; ///< Return current multicast loopback state. + bool mcLoop() const; ///< Return current multicast loopback state. void mcLoop(bool value) const; ///< Set multicast loopback state /**< If set to false via \c mcLoop(value) multicast messages will not be looped back to local sockets. Default value @@ -72,7 +72,7 @@ namespace senf { void mcIface(std::string const & iface = std::string()) const; ///< Set multicast send interface of the socket /**< \param[in] iface name of interface to send multicast - data from + data from Under current linux versions this option is broken at best. Don't use. */ @@ -95,7 +95,7 @@ namespace senf { /**< This member will add \a mcAddr to the list of multicast groups received. The group is joined on the interface with the given local address. - \deprecated Use \link mcAddMembership(INet4Address const & mcAddr, std::string const & iface) const mcAddMembership( \a mcAddr , \a iface )\endlink + \deprecated Use \link mcAddMembership(INet4Address const & mcAddr, std::string const & iface) const mcAddMembership( \a mcAddr , \a iface )\endlink for compatibility with the IPv6 API. \param[in] mcAddr address of group to join \param[in] localAddr address of interface to join on */ @@ -113,18 +113,18 @@ namespace senf { multicast groups received. The group is left from the default interface. \param[in] mcAddr address of group to leave */ - void mcDropMembership(INet4Address const & mcAddr, INet4Address const & localAddr) + void mcDropMembership(INet4Address const & mcAddr, INet4Address const & localAddr) const; ///< leave multicast group on a specific interface /**< This member will remove \a mcAddr from the list of multicast groups received. The group is left from the interface with the given local address. - \deprecated Use \link mcDropMembership(INet4Address const & mcAddr, std::string const & iface) const mcDropMembership( \a mcAddr , \a iface )\endlink + \deprecated Use \link mcDropMembership(INet4Address const & mcAddr, std::string const & iface) const mcDropMembership( \a mcAddr , \a iface )\endlink for compatibility with the IPv6 API. \param[in] mcAddr address of group to leave \param[in] localAddr address of interface to leave from */ - void mcDropMembership(INet4Address const & mcAddr, std::string const & iface) + void mcDropMembership(INet4Address const & mcAddr, std::string const & iface) const; ///< leave multicast group on a specific interface /**< This member will remove \a mcAddr from the list of @@ -133,7 +133,7 @@ namespace senf { \param[in] mcAddr address of group to leave \param[in] iface interface name */ - void mcJoinSSMSource(INet4Address const & group, INet4Address const & source, + void mcJoinSSMSource(INet4Address const & group, INet4Address const & source, std::string const & iface) const; ///< join SSM multicast group /**< This call will join the multicast group \a group for @@ -191,7 +191,7 @@ namespace senf { \param[in] mcAddr address of group to leave \param[in] iface interface name */ - void mcJoinSSMSource(INet6Address const & group, INet6Address const & source, + void mcJoinSSMSource(INet6Address const & group, INet6Address const & source, std::string const & iface) const; ///< join SSM multicast group /**< This call will join the multicast group \a group for @@ -202,7 +202,7 @@ namespace senf { group on \param[in] iface interface to join the group on. If set to the empty string, use the default interface. */ - void mcJoinSSMSource(INet6Address const & group, INet6Address const & source, + void mcJoinSSMSource(INet6Address const & group, INet6Address const & source, int ifacei = 0) const; ///< join SSM multicast group /**< This call will join the multicast group \a group for diff --git a/senf/Socket/Protocols/INet/MulticastSocketProtocol.test.cc b/senf/Socket/Protocols/INet/MulticastSocketProtocol.test.cc index 6fc84fd..d27e215 100644 --- a/senf/Socket/Protocols/INet/MulticastSocketProtocol.test.cc +++ b/senf/Socket/Protocols/INet/MulticastSocketProtocol.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/INet/RawINetSocketHandle.hh b/senf/Socket/Protocols/INet/RawINetSocketHandle.hh index 02f71ef..10c23e0 100644 --- a/senf/Socket/Protocols/INet/RawINetSocketHandle.hh +++ b/senf/Socket/Protocols/INet/RawINetSocketHandle.hh @@ -65,8 +65,8 @@ namespace senf { RawV4SocketProtocol provides an internet protocol raw socket based on IPv4 addressing. This socket will put data written to it onto the IPv4 layer: if you call writeto don't inlude the header! - On the other hand `read` will return the packet data including the IP header. - This behaviour is strange and differs from the behaviour of IPv6 RAW sockets and should be changed in the future. + On the other hand `read` will return the packet data including the IP header. + This behaviour is strange and differs from the behaviour of IPv6 RAW sockets and should be changed in the future. This class is utilized as the protocol class of the ProtocolClientSocketHandle via the Socket Handle typedefs above. @@ -97,12 +97,12 @@ namespace senf { ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ void init_client(int const & protocol) const; ///< Create unconnected client socket for protocol - + void init_client(int const & protocol, INet4SocketAddress const & address) const; ///< Create client socket and bind /**< Creates a new client socket for the given protocol and binds to the given address. - \param[in] protocol Layer 4 protocol to filter for / to send + \param[in] protocol Layer 4 protocol to filter for / to send \param[in] address local address to bind to */ ///@} @@ -127,7 +127,7 @@ namespace senf { \par Socket Handle typedefs: \ref RawV6ClientSocketHandle (ProtocolClientSocketHandle) - \par Policy Interface: + \par Policy Interface: ClientSocketHandle::read(), ClientSocketHandle::readfrom(), ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local() @@ -136,8 +136,8 @@ namespace senf { RawV6SocketProtocol provides an internet protocol raw socket based on IPv6 addressing. This socket will put data written to it onto the IPv6 layer: if you call writeto don't inlude the header! - On the other hand `read` will return the packet data on top of the IPv6 layer, excluding the IP header. - Note: This behaviour is differs from the behaviour of IPv4 RAW sockets. + On the other hand `read` will return the packet data on top of the IPv6 layer, excluding the IP header. + Note: This behaviour is differs from the behaviour of IPv4 RAW sockets. This class is utilized as the protocol class of the ProtocolClientSocketHandle via the Socket Handle typedefs above. @@ -174,7 +174,7 @@ namespace senf { ///< Create client socket and bind /**< Creates a new client socket for the given protocol and binds to the given address. - \param[in] protocol Layer 4 protocol to filter for / to send + \param[in] protocol Layer 4 protocol to filter for / to send \param[in] address local address to bind to */ /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() diff --git a/senf/Socket/Protocols/INet/RawINetSocketHandle.test.cc b/senf/Socket/Protocols/INet/RawINetSocketHandle.test.cc index c542811..ccafb81 100644 --- a/senf/Socket/Protocols/INet/RawINetSocketHandle.test.cc +++ b/senf/Socket/Protocols/INet/RawINetSocketHandle.test.cc @@ -90,12 +90,12 @@ namespace { sin.sin_family = AF_INET; sin.sin_port = htons(0); sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - + int sockrec = socket(PF_INET,SOCK_RAW,47); if (sockrec<0) fail("server_v4","socket(rec)"); int socksend = socket(PF_INET,SOCK_RAW,48); if (socksend<0) fail("server_v4","socket(send)"); - + char buffer[1024]; while (1) { int n = read(sockrec,buffer,1024); @@ -115,7 +115,7 @@ namespace { ::memset(&sin,0,sizeof(sin)); sin.sin6_family = AF_INET6; sin.sin6_port = htons(0); - inet_pton(AF_INET6, "::1", &sin.sin6_addr); + inet_pton(AF_INET6, "::1", &sin.sin6_addr); int sockrec6 = socket(PF_INET6,SOCK_RAW,47); if (sockrec6<0) fail("server_v6","socket(rec)"); int socksend6 = socket(PF_INET6,SOCK_RAW,48); @@ -156,7 +156,7 @@ SENF_AUTO_UNIT_TEST(RawV4ClientSocketHandle) SENF_CHECK_NO_THROW( sock.writeto(senf::INet4SocketAddress("127.0.0.1:0"), test) ); senf::RawV4ClientSocketHandle sockrec(48); //IPPROTO_GRE+1 std::string in = sockrec.read(); - BOOST_CHECK_EQUAL(in.substr(20), test); + BOOST_CHECK_EQUAL(in.substr(20), test); SENF_CHECK_NO_THROW( sock.writeto(senf::INet4SocketAddress("127.0.0.1:0"),"QUIT")); //sock.close(); //sockrec.close(); @@ -187,7 +187,7 @@ SENF_AUTO_UNIT_TEST(RawV6ClientSocketHandle) SENF_CHECK_NO_THROW( sock.writeto(senf::INet6SocketAddress("[::1]:0"), test) ); senf::RawV6ClientSocketHandle sockrec(48); //IPPROTO_GRE+1 std::string in = sockrec.read(); - BOOST_CHECK_EQUAL(in, test); + BOOST_CHECK_EQUAL(in, test); SENF_CHECK_NO_THROW( sock.writeto(senf::INet6SocketAddress("[::1]:0"),"QUIT")); alarm(0); } catch (...) { diff --git a/senf/Socket/Protocols/INet/RawINetSocketProtocol.hh b/senf/Socket/Protocols/INet/RawINetSocketProtocol.hh index 3c3c437..467717b 100644 --- a/senf/Socket/Protocols/INet/RawINetSocketProtocol.hh +++ b/senf/Socket/Protocols/INet/RawINetSocketProtocol.hh @@ -31,11 +31,11 @@ namespace senf { /// \addtogroup protocol_facets_group /// @{ - /** \brief Protocol facat to support RAW operations upon IPv4/6 + /** \brief Protocol facat to support RAW operations upon IPv4/6 This protocol facet provides all those protocol functions, which are available on a PF_INET[6]/RAW socket. - + */ class RawINetSocketProtocol : public virtual INetSocketProtocol diff --git a/senf/Socket/Protocols/INet/TCPSocketHandle.hh b/senf/Socket/Protocols/INet/TCPSocketHandle.hh index 39a5d5a..f97db2e 100644 --- a/senf/Socket/Protocols/INet/TCPSocketHandle.hh +++ b/senf/Socket/Protocols/INet/TCPSocketHandle.hh @@ -62,7 +62,7 @@ namespace senf { \par Socket Handle typedefs: \ref TCPv4ClientSocketHandle (ProtocolClientSocketHandle), \ref TCPv4ServerSocketHandle (ProtocolServerSocketHandle) - + \par Policy Interface: ClientSocketHandle::read(), ClientSocketHandle::write(), ClientSocketHandle::bind(), ClientSocketHandle::local(), ClientSocketHandle::connect(), ClientSocketHandle::peer() diff --git a/senf/Socket/Protocols/INet/TCPSocketHandle.test.cc b/senf/Socket/Protocols/INet/TCPSocketHandle.test.cc index 2c4f09f..e19e967 100644 --- a/senf/Socket/Protocols/INet/TCPSocketHandle.test.cc +++ b/senf/Socket/Protocols/INet/TCPSocketHandle.test.cc @@ -114,7 +114,7 @@ SENF_AUTO_UNIT_TEST(tcpv4ClientSocketHandle) { senf::TCPv4ClientSocketHandle sock; - BOOST_CHECK_THROW( sock.connect(senf::INet4SocketAddress(localhost4str(0))), + BOOST_CHECK_THROW( sock.connect(senf::INet4SocketAddress(localhost4str(0))), senf::SystemException ); } @@ -185,7 +185,7 @@ SENF_AUTO_UNIT_TEST(tcpv6ClientSocketHandle) { senf::TCPv6ClientSocketHandle sock; - BOOST_CHECK_THROW( sock.connect(senf::INet6SocketAddress(localhost6str(0))), + BOOST_CHECK_THROW( sock.connect(senf::INet6SocketAddress(localhost6str(0))), senf::SystemException ); } diff --git a/senf/Socket/Protocols/INet/UDPSocketHandle.hh b/senf/Socket/Protocols/INet/UDPSocketHandle.hh index 6673ec9..111d1ea 100644 --- a/senf/Socket/Protocols/INet/UDPSocketHandle.hh +++ b/senf/Socket/Protocols/INet/UDPSocketHandle.hh @@ -121,7 +121,7 @@ namespace senf { \par Socket Handle typedefs: \ref UDPv6ClientSocketHandle (ProtocolClientSocketHandle) - \par Policy Interface: + \par Policy Interface: ClientSocketHandle::read(), ClientSocketHandle::readfrom(), ClientSocketHandle::writeto(), ClientSocketHandle::bind(), ClientSocketHandle::local() diff --git a/senf/Socket/Protocols/INet/net.test.hh b/senf/Socket/Protocols/INet/net.test.hh index 9f94c8f..0f2c34c 100644 --- a/senf/Socket/Protocols/INet/net.test.hh +++ b/senf/Socket/Protocols/INet/net.test.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/Raw/EUI64.cc b/senf/Socket/Protocols/Raw/EUI64.cc index 3c80413..70b4df3 100644 --- a/senf/Socket/Protocols/Raw/EUI64.cc +++ b/senf/Socket/Protocols/Raw/EUI64.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/Raw/EUI64.cci b/senf/Socket/Protocols/Raw/EUI64.cci index 6f51aa1..4615506 100644 --- a/senf/Socket/Protocols/Raw/EUI64.cci +++ b/senf/Socket/Protocols/Raw/EUI64.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/Raw/EUI64.cti b/senf/Socket/Protocols/Raw/EUI64.cti index 8494c7d..3983515 100644 --- a/senf/Socket/Protocols/Raw/EUI64.cti +++ b/senf/Socket/Protocols/Raw/EUI64.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/Raw/EUI64.hh b/senf/Socket/Protocols/Raw/EUI64.hh index 35c47fc..3d8d5ab 100644 --- a/senf/Socket/Protocols/Raw/EUI64.hh +++ b/senf/Socket/Protocols/Raw/EUI64.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -41,7 +41,7 @@ namespace senf { class MACAddress; /** \brief EUI-64 data type - + An EUI-64 is a 64 bit (8 octet) id. The id is represented as an 8 byte sequence in network byte order. An EUI64 can be converted from/to several other representations diff --git a/senf/Socket/Protocols/Raw/EUI64.test.cc b/senf/Socket/Protocols/Raw/EUI64.test.cc index bf7fac6..ae431d1 100644 --- a/senf/Socket/Protocols/Raw/EUI64.test.cc +++ b/senf/Socket/Protocols/Raw/EUI64.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -54,18 +54,18 @@ SENF_AUTO_UNIT_TEST(eui64) BOOST_CHECK_EQUAL( eui, senf::EUI64::from_data(data) ); BOOST_CHECK_EQUAL( eui, senf::EUI64::from_string("10:20:30:ff-FE:40:50:60") ); - BOOST_CHECK_THROW( senf::EUI64::from_string("123:20:30:40:50:60:70:80"), + BOOST_CHECK_THROW( senf::EUI64::from_string("123:20:30:40:50:60:70:80"), senf::AddressSyntaxException ); - BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70"), + BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70"), senf::AddressSyntaxException ); - BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:8g"), + BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:8g"), senf::AddressSyntaxException ); - BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:80:90"), + BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:80:90"), senf::AddressSyntaxException ); - + BOOST_CHECK_EQUAL( senf::EUI64::None, senf::EUI64(0) ); BOOST_CHECK(! senf::EUI64::None ); - + { std::stringstream ss; ss << std::uppercase << eui; @@ -74,7 +74,7 @@ SENF_AUTO_UNIT_TEST(eui64) BOOST_CHECK( !eui ); ss >> eui; BOOST_CHECK_EQUAL( eui, senf::EUI64(0x102030fffe405060ull) ); - + BOOST_CHECK( (ss >> eui).fail() ); } diff --git a/senf/Socket/Protocols/Raw/LLAddressing.cc b/senf/Socket/Protocols/Raw/LLAddressing.cc index 1ee6046..1dac997 100644 --- a/senf/Socket/Protocols/Raw/LLAddressing.cc +++ b/senf/Socket/Protocols/Raw/LLAddressing.cc @@ -54,7 +54,7 @@ prefix_ std::string senf::LLSocketAddress::interface() prefix_ void senf::LLSocketAddress::interface(std::string const & iface) { - if (iface.empty()) + if (iface.empty()) addr_.sll_ifindex = 0; else { addr_.sll_ifindex = if_nametoindex(iface.c_str()); @@ -66,7 +66,7 @@ prefix_ void senf::LLSocketAddress::interface(std::string const & iface) prefix_ std::ostream & senf::operator<<(std::ostream & os, LLSocketAddress const & llAddr) { os << "[" << llAddr.address() - << '%' << llAddr.interface() + << '%' << llAddr.interface() << ' ' << llAddr.protocol() << ' ' << llAddr.arptype() << ( llAddr.pkttype() == senf::LLSocketAddress::Host ? " Host" : diff --git a/senf/Socket/Protocols/Raw/LLAddressing.hh b/senf/Socket/Protocols/Raw/LLAddressing.hh index a3fc336..4ec1740 100644 --- a/senf/Socket/Protocols/Raw/LLAddressing.hh +++ b/senf/Socket/Protocols/Raw/LLAddressing.hh @@ -60,7 +60,7 @@ namespace senf { /** \brief Valid pkttype() values - These are the possible values returned by pkttype() + These are the possible values returned by pkttype() */ enum PktType { Undefined = 0 , Host = PACKET_HOST /**< Packet destined for this host */ @@ -70,7 +70,7 @@ namespace senf { , OtherHost = PACKET_OTHERHOST /**< Packet sent to another host (promisc) */ , Outgoing = PACKET_OUTGOING /**< Packet sent out from this host */ }; - + /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ diff --git a/senf/Socket/Protocols/Raw/LLAddressing.test.cc b/senf/Socket/Protocols/Raw/LLAddressing.test.cc index c01ef6e..ab88cf8 100644 --- a/senf/Socket/Protocols/Raw/LLAddressing.test.cc +++ b/senf/Socket/Protocols/Raw/LLAddressing.test.cc @@ -40,7 +40,7 @@ SENF_AUTO_UNIT_TEST(llAddress) { using senf::LLSocketAddress; - + { LLSocketAddress addr; @@ -83,19 +83,19 @@ SENF_AUTO_UNIT_TEST(llAddress) BOOST_CHECK_EQUAL( addr.pkttype(), LLSocketAddress::Undefined ); BOOST_CHECK( ! addr.address() ); } - + { BOOST_CHECK_THROW( LLSocketAddress addr("SENF_TEST_INVALID_INTERFACENAME"), senf::AddressSyntaxException ); - + LLSocketAddress addr ("lo"); - + BOOST_CHECK_EQUAL( addr.protocol(), 0u ); BOOST_CHECK_EQUAL( addr.interface(), "lo" ); BOOST_CHECK_EQUAL( addr.arptype(), 0u ); BOOST_CHECK_EQUAL( addr.pkttype(), LLSocketAddress::Undefined ); BOOST_CHECK( ! addr.address() ); - + BOOST_CHECK_EQUAL( LLSocketAddress("").interface(), "" ); } } diff --git a/senf/Socket/Protocols/Raw/PacketSocketHandle.cc b/senf/Socket/Protocols/Raw/PacketSocketHandle.cc index f24e0b1..f9728b3 100644 --- a/senf/Socket/Protocols/Raw/PacketSocketHandle.cc +++ b/senf/Socket/Protocols/Raw/PacketSocketHandle.cc @@ -72,7 +72,7 @@ prefix_ bool senf::PacketSocketProtocol::eof() } namespace { - + void do_mc(int fd, std::string const & interface, senf::MACAddress address, bool add) { struct packet_mreq mreq; diff --git a/senf/Socket/Protocols/Raw/PacketSocketHandle.hh b/senf/Socket/Protocols/Raw/PacketSocketHandle.hh index 43b6c67..84476b4 100644 --- a/senf/Socket/Protocols/Raw/PacketSocketHandle.hh +++ b/senf/Socket/Protocols/Raw/PacketSocketHandle.hh @@ -122,7 +122,7 @@ namespace senf { ///< Disable reception of a multicast group /**< \see \ref mcAdd() */ - void promisc(std::string const & interface, bool mode) const; + void promisc(std::string const & interface, bool mode) const; ///< enable/disable promiscuous mode ///@} diff --git a/senf/Socket/Protocols/Raw/PacketSocketHandle.test.cc b/senf/Socket/Protocols/Raw/PacketSocketHandle.test.cc index 1a256c5..9f29b4d 100644 --- a/senf/Socket/Protocols/Raw/PacketSocketHandle.test.cc +++ b/senf/Socket/Protocols/Raw/PacketSocketHandle.test.cc @@ -63,7 +63,7 @@ SENF_AUTO_UNIT_TEST(packetSocketHandle) SENF_CHECK_NO_THROW( sock.protocol().promisc( "eth0", true) ); SENF_CHECK_NO_THROW( sock.protocol().promisc( "eth0", false)); - + SENF_CHECK_NO_THROW( sock.protocol().available() ); BOOST_CHECK( ! sock.eof() ); } diff --git a/senf/Socket/Protocols/Raw/ParseString.ct b/senf/Socket/Protocols/Raw/ParseString.ct index 9def22c..0ca7b4f 100644 --- a/senf/Socket/Protocols/Raw/ParseString.ct +++ b/senf/Socket/Protocols/Raw/ParseString.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/Raw/ParseString.hh b/senf/Socket/Protocols/Raw/ParseString.hh index a59c0f5..25dd76b 100644 --- a/senf/Socket/Protocols/Raw/ParseString.hh +++ b/senf/Socket/Protocols/Raw/ParseString.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/Raw/TunTapSocketHandle.hh b/senf/Socket/Protocols/Raw/TunTapSocketHandle.hh index fe56223..0704b8e 100644 --- a/senf/Socket/Protocols/Raw/TunTapSocketHandle.hh +++ b/senf/Socket/Protocols/Raw/TunTapSocketHandle.hh @@ -85,8 +85,8 @@ namespace senf { /**< Opens the tun/tap socket and create a new tap interface Use \ref ifaceName() to get the actual name of the newly created interface. - - The new interface is down and has to be set up separately. + + The new interface is down and has to be set up separately. After closing the socket, the tap interface and all corresponding routes will be deleted automatically. */ /**< \note This member is implicitly called from the @@ -98,12 +98,12 @@ namespace senf { with the given name. Note that the created interface can have a different name as specified. Use \ref ifaceName() to get the actual name. - - The new interface is down and has to be set up separately. + + The new interface is down and has to be set up separately. After closing the socket, the tap interface and all - corresponding routes will be deleted automatically. + corresponding routes will be deleted automatically. \param[in] interface_name name of the new tap interface. - \param[in] NO_PI if set to \c false each packet has a + \param[in] NO_PI if set to \c false each packet has a additional 4 bytes header (flags, proto) */ /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() @@ -117,7 +117,7 @@ namespace senf { unsigned available() const; bool eof() const; ///< returns always false. unsigned int ifaceIndex() const;///< returns the index of the correspondent tap interface - std::string ifaceName() const; ///< returns the actual name of the correspondent tap interface + std::string ifaceName() const; ///< returns the actual name of the correspondent tap interface private: mutable unsigned int ifaceIndex_; diff --git a/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.cc b/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.cc index 7f74d98..95d39f0 100644 --- a/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.cc +++ b/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.cc @@ -44,7 +44,7 @@ prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client() const fd(sock); } -prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const +prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const { init_client(); clientHandle().connect(address); diff --git a/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.hh b/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.hh index 86bc0e7..957d1b8 100644 --- a/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.hh +++ b/senf/Socket/Protocols/UN/ConnectedUNDatagramSocketHandle.hh @@ -72,7 +72,7 @@ namespace senf { class ConnectedUNDatagramSocketProtocol : public ConcreteSocketProtocol, - public UNSocketProtocol, + public UNSocketProtocol, public BSDSocketProtocol, public AddressableBSDSocketProtocol { @@ -87,7 +87,7 @@ namespace senf { /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ - void init_client(UNSocketAddress const & address) const; + void init_client(UNSocketAddress const & address) const; ///< Create client socket and connect /**< Creates a new client socket and connects to the given address. @@ -95,7 +95,7 @@ namespace senf { /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ - + ///@} }; diff --git a/senf/Socket/Protocols/UN/UNAddressing.cci b/senf/Socket/Protocols/UN/UNAddressing.cci index e66fa88..d0f11e6 100644 --- a/senf/Socket/Protocols/UN/UNAddressing.cci +++ b/senf/Socket/Protocols/UN/UNAddressing.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/Protocols/UN/UNAddressing.hh b/senf/Socket/Protocols/UN/UNAddressing.hh index aeb3c5b..81ba11e 100644 --- a/senf/Socket/Protocols/UN/UNAddressing.hh +++ b/senf/Socket/Protocols/UN/UNAddressing.hh @@ -42,8 +42,8 @@ namespace senf { /** \brief Unix domain socket address UNSocketAddress wraps the standard sockaddr_un datatype. It provides simple accessor methods - to access the path. - + to access the path. + \implementation This implementation is based on sockaddr_un. \ingroup addr_group @@ -53,8 +53,8 @@ namespace senf { { public: static short const addressFamily = AF_UNIX; - - UNSocketAddress(); + + UNSocketAddress(); explicit UNSocketAddress(std::string const & path); ///< Construct an address constant from given path diff --git a/senf/Socket/Protocols/UN/UNAddressing.test.cc b/senf/Socket/Protocols/UN/UNAddressing.test.cc index 6253043..d65c95f 100644 --- a/senf/Socket/Protocols/UN/UNAddressing.test.cc +++ b/senf/Socket/Protocols/UN/UNAddressing.test.cc @@ -41,19 +41,19 @@ SENF_AUTO_UNIT_TEST(UNSocketAddress) { senf::UNSocketAddress addr; BOOST_CHECK( ! addr); - + std::string path ("/tmp/SENF_TEST"); addr.path( path); - + BOOST_CHECK( addr); BOOST_CHECK_EQUAL( addr.path(), path); BOOST_CHECK_EQUAL( addr, senf::UNSocketAddress(path)); BOOST_CHECK_EQUAL( addr, senf::UNSocketAddress(addr)); - + std::stringstream str; str << addr; BOOST_CHECK_EQUAL( str.str(), path ); - + // UNSocketAddress path too long BOOST_CHECK_THROW( senf::UNSocketAddress(std::string(1024, 'x')), senf::AddressSyntaxException ); } diff --git a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.cc b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.cc index f493907..efe73fb 100644 --- a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.cc +++ b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.cc @@ -45,7 +45,7 @@ prefix_ void senf::UNDatagramSocketProtocol::init_client() const fd(sock); } -prefix_ void senf::UNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const +prefix_ void senf::UNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const { init_client(); clientHandle().bind(address); diff --git a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.hh b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.hh index f1c1f49..206cccf 100644 --- a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.hh +++ b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.hh @@ -72,7 +72,7 @@ namespace senf { class UNDatagramSocketProtocol : public ConcreteSocketProtocol, - public UNSocketProtocol, + public UNSocketProtocol, public BSDSocketProtocol, public AddressableBSDSocketProtocol { @@ -87,7 +87,7 @@ namespace senf { /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ - void init_client(UNSocketAddress const & address) const; + void init_client(UNSocketAddress const & address) const; ///< Create client socket and bind /**< Creates a new client socket and bind to the given address. @@ -95,7 +95,7 @@ namespace senf { /**< \note This member is implicitly called from the ProtocolClientSocketHandle::ProtocolClientSocketHandle() constructor */ - + ///@} }; diff --git a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc index 6defe46..5e03b6b 100644 --- a/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc +++ b/senf/Socket/Protocols/UN/UNDatagramSocketHandle.test.cc @@ -54,8 +54,8 @@ SENF_AUTO_UNIT_TEST(unDatagramSocketHandle) BOOST_CHECKPOINT( 5 ); BOOST_CHECK_EQUAL( inputSocket.read(), testString); - - + + BOOST_CHECKPOINT( 6 ); outputSocket.close(); diff --git a/senf/Socket/Protocols/UN/UNSocketProtocol.cc b/senf/Socket/Protocols/UN/UNSocketProtocol.cc index 55ae0c5..88bca92 100644 --- a/senf/Socket/Protocols/UN/UNSocketProtocol.cc +++ b/senf/Socket/Protocols/UN/UNSocketProtocol.cc @@ -53,18 +53,18 @@ prefix_ bool senf::UNSocketProtocol::eof() return false; } -prefix_ void senf::UNSocketProtocol::close() +prefix_ void senf::UNSocketProtocol::close() { check_and_unlink(); - + SocketProtocol::close(); } -prefix_ void senf::UNSocketProtocol::terminate() +prefix_ void senf::UNSocketProtocol::terminate() const { check_and_unlink(); - + SocketProtocol::terminate(); } @@ -80,7 +80,7 @@ prefix_ void senf::UNSocketProtocol::check_and_unlink() SENF_LOG(("UNSocketProtocol::check_and_unlink() failed; [" << e.errorString() << "].")); } } - + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "UNSocketProtocol.mpp" diff --git a/senf/Socket/Protocols/UN/UNSocketProtocol.hh b/senf/Socket/Protocols/UN/UNSocketProtocol.hh index 64e797d..9207cea 100644 --- a/senf/Socket/Protocols/UN/UNSocketProtocol.hh +++ b/senf/Socket/Protocols/UN/UNSocketProtocol.hh @@ -39,7 +39,7 @@ namespace senf { /** \brief Protocol facet providing Unix Domain Addressing related API - This protocol facet introduces all the socket api protocol members which are related to Unix + This protocol facet introduces all the socket api protocol members which are related to Unix Domain addressing. */ class UNSocketProtocol @@ -49,7 +49,7 @@ namespace senf { virtual void close(); ///< Close socket /**< This override will automatically \c shutdown() the socket whenever it is closed. - \throws senf::SystemException */ // + \throws senf::SystemException */ // virtual void terminate() const; ///< Forcibly close socket /**< This override will automatically \c shutdown() the socket whenever it is called. Additionally it will @@ -61,10 +61,10 @@ namespace senf { unsigned available() const; bool eof() const; - + private: - void check_and_unlink() const; - + void check_and_unlink() const; + std::string path_; }; diff --git a/senf/Socket/ReadWritePolicy.hh b/senf/Socket/ReadWritePolicy.hh index 24d5cea..98ec97e 100644 --- a/senf/Socket/ReadWritePolicy.hh +++ b/senf/Socket/ReadWritePolicy.hh @@ -104,7 +104,7 @@ namespace senf { SPolicy,ConnectedCommunicationPolicy>::type * = 0); # else template - static unsigned write(ClientSocketHandle handle, char const * buffer, + static unsigned write(ClientSocketHandle handle, char const * buffer, unsigned size); ///< write data to socket /**< This member is only enabled if the socket uses diff --git a/senf/Socket/SocketHandle.hh b/senf/Socket/SocketHandle.hh index 36cac8c..843f470 100644 --- a/senf/Socket/SocketHandle.hh +++ b/senf/Socket/SocketHandle.hh @@ -142,7 +142,7 @@ namespace senf { \param lod level of %detail requested. The interpretation of this value is protocol specific - + \implementation This member will be re-implemented in every derived class. See the state() documentation. */ diff --git a/senf/Socket/SocketHandle.ih b/senf/Socket/SocketHandle.ih index de34df0..3871c52 100644 --- a/senf/Socket/SocketHandle.ih +++ b/senf/Socket/SocketHandle.ih @@ -63,7 +63,7 @@ namespace senf { ///< Value assigment /**< This operator will assign the string from any arbitrary type. It will use boost::lexical_cast to - convert the argument to its string representation. + convert the argument to its string representation. If the string is non-empty, an additional separating comma is added to the string. */ @@ -157,8 +157,8 @@ namespace senf { }; template - class ProtocolSocketBody - : public SocketBody, + class ProtocolSocketBody + : public SocketBody, private SProtocol, public senf::pool_alloc_mixin< ProtocolSocketBody > { @@ -174,7 +174,7 @@ namespace senf { /**< \param isServer \c true, if this socket is a server socket, false otherwise \param fd socket file descriptor */ - + private: virtual SocketProtocol const & v_protocol() const; virtual std::string v_protocolName() const; diff --git a/senf/Socket/SocketHandle.test.cc b/senf/Socket/SocketHandle.test.cc index 1d97c78..419e453 100644 --- a/senf/Socket/SocketHandle.test.cc +++ b/senf/Socket/SocketHandle.test.cc @@ -106,7 +106,7 @@ SENF_AUTO_UNIT_TEST(socketHandle) SENF_CHECK_NO_THROW( myh.facet() ); } - + // Ensure, the destructor is called and calls the correct close() implementation BOOST_CHECK( senf::test::SomeSocketProtocol::closeCount() >= 1u ); } diff --git a/senf/Socket/SocketPolicy.cc b/senf/Socket/SocketPolicy.cc index 794e6cf..582c4e2 100644 --- a/senf/Socket/SocketPolicy.cc +++ b/senf/Socket/SocketPolicy.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Socket/SocketPolicy.ih b/senf/Socket/SocketPolicy.ih index eee6f0d..c6bd54a 100644 --- a/senf/Socket/SocketPolicy.ih +++ b/senf/Socket/SocketPolicy.ih @@ -91,7 +91,7 @@ namespace senf { template < BOOST_PP_SEQ_FOR_EACH_I( SP_TemplateArgs, , SENF_SOCKET_POLICIES ) > struct SocketPolicy : public SocketPolicyBase, - public senf::pool_alloc_mixin< + public senf::pool_alloc_mixin< SocketPolicy< BOOST_PP_SEQ_FOR_EACH_I( SP_TemplateParms, , SENF_SOCKET_POLICIES ) > > { # define SP_DeclarePolicyMember(x1,x2,SomePolicy) \ @@ -197,30 +197,30 @@ namespace impl { } // namespace impl - template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( SENF_SOCKET_POLICIES_N, - class T, + template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( SENF_SOCKET_POLICIES_N, + class T, mpl::nil ) > class MakeSocketPolicy : public boost::mpl::if_< boost::is_convertible< T0*, SocketPolicyBase* >, - impl::MakeSocketPolicy_impl< - T0, - boost::mpl::vector< - BOOST_PP_ENUM_SHIFTED_PARAMS( + impl::MakeSocketPolicy_impl< + T0, + boost::mpl::vector< + BOOST_PP_ENUM_SHIFTED_PARAMS( SENF_SOCKET_POLICIES_N, T ) > >, - impl::MakeSocketPolicy_impl< + impl::MakeSocketPolicy_impl< SocketPolicy<>, - boost::mpl::vector< - BOOST_PP_ENUM_PARAMS( + boost::mpl::vector< + BOOST_PP_ENUM_PARAMS( SENF_SOCKET_POLICIES_N, T ) > > >::type {}; template struct SocketPolicyIsBaseOf - : public boost::mpl::if_< + : public boost::mpl::if_< boost::mpl::and_< boost::is_convertible< BasePolicy*, SocketPolicyBase* >, boost::is_convertible< DerivedPolicy*, SocketPolicyBase* > >, impl::SocketPolicy_compatibility, - boost::false_type + boost::false_type >::type {}; diff --git a/senf/Socket/SocketPolicy.test.cc b/senf/Socket/SocketPolicy.test.cc index a9bef41..26f7358 100644 --- a/senf/Socket/SocketPolicy.test.cc +++ b/senf/Socket/SocketPolicy.test.cc @@ -127,7 +127,7 @@ SENF_AUTO_UNIT_TEST(socketPolicy) // The following should fail at compile time // p1 = p3; } - + { Policy1 p1; Policy3 p3; diff --git a/senf/Socket/SocketProtocol.hh b/senf/Socket/SocketProtocol.hh index 8538b17..6092ccc 100644 --- a/senf/Socket/SocketProtocol.hh +++ b/senf/Socket/SocketProtocol.hh @@ -103,7 +103,7 @@ namespace senf { \attention SocketProtocol must \e always be inherited using public \e virtual inheritance. */ - class SocketProtocol + class SocketProtocol : boost::noncopyable { public: @@ -138,7 +138,7 @@ namespace senf { in a single (non-blocking) read operation. If the socket does not support reading (viz. NotReadablePolicy is set), this member should always return \c 0. - + Depending on the protocol, it may not be possible to return a good value. In this case, an upper bound may be returned (e.g.: When reading from a socket which @@ -159,16 +159,16 @@ namespace senf { virtual void close(); ///< Close socket /**< This override will automatically \c shutdown() the socket whenever it is closed. - \throws senf::SystemException + \throws senf::SystemException \fixme Move into (at least) BSDSOcketProtocol */ - + virtual void terminate() const; ///< Forcibly close socket /**< This override will automatically \c shutdown() the socket whenever it is called. Additionally it will disable SO_LINGER to ensure, that v_terminate will not block. Like the overriden method, this member will ignore failures and will never throw. It is therefore safe to be - called from a destructor. + called from a destructor. \fixme Move into (at least) BSDSocketProtocol */ virtual void state(SocketStateMap & map, unsigned lod) const; @@ -180,7 +180,7 @@ namespace senf { \a lod value with a default value of 0. The interpretation of the \a lod value is completely implementation defined. - + Every class derived from SocketProtocol should reimplement state(). The reimplemented method should call (all) baseclass-implementations of this @@ -191,21 +191,21 @@ namespace senf { keys are interpreted as hierarchical strings with '.' as a separator (like hostnames or struct or class members). They are automatically sorted correctly. - + The values are std:string with one additional feature: they allow assignment or conversion from *any* type as long as that type is streamable. This simplifies assigning non-string values to the map: - + \code map["socket.protocol.ip.address"] << peer(); map["socket.protocol.tcp.backlog"] << backlog(); \endcode - + This will work even if peer() returns an ip-address object or backlog() returns an integer. The values are automatically converted to their string representation. - + Additionally, if the slot the date is written to is not empty, the \<\< operator will add add a comma as separator. */ @@ -237,7 +237,7 @@ namespace senf { friend class SocketBody; }; - + template class ClientSocketHandle; template class ServerSocketHandle; @@ -256,7 +256,7 @@ namespace senf { protocols themselves, they are combined to build concrete protocols. This structure will remove a lot of code duplication. It is important to ensure, that the protocol facets do not overlap, since otherwise there will be problems resolving overlapping members. - + \doc init_client init_server */ template @@ -283,9 +283,9 @@ namespace senf { /////////////////////////////////////////////////////////////////////////// Policy const & policy() const; - + protected: - ClientSocketHandle clientHandle() const; + ClientSocketHandle clientHandle() const; ///< Get client handle for associated socket /**< Returns a client handle for the socket associated with this protocol instance */ diff --git a/senf/Socket/SocketProtocol.test.cc b/senf/Socket/SocketProtocol.test.cc index f774dca..70f8f99 100644 --- a/senf/Socket/SocketProtocol.test.cc +++ b/senf/Socket/SocketProtocol.test.cc @@ -44,7 +44,7 @@ SENF_AUTO_UNIT_TEST(socketProtocol) // BOOST_CHECK( protocol.body() == 0 ); protocol.policy(); - + BOOST_CHECK( true ); } diff --git a/senf/Utils/Backtrace.cc b/senf/Utils/Backtrace.cc index 3bd09c0..eddd222 100644 --- a/senf/Utils/Backtrace.cc +++ b/senf/Utils/Backtrace.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -28,7 +28,7 @@ // Custom includes #ifdef SENF_DEBUG - #include + #include #endif #include #include @@ -43,7 +43,7 @@ prefix_ void senf::formatBacktrace(std::ostream & os, void ** backtrace, unsigne #ifdef SENF_DEBUG char ** symbols (::backtrace_symbols(backtrace, numEntries)); - static boost::regex const backtraceRx + static boost::regex const backtraceRx ("(.*)\\((.*)\\+(0x[0-9a-f]+)\\) \\[(0x[0-9a-f]+)\\]"); enum { File = 1, Symbol = 2, @@ -61,7 +61,7 @@ prefix_ void senf::formatBacktrace(std::ostream & os, void ** backtrace, unsigne symbol = std::string(demangled); free(demangled); } - os << " " << symbol << " + " << match[Offset] + os << " " << symbol << " + " << match[Offset] << "\n in " << match[File] << " [" << match[Address] << "]\n"; } else if (sym == "[0xffffe410]") diff --git a/senf/Utils/Backtrace.hh b/senf/Utils/Backtrace.hh index f7f8925..adb5565 100644 --- a/senf/Utils/Backtrace.hh +++ b/senf/Utils/Backtrace.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Config.cc b/senf/Utils/Console/Config.cc index 66a7a19..7205521 100644 --- a/senf/Utils/Console/Config.cc +++ b/senf/Utils/Console/Config.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Config.cci b/senf/Utils/Console/Config.cci index 1327b50..1346d41 100644 --- a/senf/Utils/Console/Config.cci +++ b/senf/Utils/Console/Config.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -36,8 +36,8 @@ prefix_ bool senf::console::detail::RestrictedExecutor::complete() const { - return parsedNodes_.size() == 1 - && ! parsedNodes_[0].expired() + return parsedNodes_.size() == 1 + && ! parsedNodes_[0].expired() && *parsedNodes_[0].lock() == executor_.chroot(); } diff --git a/senf/Utils/Console/Config.cti b/senf/Utils/Console/Config.cti index 720f68b..735f1a3 100644 --- a/senf/Utils/Console/Config.cti +++ b/senf/Utils/Console/Config.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Config.hh b/senf/Utils/Console/Config.hh index 7c2b817..50b1e0f 100644 --- a/senf/Utils/Console/Config.hh +++ b/senf/Utils/Console/Config.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -56,7 +56,7 @@ namespace console { This bundle may also be passed to other code which may use restricted parsing to parse partial information from all configuration sources. - + \ingroup console_access */ class ConfigBundle @@ -75,7 +75,7 @@ namespace console { template Source & add(boost::intrusive_ptr source); ///< Add configuration source - + void parse(); ///< Parse config bundle /**< All nodes already parsed are skipped */ void parse(DirectoryNode & restrict); ///< Parse config bundle under \a restrict @@ -134,7 +134,7 @@ namespace detail { protected: template Source & add(boost::intrusive_ptr source); - + private: ConfigBundle bundle_; }; diff --git a/senf/Utils/Console/Config.ih b/senf/Utils/Console/Config.ih index 18c7293..d5cc2aa 100644 --- a/senf/Utils/Console/Config.ih +++ b/senf/Utils/Console/Config.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,7 +40,7 @@ namespace console { namespace detail { /** \brief Internal: Executor wrapper implementing restricted execution - + A RestrictedExecutor will only process commands which a re children of a given node. It does \e not follow any links. */ @@ -61,12 +61,12 @@ namespace detail { void execute(std::ostream & output, ParseCommandInfo const & command); ///< Execute command - /**< Output will be written to \a output. + /**< Output will be written to \a output. Same as operator()(). */ void operator()(std::ostream & output, ParseCommandInfo const & command); ///< Execute command - /**< Output will be written to \a output. + /**< Output will be written to \a output. Same as execute(). */ GenericNode & getNode(ParseCommandInfo const & command); @@ -102,7 +102,7 @@ namespace detail { }; /** \brief Internal: Set restricted node of a RestrictedExecutor - + A RestrictGuard will set the node to which to restrict. It will automatically reset the node in it's destructor. */ diff --git a/senf/Utils/Console/Config.test.cc b/senf/Utils/Console/Config.test.cc index d20483a..b14b19e 100644 --- a/senf/Utils/Console/Config.test.cc +++ b/senf/Utils/Console/Config.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -51,7 +51,7 @@ namespace { public: TempFile(std::string const & name) : name_ (name), file_ (name_.c_str()) {} ~TempFile() { file_.close(); boost::filesystem::remove(name_); } - + template TempFile & operator<<(T const & v) { file_ << v; return *this; } enum Closer { close }; void operator<<(Closer) { file_.close(); } std::string const & name() { return name_; } @@ -60,20 +60,20 @@ namespace { std::string name_; std::ofstream file_; }; - + } SENF_AUTO_UNIT_TEST(configBundle_empty) { TempFile cfg ("test.cfg"); cfg << TempFile::close; - + senf::console::ScopedDirectory<> root; root.add("fun2", senf::console::factory::Command(&fun2)); - + senf::console::ConfigBundle bundle(root); bundle.add( senf::console::FileConfig(cfg.name())); - + SENF_CHECK_NO_THROW( bundle.parse() ); } @@ -104,7 +104,7 @@ SENF_AUTO_UNIT_TEST(configBundle) SENF_CHECK_NO_THROW( bundle.parse() ); BOOST_CHECK_EQUAL( val1, "bar" ); BOOST_CHECK_EQUAL( val2, true ); - + bundle.chroot( chroot); SENF_CHECK_NO_THROW( bundle.parse() ); BOOST_CHECK_EQUAL( val1, "bar" ); diff --git a/senf/Utils/Console/ConfigFile.cc b/senf/Utils/Console/ConfigFile.cc index 0db231a..257c295 100644 --- a/senf/Utils/Console/ConfigFile.cc +++ b/senf/Utils/Console/ConfigFile.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -49,7 +49,7 @@ prefix_ void senf::console::detail::ConfigFileSource::v_parse(RestrictedExecutor throw; } } -#endif +#endif /////////////////////////////////////////////////////////////////////////// diff --git a/senf/Utils/Console/ConfigFile.cci b/senf/Utils/Console/ConfigFile.cci index 6b8bf6a..8872baf 100644 --- a/senf/Utils/Console/ConfigFile.cci +++ b/senf/Utils/Console/ConfigFile.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -50,7 +50,7 @@ senf::console::detail::ConfigFileSource::ignoreMissing() prefix_ senf::console::detail::ConfigFileSource::ConfigFileSource(std::string const & filename) : filename_ (filename), ignoreMissing_ (false) {} -#endif +#endif /////////////////////////////////////////////////////////////////////////// // senf::console::ConfigFile diff --git a/senf/Utils/Console/ConfigFile.hh b/senf/Utils/Console/ConfigFile.hh index c3bea53..82e00fe 100644 --- a/senf/Utils/Console/ConfigFile.hh +++ b/senf/Utils/Console/ConfigFile.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -48,7 +48,7 @@ namespace console { // Parse only statements under the directory of some object. The object 'ob' // must have been registered somewhere in the node tree cf.parse(ob.dir); - + // Parse rest of the config file cf.parse(); \endcode @@ -57,7 +57,7 @@ namespace console { \ingroup console_access */ - class ConfigFile + class ConfigFile : public detail::BundleMixin { public: diff --git a/senf/Utils/Console/ConfigFile.ih b/senf/Utils/Console/ConfigFile.ih index f37ca6e..8710eb7 100644 --- a/senf/Utils/Console/ConfigFile.ih +++ b/senf/Utils/Console/ConfigFile.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/ConfigFile.test.cc b/senf/Utils/Console/ConfigFile.test.cc index 692fad6..aa24e01 100644 --- a/senf/Utils/Console/ConfigFile.test.cc +++ b/senf/Utils/Console/ConfigFile.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -41,7 +41,7 @@ namespace { int var1 (0); bool var2 (false); - + void fun1(int v) { var1 = v; } void fun2() { var2 = true; } @@ -50,7 +50,7 @@ namespace { public: TempFile(std::string const & name) : name_ (name), file_ (name_.c_str()) {} ~TempFile() { file_.close(); boost::filesystem::remove(name_); } - + template TempFile & operator<<(T const & v) { file_ << v; return *this; } enum Closer { close }; void operator<<(Closer) { file_.close(); } std::string const & name() { return name_; } @@ -59,7 +59,7 @@ namespace { std::string name_; std::ofstream file_; }; - + } #define SENF_CHECK_THROW_SYSTEMEXCEPTION( expr, errorNumber, msg) \ @@ -71,16 +71,16 @@ namespace { BOOST_CHECK( ex.anyOf( errorNumber)); \ BOOST_CHECK( ex.message().find(msg) != std::string::npos); \ } \ - + SENF_AUTO_UNIT_TEST(configFile) { namespace fty = senf::console::factory; TempFile cfgf ("test.cfg"); - cfgf << "dir1/fun1 10;\n" + cfgf << "dir1/fun1 10;\n" << TempFile::close; - + senf::console::ScopedDirectory<> dir1; senf::console::root().add("dir1", dir1); dir1.add("fun1",fty::Command(&fun1)); @@ -125,11 +125,11 @@ SENF_AUTO_UNIT_TEST(configFileRestrict) cfgf << "dir1/fun1 10;\n" << "dir2/fun2;\n" << TempFile::close; - + senf::console::ScopedDirectory<> dir1; senf::console::root().add("dir1", dir1); dir1.add("fun1",fty::Command(&fun1)); - + { var1 = 0; var2 = false; @@ -161,14 +161,14 @@ SENF_AUTO_UNIT_TEST(configFileSkipGroup) cfgf << "dir1/fun1 10;\n" << "dir2 { dir3 { fun2; } fun1 5; }" << TempFile::close; - + senf::console::ScopedDirectory<> dir1; senf::console::root().add("dir1", dir1); dir1.add("fun1",fty::Command(&fun1)); - + senf::console::ScopedDirectory<> dir2; senf::console::root().add("dir2", dir2); - + dir2.add("dir3",fty::Directory()).add("fun2", fty::Command(&fun2)); dir2.add("fun1", fty::Command(&fun1)); @@ -204,14 +204,14 @@ SENF_AUTO_UNIT_TEST(configRestrictAndLink) cfgf << "dir1/fun1 10;\n" << "link1 { dir3 { fun2; } fun1 5; }" << TempFile::close; - + senf::console::ScopedDirectory<> dir1; senf::console::root().add("dir1", dir1); dir1.add("fun1",fty::Command(&fun1)); - + senf::console::ScopedDirectory<> dir2; dir1.add("dir2", dir2); - + dir2.add("dir3",fty::Directory()).add("fun2", fty::Command(&fun2)); dir2.add("fun1", fty::Command(&fun1)); diff --git a/senf/Utils/Console/Console.hh b/senf/Utils/Console/Console.hh index 3edb38c..6679f69 100644 --- a/senf/Utils/Console/Console.hh +++ b/senf/Utils/Console/Console.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Example.dox b/senf/Utils/Console/Example.dox index c571c36..76edf09 100644 --- a/senf/Utils/Console/Example.dox +++ b/senf/Utils/Console/Example.dox @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -66,7 +66,7 @@ built-in command at the console. The next callback accesses the client instance directly to manipulate the logging: - + \until } The senf::console::Client instance can be accessed using the senf::console::Client::get() helper @@ -74,12 +74,12 @@ messages to the console instance. We now define \c main() which initializes the node tree and starts the console server - + \until route - + Here we just setup more verbose logging and set \c SIGPIPE signals to be ignored. \c SIGPIPE's are a pain and really should be disabled. - + \until settings This shows, how to set the top-level documentation and create a new subdirectory. @@ -90,24 +90,24 @@ directly. All the add commands return such a node reference of the correct type (this is a lie, but it works like this anyways and it's an implementation detail that must not concern you here). - + Instead of creating a new directory directly and later sotring a reference, it is better to use \c senf::console::ScopedDirectory<> like this: \until functions - + This will automatically remove the node from the tree when the \c senf::console::ScopedDirectory instance is destroyed. It also protects against the problem of dangling references: When using a plain reference, removing the directory from the tree will destroy the node. The reference however will still reference the (now nonexistent) directory and any access via the reference - will crash the program. + will crash the program. The next statements add commands to the various directories declared so far - + \until Example We now continue by creating an instance of our test class \c TestObject - + \until Example We add that objects directory to the \c test dir. We now have created a directory structure like diff --git a/senf/Utils/Console/Executor.cc b/senf/Utils/Console/Executor.cc index e9649c4..b9a2546 100644 --- a/senf/Utils/Console/Executor.cc +++ b/senf/Utils/Console/Executor.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -49,7 +49,7 @@ namespace { return token.value(); } }; - + } /////////////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, try { switch(command.builtin()) { - case ParseCommandInfo::NoBuiltin : + case ParseCommandInfo::NoBuiltin : if (skipping()) return; exec(output, command); @@ -105,7 +105,7 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, "'cd' cannot be skipped (don't use 'cd' in conf-files)"); } break; - + case ParseCommandInfo::BuiltinLS : if (skipping()) break; @@ -134,12 +134,12 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, else exec(output, command); break; - + case ParseCommandInfo::BuiltinPOPD : // The parser ensures, we have no arguments popd(); break; - + case ParseCommandInfo::BuiltinEXIT : if (skipping()) break; @@ -287,7 +287,7 @@ namespace { typedef std::map NodesMap; - void dolr(std::ostream & output, unsigned width, NodesMap & nodes, std::string const & base, + void dolr(std::ostream & output, unsigned width, NodesMap & nodes, std::string const & base, unsigned level, senf::console::DirectoryNode & node) { boost::format fmt ("%s%s%s %|" BOOST_PP_STRINGIZE(HELP_COLUMN) "t|%s\n"); @@ -301,7 +301,7 @@ namespace { NodesMap::iterator j (nodes.find(&subnode)); if (j == nodes.end()) { output << fmt - % pad % i->first + % pad % i->first % ( i->second->isDirectory() ? "/" : i->second->isLink() ? "@" : "" ) % i->second->shorthelp().substr(0,width); std::string subbase (base); @@ -311,12 +311,12 @@ namespace { nodes.insert(std::make_pair(&subnode, subbase)); dolr(output, width, nodes, subbase, level+1, subnode); } else - output << pad << i->first + output << pad << i->first << ( i->second->isDirectory() ? "/" : i->second->isLink() ? "@" : "" ) << " -> " << j->second << "\n"; } else { output << fmt - % pad % i->first + % pad % i->first % ( i->second->isDirectory() ? "/" : i->second->isLink() ? "@" : "" ) % i->second->shorthelp().substr(0,width); } @@ -332,7 +332,7 @@ prefix_ void senf::console::Executor::lr(std::ostream & output, traverseDirectory(path, dir); DirectoryNode & node (*dir.back().lock()); NodesMap nodes; - dolr(output, senf::console::Client::getWidth(output, 80u, 60u)-(HELP_COLUMN+1), + dolr(output, senf::console::Client::getWidth(output, 80u, 60u)-(HELP_COLUMN+1), nodes, "", 0, node); } diff --git a/senf/Utils/Console/Executor.cci b/senf/Utils/Console/Executor.cci index e647702..897d72a 100644 --- a/senf/Utils/Console/Executor.cci +++ b/senf/Utils/Console/Executor.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Executor.hh b/senf/Utils/Console/Executor.hh index 41016ec..e5d7136 100644 --- a/senf/Utils/Console/Executor.hh +++ b/senf/Utils/Console/Executor.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -64,7 +64,7 @@ namespace console { // Types /// Thrown by built-in 'exit' command - struct ExitException {}; + struct ExitException {}; /// Executor policy function typedef boost::function SecurityPolicy; @@ -77,7 +77,7 @@ namespace console { /////////////////////////////////////////////////////////////////////////// //\/name Structors and default members ///\{ - + Executor(); ///\} @@ -85,12 +85,12 @@ namespace console { void execute(std::ostream & output, ParseCommandInfo const & command); ///< Execute command - /**< Output will be written to \a output. + /**< Output will be written to \a output. Same as operator()(). */ void operator()(std::ostream & output, ParseCommandInfo const & command); ///< Execute command - /**< Output will be written to \a output. + /**< Output will be written to \a output. Same as execute(). */ GenericNode & getNode(ParseCommandInfo const & command); DirectoryNode & cwd() const; ///< Current working directory @@ -119,7 +119,7 @@ namespace console { DirectoryNode & chroot() const; ///< Get root node /**< The root node defaults to senf::console::root(). If changed, all path references are relative to this node - and objects outside that tree cannot be accessed. */ + and objects outside that tree cannot be accessed. */ Executor & chroot(DirectoryNode & node); ///< chroot into given directory /**< After this call, all path's are interpreted relative to @@ -156,7 +156,7 @@ namespace console { std::string path; InvalidPathException() : path() {} InvalidPathException(std::string path_) : path(path_) {} - + }; struct InvalidDirectoryException { std::string path; @@ -164,7 +164,7 @@ namespace console { InvalidDirectoryException(std::string path_) : path(path_) {} }; struct InvalidCommandException {}; - + DirectoryNode::ptr root_; SecurityPolicy policy_; mutable Path cwd_; diff --git a/senf/Utils/Console/Executor.test.cc b/senf/Utils/Console/Executor.test.cc index 85c419c..24bd307 100644 --- a/senf/Utils/Console/Executor.test.cc +++ b/senf/Utils/Console/Executor.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -58,7 +58,7 @@ SENF_AUTO_UNIT_TEST(executor) senf::console::CommandParser parser; BOOST_CHECK( &executor.cwd() == &senf::console::root() ); - + { std::stringstream os; parser.parse("cd dir1", &setCommand); @@ -101,7 +101,7 @@ SENF_AUTO_UNIT_TEST(executor) parser.parse("ll", &setCommand); executor(os, commands.back()); BOOST_CHECK_EQUAL( commands.back().builtin(), senf::console::ParseCommandInfo::BuiltinLL ); - BOOST_CHECK_EQUAL( os.str(), + BOOST_CHECK_EQUAL( os.str(), "dir1/ \n" "dir2/ Helptext\n" "sys/ \n" ); @@ -122,7 +122,7 @@ SENF_AUTO_UNIT_TEST(executor) BOOST_CHECK_EQUAL( commands.back().builtin(), senf::console::ParseCommandInfo::BuiltinLS ); BOOST_CHECK_EQUAL( os.str(), "" ); } - + { std::stringstream os; parser.parse("lr", &setCommand); @@ -211,7 +211,7 @@ SENF_AUTO_UNIT_TEST(executorChroot) } namespace { - + void testPolicy(senf::console::DirectoryNode & dir, std::string const & entry) { if (dir == senf::console::root() && entry == "dir2") @@ -290,14 +290,14 @@ SENF_AUTO_UNIT_TEST(executorAuto) BOOST_CHECK_EQUAL( executor.cwdPath(), "/dir2" ); BOOST_CHECK_EQUAL( os.str(), "" ); } - + { std::stringstream os; parser.parse("t", &setCommand); executor(os, commands.back()); BOOST_CHECK_EQUAL( os.str(), "testCommand\n" ); } - + commands.clear(); senf::console::root().remove("tdir1"); senf::console::root().remove("dir2"); diff --git a/senf/Utils/Console/LazyDirectory.cc b/senf/Utils/Console/LazyDirectory.cc index 39e54e2..b342668 100644 --- a/senf/Utils/Console/LazyDirectory.cc +++ b/senf/Utils/Console/LazyDirectory.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/LazyDirectory.hh b/senf/Utils/Console/LazyDirectory.hh index 38f0f0d..f7be1f1 100644 --- a/senf/Utils/Console/LazyDirectory.hh +++ b/senf/Utils/Console/LazyDirectory.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/LineEditor.cc b/senf/Utils/Console/LineEditor.cc index 07cee7f..db2313c 100644 --- a/senf/Utils/Console/LineEditor.cc +++ b/senf/Utils/Console/LineEditor.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -86,7 +86,7 @@ LineEditorClientReader(Client & client, LineEditorSwitcher & switcher) senf::membind(&LineEditorClientReader::deleteCharOrExit, this)); editor_.defineKey(senf::term::KeyParser::Tab, boost::bind(&term::bindings::complete, - _1, + _1, senf::membind(&LineEditorClientReader::completePath, this))); editor_.defineKey(senf::term::KeyParser::Return, &senf::term::bindings::acceptWithRepeat); } @@ -148,7 +148,7 @@ completePath(term::LineEditor & editor, unsigned & b, unsigned & e, std::string std::string const & t (editor.text()); // Search backward from e finding the longest valid path. This does *not* accept all valid // path's, only those without embedded white-space. However, this is only for completion so - // it's ok. + // it's ok. if (bfirst + (i->second->followLink().isDirectory() ? "/" : " ")); return; } - + ParseCommandInfo::TokensRange::const_iterator i (path.begin()); ParseCommandInfo::TokensRange::const_iterator const i_end (boost::prior(path.end())); DirectoryNode * dir (& client().cwd()); @@ -195,7 +195,7 @@ completePath(term::LineEditor & editor, unsigned & b, unsigned & e, std::string if (parent) dir = parent; prefix += "../"; } - else if (*i == WordToken(".")) + else if (*i == WordToken(".")) prefix += "./"; else { if (dir->hasChild(i->value())) { @@ -206,7 +206,7 @@ completePath(term::LineEditor & editor, unsigned & b, unsigned & e, std::string return; } prefix += i->value() + "/"; - } + } else { DirectoryNode::ChildrenRange cs (dir->completions(i->value())); if (has_one_elt(cs)) { diff --git a/senf/Utils/Console/LineEditor.hh b/senf/Utils/Console/LineEditor.hh index cbe33f3..93991e8 100644 --- a/senf/Utils/Console/LineEditor.hh +++ b/senf/Utils/Console/LineEditor.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,11 +40,11 @@ namespace console { namespace detail { /** \brief Internal: Client reader switching between LineEditorClientReader or DumbClientReader - + This ClientReader implementation will try to initialize a LineEditorClientReader. If the setup fails, a DumbClientReader is initialized instead. LineEditor support may fail to be initialized if - + \li The telnet client does not support necessary functionality \li or the terminal type of the client is missing some functionality. */ @@ -67,14 +67,14 @@ namespace detail { /** \brief Internal: ClientReader using senf::term::LineEditor for interactive input - This ClientReader implementation uses a senf::term::LineEditor for interactive input. + This ClientReader implementation uses a senf::term::LineEditor for interactive input. */ class LineEditorClientReader : public ClientReader, public term::TelnetTerminal { public: explicit LineEditorClientReader(Client & client, LineEditorSwitcher & switcher); - + private: // TelnetTerminal API implementation virtual void v_setupFailed(); @@ -89,7 +89,7 @@ namespace detail { // Editor callbacks void executeLine(std::string const & text); void deleteCharOrExit(term::LineEditor & editor); - void completePath(term::LineEditor & editor, unsigned & b, unsigned & e, + void completePath(term::LineEditor & editor, unsigned & b, unsigned & e, std::string & prefix, std::vector & completions); term::LineEditor editor_; diff --git a/senf/Utils/Console/Mainpage.dox b/senf/Utils/Console/Mainpage.dox index 1811aa2..4177e2f 100644 --- a/senf/Utils/Console/Mainpage.dox +++ b/senf/Utils/Console/Mainpage.dox @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -42,7 +42,7 @@ nodes. \li There exist several interfaces to \link console_access access\endlink entries in the node tree: interactive console, reading configuration files etc. - + The node tree works like a directory structure. Commands are entered into this directory structure and can be called passing arbitrary arguments. Configuration parameters are just commands which set their respective parameter, however the library allows commands to do much @@ -98,7 +98,7 @@
the console can be accessed easily via telnet: - +
     $ telnet localhost 23232
     Trying 127.0.0.1...
@@ -134,7 +134,7 @@
     and auxiliary commands. Parameters are just commands which set a parameter value so everything
     is either a directory entry (senf::console::DirectoryNode) or a command
     (senf::console::CommandNode).
-    
+
 
     \section intro_commands Implementing console/config commands
     \seechapter \ref console_commands
@@ -195,7 +195,7 @@
 
     To get more flexible, instantiate a senf::console::ConfigFile instance at use that to parse the
     file
-    
+
     \code
     senf::console::ConfigFile cf ("some.conf");
     // The following line is optional: Call to ignore mussing files
@@ -220,7 +220,7 @@
     commands.
     \code
     /server/port 1234;
-    
+
     /logger/targets/console {
         accept senf::log::Debug IMPORTANT;
         accept server::ServerLog CRITICAL;
@@ -257,7 +257,7 @@
     \endcode
 
     This registeres two short options and accumulates all non-option arguments in \c args.
-    
+
     If the application supports other configuration sources besides the command line options (like
     configuration files) see \ref console_access_multiple and add a senf::console::OptionsConfig()
     source to a senf::console::ConfigBundle.
@@ -279,7 +279,7 @@
     Everything after the first '=' character is parsed into argument tokens using the normal
     config/console parser. If the option has no '=' character, the list of argument tokens will be
     empty.
-    
+
     
 
@@ -294,7 +294,7 @@
       
-    
+
     
@@ -328,12 +328,12 @@
     
 
     which is the same as
-    
+
     
     $ program --mycommand="2 3" --mycommand="4 5"
     
- (Beware, that the second argument to \c alias() is \e not shell quoted). + (Beware, that the second argument to \c alias() is \e not shell quoted). \subsection console_access_root Changing the root node @@ -341,11 +341,11 @@ When used in it's default state, parsing will always interpret all commands relative to the senf::console::root() node and will parse a file completely. - The first possibility to control this is to change the root node. This is done by + The first possibility to control this is to change the root node. This is done by \li passing that root node to the helper class or to the parse helper as an additional argument (see the respective documentation). \li passing it to the senf::console::ConfigBundle constructor when parsing multiple sources. - + for example: \code @@ -369,7 +369,7 @@ // Open configuration file senf::console::ConfigFile cf ("/etc/myserver.conf"); - + // Parse only commands in the configuration file which are in the foo.dir directory cf.parse(foo.dir); @@ -410,7 +410,7 @@ senf::console::ConfigBundle conf (senf::console::root()["config"]); conf.add( senf::console::FileConfig("/etc/myserver.conf") ); conf.add( senf::console::FileConfig(".myserver.conf")->ignoreMissing() ); - conf.add( senf::console::OptionsConfig(senf::Daemon::instance().argc(), + conf.add( senf::console::OptionsConfig(senf::Daemon::instance().argc(), senf::Daemon::instance().argv()) ) .nonOptions(args) .alias('c', "--mycommand",true) @@ -418,11 +418,11 @@ // Parse the logger subsystem commands in '/logger' conf.parse(senf::console::root()['logger']); - + ... // Parse all other configuration commands. All necessary commands and links in '/config' must by - // now have been created. + // now have been created. conf.parse(); \endcode @@ -449,7 +449,7 @@ // You need to enter the scheduler main-loop for the server to work senf::scheduler::process(); - + // Alternatively enter the main-loop via the PPI // senf::ppi::run(); } @@ -485,7 +485,7 @@ int main(int, char**) { senf::console::Server & server ( senf::console::start( ... ) ); - + // Do something ... server.stop() @@ -497,13 +497,13 @@ void someCallback(std::ostream & os, ... ) { senf::console::Client & client (senf::console::Client::get(os)); - + // Use the client's log target client.route(); } \endcode - \see + \see senf::console::Server for the Server API \n senf::console::Client / List of all members for the Client API @@ -530,7 +530,7 @@ non-interactive mode. In this mode, no prompt is displayed. In this mode, commands are \e not terminated automatically by end-of-line (CR). This allows, to easily cat an arbitrary configuration file into the network console using netcat: - +
     $ nc -q1 localhost 23232 < some.conf
     
@@ -548,13 +548,13 @@ Commands are executed as soon as the terminating character (';', '{' or '}') is received or when - the sending end of the connection is closed. + the sending end of the connection is closed. \section console_udp Non-interactive UDP console The UDP console allows to script the console tree via UDP packets. Every UDP packet must be a complete command (or sequence of commands). The combined reply of all these commands will be - returned in a single UDP packet. This reply can be disabled or directed to a different address. + returned in a single UDP packet. This reply can be disabled or directed to a different address. To start a UDP server, just create an instance of the senf::console::UDPServer class \code @@ -644,7 +644,7 @@ os << value << std::endl; } \endcode - + Registering this callback is done by simply adding it. To provide online help, pass it to 'doc()': \code @@ -678,11 +678,11 @@ href="http://www.boost.org/doc/libs/1_33_1/libs/range/doc/utility_class.html#iter_range"> boost::iterator_range instances. These behave much like containers: They have \c begin() and \c end() and some other useful members. - + The parser will have divided the argument tokens into arguments already. This simplifies further parsing. If however you want to access the list of argument tokens as a single list, you can do so using senf::console::ParseCommandInfo::tokens(). - + Parsing arguments is quite simple but can get very tedious. To simplify this task, the parsing can be delegated to the Console/config library. See the next section. @@ -690,8 +690,8 @@ \section console_autoparse Automatic argument parsing - - To greatly simplify parsing complex commands, we turn to automatic argument parsing. + + To greatly simplify parsing complex commands, we turn to automatic argument parsing. \subsection console_autoadd Adding @@ -801,17 +801,17 @@ .add("over", SENF_FNP(void, over, (int))); senf::console::root() .add("over", SENF_FNP(void, over, (int,int)); - + class SomeModule { senf::console::ScopedDirectory dir; - + unsigned int overlodedMethod() const {....}; void overlodedMethod(unsigned int) {....}; - + void addConsoleCommands() { - dir.node().add("overlodedMethod", + dir.node().add("overlodedMethod", SENF_MEMBINDFNP(unsigned int, SomeModule, overlodedMethod, () const)); - dir.node().add("overlodedMethod", + dir.node().add("overlodedMethod", SENF_MEMBINDFNP(unsigned int, SomeModule, overlodedMethod, (unsigned int)); } } @@ -821,7 +821,7 @@ \subsection console_attributes Attributes As have seen so far, some documentation is automatically provided. We can add more info, by - setting additional attributes. + setting additional attributes. \code senf::console::root() .add("test5", &fun3) @@ -844,7 +844,7 @@ Variant 1: Repeat {arg12} for {arg11} lines - + Variant 2: Echo the {arg21} argument senf:/$ @@ -897,7 +897,7 @@ Variant 1: Repeat {text} for {n} lines - + Variant 2: Echo the {text} argument senf:/$ @@ -921,13 +921,13 @@ .overloadDoc("Echo the argument") .arg("text"); \endcode - + Keyword arguments should always be used if additional attributes are set. You can however mix positional and keyword arguments. - + \subsection console_defaults Default values - + Another information which can not be automatically gathered from the type system is default values. These have to be declared explicitly: \code @@ -944,7 +944,7 @@ flexible, it is not mandatory, for default values to be specified only for the trailing arguments. For the exact definition, how parsed argument values are assigned to overload arguments in the presence of default values, see \ref senf::console::kw::default_value. - + \htmlonly
     server:/$ test7 echo
@@ -957,7 +957,7 @@
     server:/$ help test7
     Usage:
         test4 [n:unsigned] text:string
-    
+
     With:
         n         Number of repetitions
             default: 1
@@ -977,14 +977,14 @@
 
     \code
     senf::console::root()
-        .add("test8", 
+        .add("test8",
              boost::function(
                  boost::bind(&fun3, _1, 4u, _2)));
     \endcode
 
     This works with any callable object where argument types cannot be deduced automatically:
     Boost.Bind expressions, Boost.Lambda expressions, functors and so on.
-    
+
     \htmlonly
     
     server:/$ test8 ok
@@ -1008,7 +1008,7 @@
 
     
- + @@ -1018,7 +1018,7 @@
CommandFile syntaxOption syntax
/path/to/doo john.doe@everywhere.org; --path-to-doo="john.doe@everywhere.org"
void doo(std::string const &) /path/to/doo "some test";
\link senf::console::ParsedArgumentAttributorBase::doc() .doc\endlink ( \e doc )Set documentation for all overloads
\link senf::console::ParsedArgumentAttributorBase::overloadDoc() .overloadDoc\endlink ( \e doc )Set documentation for a specific overload
The most important argument attributes (all defined in the senf::console::kw namespace) are: - + - + - +
\link senf::console::kw::name kw::name\endlinkParameter @@ -1037,9 +1037,9 @@ / List of all members for the complete attribute interface \n \ref senf::console::kw for a list of all argument attribute keywords - + \section console_memberfn Member functions - + Non-static member functions are supported like non-member functions (static member functions are identical to non-members). They must however be added through a senf::console::ScopedDirectory instance to bind them to their instance. @@ -1049,14 +1049,14 @@ public: senf::console::ScopedDirectory dir; - Test1(std::string label) : dir(this), label_ (label) + Test1(std::string label) : dir(this), label_ (label) { dir.add("test", &Test::test1); dir.add("test", &Test::test2); } - + std::string test1(std::string const & text) { return label_ + ": " + text; } - void test2(std::ostream & os, unsigned n, std::string const & text) + void test2(std::ostream & os, unsigned n, std::string const & text) { while (n-- > 0) os << label << ": " << text << std::endl; } private: @@ -1074,12 +1074,12 @@ \section console_variables Variables - + \subsection console_varadd Adding The console/config library supports the direct registration of variables as commands. A variable command consists of two overloads, one to query the current value and one to change the - value. + value. \code class Test2 { @@ -1116,7 +1116,7 @@ \subsection console_varro Read-only variables - + The library also supports read-only variables. To make a variable read-only, just wrap it in \c boost::cref() (where \c cref stands for \c const reference) \code @@ -1132,7 +1132,7 @@ server:/$ help var1 Usage: var1 - server:/$ + server:/$ \endhtmlonly @@ -1145,10 +1145,10 @@
\link senf::console::VariableAttributor::doc() .doc\endlink ( \e doc )Set variable documentation
\link senf::console::VariableAttributor::onChange() .onChange\endlink ( \e handler )Set change handler
\see senf::console::VariableAttributor for the complete attribute interface @@ -1172,13 +1172,13 @@ senf::console::root().add("var2",var) .onChange(&varChanged); \endcode - + After this setup, \c varChanged will be called, whenever the value has changed. \section console_args Console library supported types - By default, types which can be read and written using \c iostreams are automatically supported. + By default, types which can be read and written using \c iostreams are automatically supported. This includes all the C++ built-in types as well as user defined streamable types. An exception is made for all \c char types: These types are by default parsed as \e numeric @@ -1212,14 +1212,14 @@
     ()
     
- + Collection's with only one element may skip the parenthesis if and only if the element type does not need additional parenthesis A \c vector, \c list or \c set of integer with one element may be written with or without parenthesis:
-    (1) 
+    (1)
     1
     
@@ -1233,14 +1233,14 @@
     (foo=1 bar=2 "foo bar"=3)
     
- + \subsection console_args_bool Boolean arguments and return values The console library by default formats boolean values using the strings \c true and \c false for their representation. When parsing a boolean value, most sensible representations will be accepted: - + @@ -1255,7 +1255,7 @@ The last column lists explicit formatters which can be set to customize the return value formatting of a registered overload accordingly. - + \subsection console_args_enum Registering enum types Enum types are a special case, since it is not possible, to find a string representation for the @@ -1294,7 +1294,7 @@ { public: enum Color { Red, Green, Blue }; - + senf::console::ScopedDirectory dir; Test3(); @@ -1305,7 +1305,7 @@ Test3::Test3() : dir(this) { dir.add("test", &Test3::mem3); } - + Test3 test3ob; senf::console::root().add("test3ob", test3ob.dir); \endcode @@ -1334,17 +1334,17 @@ { return value; } - + senf::console::root() .add("test8", boost::function(&fun4)); \endcode - + Here, the type signature specified via \c boost::function is different from the real type signature but is compatible. \c boost::function automatically handles the conversion process. Since the console library now sees the argument and return value of type \c bool, the values will be parsed and formatted as boolean values. - + \subsection console_args_special Special Console types The %console library defines some special types to be used as arguments and/or return values. @@ -1380,7 +1380,7 @@ { os << '(' << value.x << ' ' << value.y << ')'; } - \endcode + \endcode The parser will accept an argument with two tokens which are each forwarded to the integer parser. The senf::console::CheckedArgumentIteratorWrapper ensures two things: That all input @@ -1391,7 +1391,7 @@ \code Coordinate fun5(Coordinate const & p) { return Coordinate(2*p.x, 2*p.y) } - + namespace kw = senf::console::kw; senf::console::root() @@ -1414,7 +1414,7 @@ server:/$ \endhtmlonly - + If you want to customize the formatting of default values differently from the formating of return-values or if you want to change the displayed name of a type, you will need to specialize the senf::console::ArgumentTraits class instead of implementing diff --git a/senf/Utils/Console/Node.cc b/senf/Utils/Console/Node.cc index 6c4b806..46f96d3 100644 --- a/senf/Utils/Console/Node.cc +++ b/senf/Utils/Console/Node.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -51,7 +51,7 @@ namespace { output << "/\n"; dodump(output, level+1,static_cast(*i->second)); } - else if (i->second->isLink()) + else if (i->second->isLink()) output << "@ -> " << i->second->followLink().path() << '\n'; else output << '\n'; @@ -144,7 +144,7 @@ prefix_ senf::console::GenericNode::ptr senf::console::DirectoryNode::remove(std::string const & name) { ChildMap::iterator i (children_.find(name)); - if (i == children_.end()) + if (i == children_.end()) throw UnknownNodeNameException() << ": '" << name << "'"; GenericNode::ptr node (i->second); children_.erase(i); @@ -167,7 +167,7 @@ prefix_ void senf::console::DirectoryNode::add(GenericNode::ptr node) ++suffix; newName = node->name() + "-" + boost::lexical_cast(suffix); } while (children_.find(newName) != children_.end()); - SENF_LOG((senf::log::MESSAGE)("Uniquifying node '" << node->name() << "' to '" + SENF_LOG((senf::log::MESSAGE)("Uniquifying node '" << node->name() << "' to '" << newName << "'")); node->name(newName); } diff --git a/senf/Utils/Console/Node.cci b/senf/Utils/Console/Node.cci index c763271..21482ff 100644 --- a/senf/Utils/Console/Node.cci +++ b/senf/Utils/Console/Node.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Node.cti b/senf/Utils/Console/Node.cti index 260c9a3..a15d63e 100644 --- a/senf/Utils/Console/Node.cti +++ b/senf/Utils/Console/Node.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/Node.hh b/senf/Utils/Console/Node.hh index 66ba18f..5765dd6 100644 --- a/senf/Utils/Console/Node.hh +++ b/senf/Utils/Console/Node.hh @@ -230,7 +230,7 @@ namespace console { Recursively dumps the console directory structure starting at \a dir. By default, dumps the complete tree beginning at the root node. - + In contrast to the console 'lr' command, links are dumped by showing the \e absolute path to the target node. */ @@ -574,7 +574,7 @@ namespace console { \param[in] command command arguments. This is a range of ranges of Token instances. */ - void execute(boost::any & rv, std::ostream & output, ParseCommandInfo const & command) + void execute(boost::any & rv, std::ostream & output, ParseCommandInfo const & command) const; ///< Execute the command /**< \param[out] rv command return value @@ -677,7 +677,7 @@ namespace console { #ifndef DOXYGEN namespace factory { - + class SimpleCommand : public detail::NodeFactory { diff --git a/senf/Utils/Console/Node.ih b/senf/Utils/Console/Node.ih index 421d744..dfbfa15 100644 --- a/senf/Utils/Console/Node.ih +++ b/senf/Utils/Console/Node.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,11 +40,11 @@ namespace detail { { public: NodeTraverser(DirectoryNode & root, DirectoryNode & dir, bool autocomplete); - + void operator()(std::string const & name); - + GenericNode & node(); - + private: DirectoryNode & root_; DirectoryNode::ptr dir_; diff --git a/senf/Utils/Console/Node.test.cc b/senf/Utils/Console/Node.test.cc index ef2041f..f363049 100644 --- a/senf/Utils/Console/Node.test.cc +++ b/senf/Utils/Console/Node.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -54,7 +54,7 @@ SENF_AUTO_UNIT_TEST(genericNode) std::stringstream ss; node.help(ss); BOOST_CHECK_EQUAL( ss.str(), "help info\n" ); - + { senf::console::GenericNode::ptr p (senf::console::root()["dir1"].unlink()); BOOST_CHECK( ! node.active() ); @@ -93,26 +93,26 @@ SENF_AUTO_UNIT_TEST(directoryNode) BOOST_CHECK_THROW( senf::console::root()("fn2"), senf::console::UnknownNodeNameException ); BOOST_CHECK_THROW( senf::console::root()["fn"], std::bad_cast ); BOOST_CHECK( &senf::console::root().get("dir1") == p.get() ); - + senf::console::root() .add("dir2", fty::Directory()) .add("dir3", fty::Directory()); char const * const children[] = { "dir1", "dir2", "fn", "sys" }; - BOOST_CHECK_EQUAL_COLLECTIONS( - boost::make_transform_iterator(senf::console::root().children().begin(), + BOOST_CHECK_EQUAL_COLLECTIONS( + boost::make_transform_iterator(senf::console::root().children().begin(), select1st()), boost::make_transform_iterator(senf::console::root().children().end(), select1st()), - children, + children, children+sizeof(children)/sizeof(children[0]) ); char const * const completions[] = { "dir1", "dir2" }; BOOST_CHECK_EQUAL_COLLECTIONS( - boost::make_transform_iterator(senf::console::root().completions("dir").begin(), + boost::make_transform_iterator(senf::console::root().completions("dir").begin(), select1st()), boost::make_transform_iterator(senf::console::root().completions("dir").end(), select1st()), - completions, + completions, completions+sizeof(completions)/sizeof(completions[0]) ); p->doc("test doc\nline 2"); @@ -171,7 +171,7 @@ SENF_AUTO_UNIT_TEST(factory) senf::console::root().add("fn1", fty::SimpleCommand(&callback)); senf::console::root().add("fn2", fty::SimpleCommand(Functor())); - + senf::console::ParseCommandInfo info; { @@ -185,7 +185,7 @@ SENF_AUTO_UNIT_TEST(factory) senf::console::root()("fn2")(ss, info); BOOST_CHECK_EQUAL( ss.str(), "functor" ); } - + senf::console::root().remove("fn1"); senf::console::root().remove("fn2"); } @@ -200,7 +200,7 @@ SENF_AUTO_UNIT_TEST(simpleCommandNode) senf::console::root()("fn")(ss, info); BOOST_CHECK_EQUAL( ss.str(), "callback" ); } - + { std::stringstream ss; senf::console::root().get("fn").help(ss); diff --git a/senf/Utils/Console/OverloadedCommand.cc b/senf/Utils/Console/OverloadedCommand.cc index 8205ec5..66b3068 100644 --- a/senf/Utils/Console/OverloadedCommand.cc +++ b/senf/Utils/Console/OverloadedCommand.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -62,14 +62,14 @@ senf::console::OverloadedCommandNode::insertOverload(DirectoryNode & dir, // default: 1.23 // arg3 - arg3-doc // -// Generic documentation foo blalsdljfl laj flkajslkjs fdlkj oiwlksdj ;llkaj +// Generic documentation foo blalsdljfl laj flkajslkjs fdlkj oiwlksdj ;llkaj // sdflkja sldkfjslkdfj sdlkfj lskjdf lskjdf lksj dflkj lsdkfj lskdjf lskjkd -// Generic documentation foo blalsdljfl laj flkajslkjs fdlkj oiwlksdj ;llkaj +// Generic documentation foo blalsdljfl laj flkajslkjs fdlkj oiwlksdj ;llkaj // sdflkja sldkfjslkdfj sdlkfj lskjdf lskjdf lksj dflkj lsdkfj lskdjf lskjkd -// Generic documentation foo blalsdljfl laj flkajslkjs fdlkj oiwlksdj ;llkaj +// Generic documentation foo blalsdljfl laj flkajslkjs fdlkj oiwlksdj ;llkaj // sdflkja sldkfjslkdfj sdlkfj lskjdf lskjdf lksj dflkj lsdkfj lskdjf lskjkd // -// Variant 1: +// Variant 1: // Variant 1 doc la;ksjf lkj sdlkfj lkjekj sdflkj ekljsdlkfj wlej // slkj dkj sldkfj lwekljsdf skldjf lskjdf l jsd // @@ -78,7 +78,7 @@ senf::console::OverloadedCommandNode::insertOverload(DirectoryNode & dir, // // Variatn 3: // Variant 3 doc slkjflw ekj lskdfj lskdjf laksdj flksj elkj aldskjf lwkejlksdj -// ldkfaj wlekj slkdfj lskdjf lwkejlkasdjf +// ldkfaj wlekj slkdfj lskdjf lwkejlkasdjf prefix_ void senf::console::OverloadedCommandNode::v_help(std::ostream & os) const @@ -137,8 +137,8 @@ prefix_ void senf::console::OverloadedCommandNode::v_help(std::ostream & os) ArgumentDocs::const_iterator const i_end (argumentDocs.end()); for (; i != i_end; ++i) { if (! i->doc.empty() || ! i->defaultValue.empty()) { - os << " " - << i->name + os << " " + << i->name << std::string(i->name.length()<8 ? 8-i->name.length() : 0, ' ') << " " << i->doc @@ -148,10 +148,10 @@ prefix_ void senf::console::OverloadedCommandNode::v_help(std::ostream & os) } } } - + if (! doc_.empty()) os << "\n" << doc_ << "\n"; - + { Overloads::const_iterator i (overloads_.begin()); Overloads::const_iterator const i_end (overloads_.end()); @@ -179,7 +179,7 @@ prefix_ std::string senf::console::OverloadedCommandNode::v_shorthelp() Overloads::const_iterator const i_end (overloads_.end()); for (; i != i_end; ++i) { std::string overloadDoc ((*i)->doc()); - if (! overloadDoc.empty()) + if (! overloadDoc.empty()) return overloadDoc.substr(0,overloadDoc.find('\n')); } return ""; diff --git a/senf/Utils/Console/OverloadedCommand.cci b/senf/Utils/Console/OverloadedCommand.cci index 767d0ea..59de51c 100644 --- a/senf/Utils/Console/OverloadedCommand.cci +++ b/senf/Utils/Console/OverloadedCommand.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -66,7 +66,7 @@ senf::console::OverloadedCommandNode::shortdoc(std::string const & doc) prefix_ unsigned senf::console::OverloadedCommandNode::overloadIndex(CommandOverload const & overload) { - return find(overloads_.begin(), overloads_.end(), CommandOverload::cptr(&overload)) + return find(overloads_.begin(), overloads_.end(), CommandOverload::cptr(&overload)) - overloads_.begin() + 1; } diff --git a/senf/Utils/Console/OverloadedCommand.cti b/senf/Utils/Console/OverloadedCommand.cti index b5e7a75..e622912 100644 --- a/senf/Utils/Console/OverloadedCommand.cti +++ b/senf/Utils/Console/OverloadedCommand.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/OverloadedCommand.hh b/senf/Utils/Console/OverloadedCommand.hh index 3d6b6fc..9ba7252 100644 --- a/senf/Utils/Console/OverloadedCommand.hh +++ b/senf/Utils/Console/OverloadedCommand.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -75,15 +75,15 @@ namespace console { void execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command); ///< Call the overload /**< If the \a arguments are not acceptable for this - overload, a SyntaxErrorException must be thrown. + overload, a SyntaxErrorException must be thrown. Same as operator()() */ void operator()(boost::any & rv, std::ostream & os, ParseCommandInfo const & command); ///< Call the overload /**< If the \a arguments are not acceptable for this - overload, a SyntaxErrorException must be thrown. + overload, a SyntaxErrorException must be thrown. Same as execute() */ - + unsigned numArguments() const; ///< Number of arguments this overload takes void argumentDoc(unsigned index, ArgumentDoc & doc) const; ///< Get information on argument \a index @@ -94,7 +94,7 @@ namespace console { \param[out] doc Argument documentation */ std::string doc() const; ///< Get overload documentation - + OverloadedCommandNode & node() const; ///< Access owning node /**< \pre The command \e must have been added to an OverloadedCommandNode. */ @@ -142,7 +142,7 @@ namespace console { 'SyntaxErrorException' exception is thrown. This works by first adding an OverloadedCommandNode to the directory in question and then - adding commands to that node. Commands are derived from CommandOverload. + adding commands to that node. Commands are derived from CommandOverload. \code senf::console::DirectoryNode & dir (...); senf::console::OverloadedCommandNode & cmd ( @@ -185,7 +185,7 @@ namespace console { ///@} /////////////////////////////////////////////////////////////////////////// - + template Command & add(boost::intrusive_ptr overload); ///< Add an additional overload @@ -223,7 +223,7 @@ namespace console { /** \brief Basic command overload This is an implementation of CommandOverload which allows to call an arbitrary callback with - the correct signature + the correct signature (void (std::ostream &, senf::console::ParseCommandInfo const &)) */ class SimpleCommandOverload @@ -277,7 +277,7 @@ namespace console { SimpleOverloadAttributor const & overloadDoc(std::string const & doc) const; OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const; - + private: SimpleCommandOverload::ptr overload_; mutable boost::optional doc_; diff --git a/senf/Utils/Console/OverloadedCommand.test.cc b/senf/Utils/Console/OverloadedCommand.test.cc index 2bd356a..d68aac2 100644 --- a/senf/Utils/Console/OverloadedCommand.test.cc +++ b/senf/Utils/Console/OverloadedCommand.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -69,17 +69,17 @@ SENF_AUTO_UNIT_TEST(overladedCommand) std::stringstream ss; BOOST_CHECK_THROW( senf::console::root()("overload")(ss, info), senf::console::SyntaxErrorException ); - + cmd.add(senf::console::SimpleCommandOverload::create(&fn3)).doc("fn3"); SENF_CHECK_NO_THROW( senf::console::root()("overload")(ss, info) ); BOOST_CHECK_EQUAL( ss.str(), "fn3\n" ); } - + { std::stringstream ss; cmd.help(ss); - BOOST_CHECK_EQUAL( ss.str(), - "Usage:\n" + BOOST_CHECK_EQUAL( ss.str(), + "Usage:\n" " 1- overload ...\n" " 2- overload ...\n" " 3- overload ...\n" diff --git a/senf/Utils/Console/Parse.cc b/senf/Utils/Console/Parse.cc index 7f0c5ba..f9b2d21 100644 --- a/senf/Utils/Console/Parse.cc +++ b/senf/Utils/Console/Parse.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -95,7 +95,7 @@ namespace detail { void popDirectory() { info_->clear(); info_->builtin(ParseCommandInfo::BuiltinPOPD); } - + void builtin_exit() { info_->clear(); info_->builtin(ParseCommandInfo::BuiltinEXIT); } @@ -145,15 +145,15 @@ prefix_ std::ostream & senf::console::operator<<(std::ostream & os, Token const "Word" }; // The real table is: // static const int bitPosition[32] = { - // 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, + // 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, // 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; // However, we have replaced all values >= sizeof(tokenTypeName) with 0 // and have added 1 to all the remaining values static const int bitPosition[32] = { - 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 5, 9, + 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 5, 9, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 7, 0, 6, 0, 10 }; // We need to check token.type() against 0 explicitly since 0 and 1 will both be mapped to 0 - os << tokenTypeName[ token.type() + os << tokenTypeName[ token.type() ? bitPosition[(((token.type() & -token.type()) * 0x077CB531UL) >> 27) & 31] : 0 ] << "('" @@ -183,7 +183,7 @@ prefix_ std::ostream & senf::console::operator<<(std::ostream & stream, char const * builtins[] = { 0, "cd", "ls", "lr", "pushd", "popd", "exit", "help" }; stream << "builtin-" << builtins[info.builtin()]; } - + ParseCommandInfo::ArgumentsRange args (info.arguments()); for (ParseCommandInfo::argument_iterator i (args.begin()); i != args.end(); ++i) { ParseCommandInfo::token_iterator j (i->begin()); @@ -262,9 +262,9 @@ struct senf::console::CommandParser::Impl #endif namespace { - + template - void throwParserError(Error const & err) + void throwParserError(Error const & err) { static char const * msg [] = { "end of statement expected", "path expected", @@ -277,7 +277,7 @@ namespace { } -namespace boost { +namespace boost { namespace spirit { template <> @@ -318,7 +318,7 @@ prefix_ senf::console::CommandParser::~CommandParser() // we would need to expose the Impl member to the public, which we don't want to do. template -prefix_ Iterator senf::console::CommandParser::parseLoop(Iterator npb, Iterator npe, +prefix_ Iterator senf::console::CommandParser::parseLoop(Iterator npb, Iterator npe, std::string const & source, Callback cb) { typedef boost::spirit::position_iterator< @@ -333,7 +333,7 @@ prefix_ Iterator senf::console::CommandParser::parseLoop(Iterator npb, Iterator result = boost::spirit::parse( b, e, * impl().grammar.use_parser()); b = result.stop; - if (b == e) + if (b == e) return e.base(); info.clear(); try { @@ -349,7 +349,7 @@ prefix_ Iterator senf::console::CommandParser::parseLoop(Iterator npb, Iterator } // Otherwise the error handling in the parser is broken SENF_ASSERT( result.hit ); - if (! info.empty()) + if (! info.empty()) try { cb(info); } @@ -369,9 +369,9 @@ prefix_ void senf::console::CommandParser::parse(std::string const & command, Ca prefix_ void senf::console::CommandParser::parseFile(std::string const & filename, Callback cb) { - // file_iterator sets errno to EINVAL and returns error when file size is 0 - // so we check the file size before - struct stat statBuf; + // file_iterator sets errno to EINVAL and returns error when file size is 0 + // so we check the file size before + struct stat statBuf; if (stat( filename.c_str(), &statBuf) != 0) throw SystemException(filename, errno SENF_EXC_DEBUGINFO); if (statBuf.st_size == 0) return; @@ -379,7 +379,7 @@ prefix_ void senf::console::CommandParser::parseFile(std::string const & filenam if (!i) { if (errno == 0) // hmm.. errno==0 but the file_iterator is false; something is wrong but we - // do not know what exactly, so we throw a SystemeException with EINVAL + // do not know what exactly, so we throw a SystemeException with EINVAL throw SystemException(filename, EINVAL SENF_EXC_DEBUGINFO); else throw SystemException(filename, errno SENF_EXC_DEBUGINFO); @@ -398,7 +398,7 @@ prefix_ void senf::console::CommandParser::parseArguments(std::string const & ar detail::ParseDispatcher::BindInfo bind (impl().dispatcher, info); boost::spirit::parse_info result; try { - result = boost::spirit::parse( b, e, + result = boost::spirit::parse( b, e, impl().grammar.use_parser(), impl().grammar.use_parser() ); } @@ -422,7 +422,7 @@ prefix_ void senf::console::CommandParser::parsePath(std::string const & path, detail::ParseDispatcher::BindInfo bind (impl().dispatcher, info); boost::spirit::parse_info result; try { - result = boost::spirit::parse( b, e, + result = boost::spirit::parse( b, e, impl().grammar.use_parser(), impl().grammar.use_parser() ); } @@ -453,7 +453,7 @@ prefix_ std::string::size_type senf::console::CommandParser::parseIncremental(std::string const & commands, Callback cb) { SetIncremental si (*this); - return std::distance( commands.begin(), + return std::distance( commands.begin(), parseLoop(commands.begin(), commands.end(), "", cb) ); } diff --git a/senf/Utils/Console/Parse.cci b/senf/Utils/Console/Parse.cci index 794b91e..6818aee 100644 --- a/senf/Utils/Console/Parse.cci +++ b/senf/Utils/Console/Parse.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -226,7 +226,7 @@ senf::console::ParseCommandInfo::ArgumentIterator::dereference() const { if (b_ == e_) setRange(); - return b_->is(Token::ArgumentGroupOpen) + return b_->is(Token::ArgumentGroupOpen) ? boost::make_iterator_range(boost::next(b_), boost::prior(e_)) : boost::make_iterator_range(b_, e_); } diff --git a/senf/Utils/Console/Parse.hh b/senf/Utils/Console/Parse.hh index e06150d..54499b1 100644 --- a/senf/Utils/Console/Parse.hh +++ b/senf/Utils/Console/Parse.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,9 +45,9 @@ configuration file \code # My someserver configuration file - + /server/port 1234; - + /logger/targets { console { accept senf::log::Debug IMPORTANT; @@ -83,7 +83,7 @@ These are characters, which have a special meaning. Some are used internally, others are just returned as punctuation tokens - +
\c true \c false \ref senf::console::formatTrueFalse
\c on \c off \ref senf::console::formatOnOff
@@ -116,7 +116,7 @@ "\"foo\nbar\"" "\x04test" - + A hex-string literal is used to represent binary data. It looks like a string which has only hexadecimal bytes or whitespace as contents (comments and newlines are Ok when not read from the interactive console) @@ -139,7 +139,7 @@ \subsection console_statements Statements - + There are several types of statements: \li The bulk of all statements are \e path statements \li There are some \e built-in statements which are mostly useful at the interactive console @@ -159,7 +159,7 @@ is completely up to the command. A built-in statement is one of - +
#Comments are marked with '#' and continue to the end of the line
/path component separator
@@ -213,14 +213,14 @@ namespace console { /** \brief Single argument token All command arguments are split into tokens by the parser. Each token is returned as an - Token instance. + Token instance. \ingroup console_parser */ class Token { public: - enum TokenType { + enum TokenType { None = 0, PathSeparator = 0x0001, // '/' ArgumentGroupOpen = 0x0002, // '(' @@ -235,30 +235,30 @@ namespace console { }; enum TokenGroup { - ArgumentGrouper = ArgumentGroupOpen + ArgumentGrouper = ArgumentGroupOpen | ArgumentGroupClose, - DirectoryGrouper = DirectoryGroupOpen + DirectoryGrouper = DirectoryGroupOpen | DirectoryGroupClose, - Punctuation = DirectoryGroupOpen - | DirectoryGroupClose - | PathSeparator - | CommandTerminator + Punctuation = DirectoryGroupOpen + | DirectoryGroupClose + | PathSeparator + | CommandTerminator | OtherPunctuation, - String = BasicString + String = BasicString | HexString, - SimpleArgument = Word - | BasicString + SimpleArgument = Word + | BasicString | HexString }; - + Token(); ///< Create empty token - Token(TokenType type, std::string token); + Token(TokenType type, std::string token); ///< Create token with given type and value - Token(TokenType type, std::string token, detail::FilePositionWithIndex const & pos); + Token(TokenType type, std::string token, detail::FilePositionWithIndex const & pos); ///< Create token with given type and value @@ -338,7 +338,7 @@ namespace console { Every command parsed is returned in a ParseCommandInfo instance. This information is purely taken from the parser, no semantic information is attached at this point, the config/console node tree is not involved in any way. ParseCommandInfo consist of - + \li the type of command: built-in or normal command represented by a possibly relative path into the command tree. \li the command @@ -352,7 +352,7 @@ namespace console { typedef std::vector CommandPath; public: - class ArgumentIterator; + class ArgumentIterator; typedef CommandPath::const_iterator path_iterator; typedef Tokens::const_iterator token_iterator; @@ -363,12 +363,12 @@ namespace console { typedef boost::iterator_range ArgumentsRange; typedef boost::iterator_range TokensRange; - enum BuiltinCommand { NoBuiltin, - BuiltinCD, - BuiltinLS, + enum BuiltinCommand { NoBuiltin, + BuiltinCD, + BuiltinLS, BuiltinLL, BuiltinLR, - BuiltinPUSHD, + BuiltinPUSHD, BuiltinPOPD, BuiltinEXIT, BuiltinHELP }; @@ -395,7 +395,7 @@ namespace console { void clear(); ///< Clear all data members bool empty(); ///< \c true, if the data is empty - void builtin(BuiltinCommand builtin); ///< Assign builtin command + void builtin(BuiltinCommand builtin); ///< Assign builtin command void command(std::vector & commandPath); ///< Assign non-builtin command void addToken(Token const & token); ///< Add argument token @@ -425,7 +425,7 @@ namespace console { This iterator is a bidirectional iterator \e not a random access iterator. */ class ParseCommandInfo::ArgumentIterator - : public boost::iterator_facade< ParseCommandInfo::ArgumentIterator, + : public boost::iterator_facade< ParseCommandInfo::ArgumentIterator, ParseCommandInfo::TokensRange, boost::bidirectional_traversal_tag, ParseCommandInfo::TokensRange > @@ -455,11 +455,11 @@ namespace console { of SyntaxErrorException. This is important, so command overloading works. */ struct SyntaxErrorException : public senf::Exception - { explicit SyntaxErrorException(std::string const & msg = "syntax error") + { explicit SyntaxErrorException(std::string const & msg = "syntax error") : senf::Exception(msg) {} }; /** \brief Wrapper checking argument iterator access for validity - + CheckedArgumentIteratorWrapper is a wrapper around a range of arguments parsed using the ParseCommandInfo::ArgumentIterator. It is used to parse arguments either in a command (registered with manual argument parsing) or when defining a custom parser. @@ -468,7 +468,7 @@ namespace console { { std:;string arg1; unsigned arg2 (0); - + { senf::console::CheckedArgumentIteratorWrapper arg (command.arguments()); senf::console::parse( *(arg++), arg1 ); @@ -483,7 +483,7 @@ namespace console { \li You increment the iterator \e past all arguments you parse. The iterator must point to the end of the range when parsing is complete. \li The iterator wrapper is destroyed after parsing but before executing the command itself - begins. + begins. Accessing a non-existent argument or failing to parse all arguments will raise a senf::console::SyntaxErrorException. @@ -510,7 +510,7 @@ namespace console { std::string const & msg = "invalid number of arguments"); ///< Make wrapper from ArgumentsRange /**< This constructs a wrapper from a - ParseCommandInfo::ArgumentsRange. + ParseCommandInfo::ArgumentsRange. \param[in] range Range of arguments to parse \param[in] msg Error message */ explicit CheckedArgumentIteratorWrapper( @@ -533,7 +533,7 @@ namespace console { SyntaxErrorException, if not all arguments are parsed and when no other exception is in progress. */ - operator ParseCommandInfo::ArgumentIterator(); + operator ParseCommandInfo::ArgumentIterator(); ///< Use wrapper as ParseCommandInfo::ArgumentIterator bool boolean_test() const; ///< \c true, if more arguments are available @@ -548,7 +548,7 @@ namespace console { ///< Compare wrapper against ArgumentIterator bool operator!=(ParseCommandInfo::ArgumentIterator const & other) const; ///< Compare wrapper against ArgumentIterator - + using IteratorFacade::operator++; ParseCommandInfo::ArgumentIterator operator++(int); @@ -624,8 +624,8 @@ namespace console { /**< An incremental parse will parse all complete statements in \a commands. parseIncremental() will return the number of characters successfully parsed from \a - commands. - + commands. + \note The incremental parser \e requires all statements to be terminated explicitly. This means, that the last ';' is \e not optional in this case. */ diff --git a/senf/Utils/Console/Parse.ih b/senf/Utils/Console/Parse.ih index e0e42d6..8bfb8f8 100644 --- a/senf/Utils/Console/Parse.ih +++ b/senf/Utils/Console/Parse.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -43,11 +43,11 @@ namespace detail { #ifndef DOXYGEN - struct FilePositionWithIndex + struct FilePositionWithIndex : public boost::spirit::file_position { int index; - + FilePositionWithIndex(std::string const & file_ = std::string(), int line_ = 1, int column_ = 1, int index_ = 0) : boost::spirit::file_position (file_, line_, column_), index (index_) @@ -55,7 +55,7 @@ namespace detail { bool operator==(const FilePositionWithIndex & fp) const { - return boost::spirit::file_position::operator==(fp) && index == fp.index; + return boost::spirit::file_position::operator==(fp) && index == fp.index; } }; @@ -105,7 +105,7 @@ namespace detail { ////////////////////////////////////////////////////////////////////////// // charachter sets - + static boost::spirit::chset<> special_p; static boost::spirit::chset<> punctuation_p; static boost::spirit::chset<> space_p; @@ -125,19 +125,19 @@ namespace detail { /////////////////////////////////////////////////////////////////////////// - CommandGrammar(ParseDispatcher & d, Context & c) + CommandGrammar(ParseDispatcher & d, Context & c) : context(c), incremental(false), dispatcher(d) {} template - struct definition - : public boost::spirit::grammar_def< boost::spirit::rule, + struct definition + : public boost::spirit::grammar_def< boost::spirit::rule, boost::spirit::rule, boost::spirit::rule, boost::spirit::rule > { boost::spirit::rule command, path, argument, word, string, hexstring, token, - punctuation, hexbyte, balanced_tokens, simple_argument, complex_argument, builtin, - skip, statement, relpath, abspath, arguments, group_start, group_close, + punctuation, hexbyte, balanced_tokens, simple_argument, complex_argument, builtin, + skip, statement, relpath, abspath, arguments, group_start, group_close, statement_end, opt_path; definition(CommandGrammar const & self) @@ -176,7 +176,7 @@ namespace detail { // Beside this, we use some special parsers (ch_p, eps_p, confix_p, lex_escape_ch_p, // keyword_p, comment_p) and directives (lexeme_d), however, the parser should be // quite readable. - // + // // ch_p match character // eps_p always matches nothing (to attach unconditional actions) // confix_p(a,b,c) match b, preceded by a and terminated by c. Used to parse @@ -197,7 +197,7 @@ namespace detail { // // More info is in the Boost.Spirit documentation - command + command = builtin >> end_of_statement_expected(statement_end) | group_close | ch_p(';') // Ignore empty commands @@ -207,14 +207,14 @@ namespace detail { statement = path_expected(path) [ bind(&PD::beginCommand)(d_, path_) ] >> arguments - >> end_of_statement_expected( + >> end_of_statement_expected( ( group_start | statement_end ) [ bind(&PD::endCommand)(d_) ] ) ; builtin - = self.keyword_p("cd") + = self.keyword_p("cd") >> path_expected(path) >> eps_p [ bind(&PD::builtin_cd)(d_, path_) ] | self.keyword_p("ls") @@ -248,24 +248,24 @@ namespace detail { = simple_argument [ bind(&PD::pushToken)(d_, token_) ] | balanced_tokens ; - + simple_argument // All these return their value in context.token = string | hexstring | word ; - + string // Returns value in context.token = eps_p [ pos_ = positionOf(arg1) ][ clear(str_) ] >> lexeme_d [ ch_p('"') - >> * ( ( lex_escape_ch_p[ ch_ = arg1 ] - - '"' + >> * ( ( lex_escape_ch_p[ ch_ = arg1 ] + - '"' ) [ str_ += ch_ ] ) >> quote_expected(ch_p('"')) - [ token_ = construct_(Token::BasicString, + [ token_ = construct_(Token::BasicString, str_, pos_) ] ] @@ -280,7 +280,7 @@ namespace detail { str_, pos_) ] ; - + opt_path = ! path [ bind(&PD::beginCommand)(d_, path_) ] [ bind(&PD::endCommand)(d_) ] @@ -303,7 +303,7 @@ namespace detail { | eps_p [ push_back(path_, construct_()) ] ) ; - balanced_tokens + balanced_tokens = eps_p [ pos_ = positionOf(arg1) ] >> ch_p('(') [ token_ = construct_( Token::ArgumentGroupOpen, @@ -355,7 +355,7 @@ namespace detail { (+ self.word_p) [ str_ = construct_(arg1, arg2) ] ] >> eps_p [ token_ = construct_( - Token::Word, + Token::Word, str_, pos_) ] ; @@ -370,7 +370,7 @@ namespace detail { ch_p(';') ] .else_p [ - ch_p(';') + ch_p(';') | end_p ] ; @@ -416,7 +416,7 @@ namespace detail { ",="); template boost::spirit::chset<> CommandGrammar::space_p ( " \t\n\r"); - template boost::spirit::chset<> CommandGrammar::invalid_p ( + template boost::spirit::chset<> CommandGrammar::invalid_p ( (boost::spirit::chset<>('\0') | boost::spirit::chset<>("\x01-\x20")) - space_p ); template boost::spirit::chset<> CommandGrammar::word_p ( boost::spirit::anychar_p - special_p - punctuation_p - space_p - invalid_p); diff --git a/senf/Utils/Console/Parse.test.cc b/senf/Utils/Console/Parse.test.cc index 41b809f..27f1697 100644 --- a/senf/Utils/Console/Parse.test.cc +++ b/senf/Utils/Console/Parse.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -41,9 +41,9 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -namespace +namespace { - struct TestParseDispatcher + struct TestParseDispatcher { TestParseDispatcher(std::ostream & os) : os_ (os) {} @@ -54,11 +54,11 @@ namespace void popDirectory() { os_ << "popDirectory()\n"; } - void beginCommand(std::vector const & command) + void beginCommand(std::vector const & command) { os_ << "beginCommand( " << senf::stringJoin(command, "/") << " )\n"; } - void endCommand() + void endCommand() { os_ << "endCommand()\n"; } - + void pushToken(senf::console::Token token) { os_ << "pushToken( " << token << " )\n"; } @@ -82,12 +82,12 @@ SENF_AUTO_UNIT_TEST(commandGrammar) senf::console::detail::CommandGrammar::Context context; std::stringstream ss; TestParseDispatcher dispatcher (ss); - + typedef senf::console::detail::CommandGrammar Grammar; Grammar grammar (dispatcher, context); { - static char text[] = + static char text[] = "# Comment\n" "doo / bii / // doo arg" " flab::blub" @@ -97,11 +97,11 @@ SENF_AUTO_UNIT_TEST(commandGrammar) " x\"01 02 # Inner comment\n" " 0304\";"; - BOOST_CHECK( boost::spirit::parse( - text, - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + text, + grammar.use_parser(), grammar.use_parser() ) . full ); - BOOST_CHECK_EQUAL( ss.str(), + BOOST_CHECK_EQUAL( ss.str(), "beginCommand( Word('doo')/Word('bii')/Word('doo') )\n" "pushToken( Word('arg') )\n" "pushToken( Word('flab::blub') )\n" @@ -127,47 +127,47 @@ SENF_AUTO_UNIT_TEST(commandGrammar) { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "ls //foo/bar;", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "ls //foo/bar;", + grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "builtin_ls( None('')/Word('foo')/Word('bar') )\n" ); } { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "lr /foo/bar;", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "lr /foo/bar;", + grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "builtin_lr( None('')/Word('foo')/Word('bar') )\n" ); } { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "cd /foo/bar;", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "cd /foo/bar;", + grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "builtin_cd( None('')/Word('foo')/Word('bar') )\n" ); } { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "exit;", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "exit;", + grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "builtin_exit()\n" ); } { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "foo/bar// {", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "foo/bar// {", + grammar.use_parser(), grammar.use_parser() ) . full ); - BOOST_CHECK_EQUAL( ss.str(), + BOOST_CHECK_EQUAL( ss.str(), "beginCommand( Word('foo')/Word('bar')/None('') )\n" "pushDirectory()\n" "endCommand()\n" ); @@ -175,18 +175,18 @@ SENF_AUTO_UNIT_TEST(commandGrammar) { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "}", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "}", + grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "popDirectory()\n" ); } { ss.str(""); - BOOST_CHECK( boost::spirit::parse( - "help /foo/bar", - grammar.use_parser(), + BOOST_CHECK( boost::spirit::parse( + "help /foo/bar", + grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "builtin_help( None('')/Word('foo')/Word('bar') )\n" ); } @@ -202,7 +202,7 @@ SENF_AUTO_UNIT_TEST(commandParser) { senf::console::CommandParser parser; - char const text[] = + char const text[] = "# Comment\n" "doo / bii / doo arg" " flab::blub" @@ -219,8 +219,8 @@ SENF_AUTO_UNIT_TEST(commandParser) { senf::console::ParseCommandInfo const & info (commands.front()); - senf::console::Token path[] = { - senf::console::Token(senf::console::Token::Word, "doo"), + senf::console::Token path[] = { + senf::console::Token(senf::console::Token::Word, "doo"), senf::console::Token(senf::console::Token::Word, "bii"), senf::console::Token(senf::console::Token::Word, "doo") }; @@ -229,10 +229,10 @@ SENF_AUTO_UNIT_TEST(commandParser) path, path + sizeof(path)/sizeof(path[0]) ); BOOST_CHECK_EQUAL( boost::next(info.commandPath().begin())->index(), 16u ); BOOST_CHECK_EQUAL( unsigned(info.tokens().size()), 15u ); - - char const * tokens[] = { "arg", - "flab::blub", - "123.434>a", + + char const * tokens[] = { "arg", + "flab::blub", + "123.434>a", "(", "a", ",", "b", ",", "c", "(", "huhu", ")", ")", "foo\"bar", "\x01\x02\x03\x04" }; @@ -241,17 +241,17 @@ SENF_AUTO_UNIT_TEST(commandParser) BOOST_REQUIRE( args != info.arguments().end() ); BOOST_REQUIRE_EQUAL( unsigned(args->size()), 1u ); BOOST_CHECK_EQUAL( args->begin()->value(), tokens[0] ); - + ++ args; BOOST_REQUIRE( args != info.arguments().end() ); BOOST_REQUIRE_EQUAL( args->size(), 1u ); BOOST_CHECK_EQUAL( args->begin()->value(), tokens[1] ); - + ++ args; BOOST_REQUIRE( args != info.arguments().end() ); BOOST_REQUIRE_EQUAL( args->size(), 1u ); BOOST_CHECK_EQUAL( args->begin()->value(), tokens[2] ); - + ++ args; BOOST_REQUIRE( args != info.arguments().end() ); BOOST_REQUIRE_EQUAL( args->size(), 8u ); @@ -260,18 +260,18 @@ SENF_AUTO_UNIT_TEST(commandParser) BOOST_CHECK_EQUAL( info.tokens().begin()[3].index(), 96u ); BOOST_CHECK_EQUAL( info.tokens().begin()[5].index(), 98u ); BOOST_CHECK_EQUAL( info.tokens().begin()[12].index(), 109u ); - + ++ args; BOOST_REQUIRE( args != info.arguments().end() ); BOOST_REQUIRE_EQUAL( args->size(), 1u ); BOOST_CHECK_EQUAL( args->begin()->value(), tokens[13] ); BOOST_CHECK_EQUAL( args->begin()->index(), 126u ); - + ++ args; BOOST_REQUIRE( args != info.arguments().end() ); BOOST_REQUIRE_EQUAL( args->size(), 1u ); BOOST_CHECK_EQUAL( args->begin()->value(), tokens[14] ); - + ++ args; BOOST_CHECK( args == info.arguments().end() ); } @@ -293,16 +293,16 @@ SENF_AUTO_UNIT_TEST(checkedArgumentIterator) senf::console::CommandParser parser; SENF_CHECK_NO_THROW( parser.parse("foo a", &setInfo) ); - BOOST_CHECK_THROW( parseArgs(commands.back().arguments()), + BOOST_CHECK_THROW( parseArgs(commands.back().arguments()), senf::console::SyntaxErrorException ); SENF_CHECK_NO_THROW( parser.parse("foo a b", &setInfo) ); SENF_CHECK_NO_THROW( parseArgs(commands.back().arguments()) ); SENF_CHECK_NO_THROW( parser.parse("foo a b c", &setInfo) ); - BOOST_CHECK_THROW( parseArgs(commands.back().arguments()), + BOOST_CHECK_THROW( parseArgs(commands.back().arguments()), senf::console::SyntaxErrorException ); - + senf::console::CheckedArgumentIteratorWrapper arg (commands.back().arguments()); BOOST_CHECK( arg == commands.back().arguments().begin() ); BOOST_CHECK( arg != commands.back().arguments().end() ); @@ -351,7 +351,7 @@ SENF_AUTO_UNIT_TEST(parseExceptions) try { parser.parse(c, &setInfo); } \ catch (std::exception & ex) { msg = parseErrorMessage(ex.what()); } \ BOOST_CHECK_EQUAL( msg, e ) - + CheckParseEx( "/foo/bar;\n ()", "path expected\nat :2:3" ); CheckParseEx( "cd /foo/bar foo/bar", "end of statement expected\nat :1:13" ); CheckParseEx( "/foo/bar foo /", "end of statement expected\nat :1:14" ); diff --git a/senf/Utils/Console/ParsedCommand.cc b/senf/Utils/Console/ParsedCommand.cc index bca4793..3e537de 100644 --- a/senf/Utils/Console/ParsedCommand.cc +++ b/senf/Utils/Console/ParsedCommand.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -53,7 +53,7 @@ prefix_ void senf::console::ParsedCommandOverloadBase::v_argumentDoc(unsigned in { BOOST_ASSERT( index < parameters_.size() ); detail::ArgumentInfoBase & arg (*parameters_[index]); - doc.name = arg.name.empty() + doc.name = arg.name.empty() ? (boost::format("arg%d%d") % overloadIndex() % (index+1)).str() : arg.name; doc.type = arg.type; diff --git a/senf/Utils/Console/ParsedCommand.cci b/senf/Utils/Console/ParsedCommand.cci index 5c71e65..c2aaf07 100644 --- a/senf/Utils/Console/ParsedCommand.cci +++ b/senf/Utils/Console/ParsedCommand.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/ParsedCommand.ct b/senf/Utils/Console/ParsedCommand.ct index 61b6153..f0c0555 100644 --- a/senf/Utils/Console/ParsedCommand.ct +++ b/senf/Utils/Console/ParsedCommand.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Console/ParsedCommand.cti b/senf/Utils/Console/ParsedCommand.cti index d6d6048..1d36bb4 100644 --- a/senf/Utils/Console/ParsedCommand.cti +++ b/senf/Utils/Console/ParsedCommand.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,7 +45,7 @@ senf::console::detail::ArgumentInfo::create() template prefix_ senf::console::detail::ArgumentInfo::ArgumentInfo() - : ArgumentInfoBase ( ArgumentTraits::description(), + : ArgumentInfoBase ( ArgumentTraits::description(), ArgumentTraits::singleToken ), defaultValue () {} @@ -318,7 +318,7 @@ template prefix_ senf::console::ParsedArgumentAttributor:: ParsedArgumentAttributor(typename Overload::ptr overload) - : ParsedArgumentAttributorBase< + : ParsedArgumentAttributorBase< Overload, ParsedArgumentAttributor > (overload, index) {} @@ -364,7 +364,7 @@ namespace detail { /////////////////////////////////////////////////////////////////////////// template -prefix_ senf::console::SimpleOverloadAttributor +prefix_ senf::console::SimpleOverloadAttributor senf::console::factory:: Command(boost::function fn, typename boost::enable_if_c::is_simple>::type *) @@ -373,7 +373,7 @@ Command(boost::function fn, } template -prefix_ senf::console::SimpleOverloadAttributor +prefix_ senf::console::SimpleOverloadAttributor senf::console::factory:: Command(Function fn, typename boost::enable_if_c::is_simple>::type *) @@ -382,7 +382,7 @@ Command(Function fn, } template -prefix_ senf::console::SimpleOverloadAttributor +prefix_ senf::console::SimpleOverloadAttributor senf::console::factory:: Command(Member memfn, Owner * owner, typename boost::enable_if >::type *, @@ -392,7 +392,7 @@ Command(Member memfn, Owner * owner, } template -prefix_ senf::console::SimpleOverloadAttributor +prefix_ senf::console::SimpleOverloadAttributor senf::console::factory:: Command(Member memfn, Owner const * owner, typename boost::enable_if >::type *, diff --git a/senf/Utils/Console/ParsedCommand.hh b/senf/Utils/Console/ParsedCommand.hh index 7571904..753bd83 100644 --- a/senf/Utils/Console/ParsedCommand.hh +++ b/senf/Utils/Console/ParsedCommand.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -113,7 +113,7 @@ namespace console { should do so to make the unwieldy casts unnecessary. \section overload_parse Custom parameter parsers - + By default, parameters are parsed using \c boost::lexical_cast and therefore using \c iostreams. This means, that any type which can be read from a stream can automatically be used as argument type. @@ -194,7 +194,7 @@ namespace console { Attributes for parsed commands are not set directly on the node. They are set via a special attributor temporary returned when adding a parsed command to the tree. - + This class is the base class for those attributors. It provides members which do not depend in any way on the exact type of command added. @@ -217,12 +217,12 @@ namespace console { void argDoc(std::string const & doc); void typeName(std::string const & doc); void defaultDoc(std::string const & doc); - + ParsedCommandOverloadBase & overload() const; void overloadDoc(std::string const & doc); void nodeDoc(std::string const & doc); void shortDoc(std::string const & doc); - + private: ParsedCommandOverloadBase::ptr overload_; unsigned index_; @@ -230,8 +230,8 @@ namespace console { boost::optional shortdoc_; }; - /** \brief Non argument dependent ParsedCommandBase attributes - + /** \brief Non argument dependent ParsedCommandBase attributes + Attributes for parsed commands are not set directly on the node. They are set via a special attributor temporary returned when adding a parsed command to the tree. @@ -265,7 +265,7 @@ namespace console { // Either qualify them with their complete namespace dir.add(...) .arg( senf::console::kw::name = "name" ); - + // Or use a namespace alias namespace kw = senf::console::kw; dir.add(...) @@ -300,7 +300,7 @@ namespace console {
         Usage:
             command [name:type_name]
-        
+
         With:
             name      description
                 default: default_doc
@@ -376,7 +376,7 @@ namespace console {
                                              token list returned by the console/config parser into
                                              the appropriate value. If not set explicitly, this
                                              conversion is supplied by the ArgumentTraits
-                                             class. 
+                                             class.
 
                                              Setting the \a parser attribute allows to use a custom
                                              parser. The parser is an arbitrary callable object with
@@ -395,7 +395,7 @@ namespace console {
 
         Attributes for parsed commands are not set directly on the node. They are set via a special
         attributor temporary returned when adding a parsed command to the tree.
-        
+
         This class adds all those members, which do not depend on any specific argument but which
         need to return the correct attributor type.
 
@@ -409,7 +409,7 @@ namespace console {
         Self doc(std::string const & doc); ///< Set documentation for all overloads
         Self shortdoc(std::string const & doc); ///< Set short documentation for all overloads
         Self overloadDoc(std::string const & doc); ///< Set overload specific documentation
-        Self formatter(typename Overload::Formatter formatter); 
+        Self formatter(typename Overload::Formatter formatter);
                                         ///< Set return value formatter
                                         /**< This member is only available, if the \a ReturnType of
                                              the installed callback is not \c void.
@@ -448,12 +448,12 @@ namespace console {
     };
 
 #endif
-    
+
     /** \brief Argument dependent ParsedCommandBase attributes
 
         Attributes for parsed commands are not set directly on the node. They are set via a special
         attributor temporary returned when adding a parsed command to the tree.
-        
+
         This class adds all those members, which depend on a specific argument. Each call to \c arg
         will advance to the next argument.
 
@@ -461,7 +461,7 @@ namespace console {
      */
     template 
     class ParsedArgumentAttributor
-        : public ParsedArgumentAttributorBase< Overload, 
+        : public ParsedArgumentAttributorBase< Overload,
                                                 ParsedArgumentAttributor >
     {
         typedef boost::parameter::parameters<
@@ -473,7 +473,7 @@ namespace console {
             kw::type::parser> arg_params;
 
     public:
-        typedef typename senf::function_traits_arg_type< 
+        typedef typename senf::function_traits_arg_type<
             typename Overload::traits, int(index) >::type arg_type;
         typedef typename senf::remove_cvref< arg_type >::type value_type;
         typedef ParsedArgumentAttributor next_type;
@@ -483,16 +483,16 @@ namespace console {
                                              argument. The attributes are passed to arg() as keyword
                                              arguments using the Boost.Parameter
-                                             library. 
+                                             library.
                                              \code
                                              ...
-                                                 .arg( kw::name          = "name", 
+                                                 .arg( kw::name          = "name",
                                                        kw::default_value = 1 )
                                              ...
                                              \endcode
                                              The valid keywords are defined in the senf::console::kw
                                              namespace.
-                                             
+
                                              Each call to arg() will increment the argument index
                                              and advance to the next argument. This member is only
                                              present, if there is an argument at the current
@@ -518,22 +518,22 @@ namespace console {
         void argInfo(Kw const &, ArgumentPack const &, boost::mpl::false_);
 
         template 
-        void argInfo(boost::parameter::keyword const &, 
+        void argInfo(boost::parameter::keyword const &,
                      ArgumentPack const & args, boost::mpl::true_);
         template 
-        void argInfo(boost::parameter::keyword const &, 
+        void argInfo(boost::parameter::keyword const &,
                      ArgumentPack const & args, boost::mpl::true_);
         template 
-        void argInfo(boost::parameter::keyword const &, 
+        void argInfo(boost::parameter::keyword const &,
                      ArgumentPack const & args, boost::mpl::true_);
         template 
-        void argInfo(boost::parameter::keyword const &, 
+        void argInfo(boost::parameter::keyword const &,
                      ArgumentPack const & args, boost::mpl::true_);
         template 
-        void argInfo(boost::parameter::keyword const &, 
+        void argInfo(boost::parameter::keyword const &,
                      ArgumentPack const & args, boost::mpl::true_);
         template 
-        void argInfo(boost::parameter::keyword const &, 
+        void argInfo(boost::parameter::keyword const &,
                      ArgumentPack const & args, boost::mpl::true_);
 
         next_type next() const;
@@ -551,7 +551,7 @@ namespace console {
 
     template 
     class ParsedArgumentAttributor
-        : public ParsedArgumentAttributorBase< Overload, 
+        : public ParsedArgumentAttributorBase< Overload,
                                                 ParsedArgumentAttributor >
     {
     public:
@@ -573,12 +573,12 @@ namespace console {
 namespace factory {
 
     template 
-    SimpleOverloadAttributor 
+    SimpleOverloadAttributor
     Command(boost::function fn,
             typename boost::enable_if_c::is_simple>::type * = 0);
 
     template 
-    SimpleOverloadAttributor 
+    SimpleOverloadAttributor
     Command(Function fn,
             typename boost::enable_if_c::is_simple>::type * = 0);
 
@@ -603,7 +603,7 @@ namespace factory {
     Command(Function fn,
             typename boost::enable_if_c::is_callable>::type * = 0,
             typename boost::disable_if >::type * = 0);
-    
+
     template 
     typename senf::console::detail::ParsedCommandTraits::Attributor
     Command(boost::function fn);
@@ -623,7 +623,7 @@ namespace factory {
     typename senf::console::detail::ParsedCommandTraits::Attributor
     Command(Member memfn, Owner const * owner,
             typename boost::enable_if >::type * = 0);
-    
+
     template 
     typename senf::console::detail::ParsedCommandTraits::Attributor
     Command(Member memfn, Owner * owner,
diff --git a/senf/Utils/Console/ParsedCommand.ih b/senf/Utils/Console/ParsedCommand.ih
index 3fbb1b5..0a2a3d0 100644
--- a/senf/Utils/Console/ParsedCommand.ih
+++ b/senf/Utils/Console/ParsedCommand.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -36,21 +36,21 @@
 namespace senf {
 namespace console {
 
-    template < class FunctionTraits, 
-               class ReturnType=typename FunctionTraits::result_type, 
+    template < class FunctionTraits,
+               class ReturnType=typename FunctionTraits::result_type,
                unsigned arity=FunctionTraits::arity >
     class ParsedCommandOverload;
 
-    template < class Overload, 
-               unsigned index=0, 
+    template < class Overload,
+               unsigned index=0,
                bool flag=(index < unsigned(Overload::traits::arity)) >
     class ParsedArgumentAttributor;
 
 namespace detail {
 
     /** \brief Internal: Argument information structure
-        
-        This class is used to hold argument information for automatically parsed commands. 
+
+        This class is used to hold argument information for automatically parsed commands.
 
         \see ParsedCommandOverloadBase
      */
@@ -58,32 +58,32 @@ namespace detail {
         : public intrusive_refcount
     {
         typedef boost::intrusive_ptr ptr;
-        
+
         std::string type;
         std::string name;
         std::string defaultDoc;
         bool hasDefault;
         std::string doc;
         bool singleToken;
-        
+
         explicit ArgumentInfoBase(std::string const & type, bool singleToken=false);
         virtual ~ArgumentInfoBase();
 
         virtual std::string defaultValueStr() const = 0;
     };
-    
+
     /** \brief Internal: Argument information structure
-        
-        This class is used to hold argument information for automatically parsed commands. 
+
+        This class is used to hold argument information for automatically parsed commands.
 
         \see ParsedCommandOverloadBase
      */
     template 
-    struct ArgumentInfo 
+    struct ArgumentInfo
         : public ArgumentInfoBase
     {
         typedef boost::intrusive_ptr ptr;
-        typedef boost::function Parser;
 
         static ptr create();
@@ -94,7 +94,7 @@ namespace detail {
 
         virtual std::string defaultValueStr() const;
     };
-    
+
 #ifndef DOXYGEN
 
     // FirstArgType returns void, if the function has no arguments, otherwise it returns arg1_type
@@ -130,8 +130,8 @@ namespace detail {
         static const bool has_ostream_arg = boost::is_same::value;
 
         typedef typename boost::mpl::if_c<
-            has_ostream_arg, 
-            typename function_traits_remove_arg::type, 
+            has_ostream_arg,
+            typename function_traits_remove_arg::type,
             base_traits>
         ::type traits;
 
@@ -140,7 +140,7 @@ namespace detail {
         static const bool is_callable = true;
         static const bool is_member = boost::is_member_pointer::value;
         static const bool is_simple = false;
-        
+
         typedef typename senf::member_class::type class_type;
 
         typedef ParsedCommandOverload Overload;
@@ -156,7 +156,7 @@ namespace detail {
 
     template 
     struct ParsedCommandTraits
-        : public ParsedCommandTraits_i< FunctionP, 
+        : public ParsedCommandTraits_i< FunctionP,
                                         typename senf::remove_any_pointer::type >
     {};
 
@@ -175,9 +175,9 @@ namespace detail {
     //
     // If however, it does NOT take an std::ostream first argument, 'ignoreOneArg' will be true and
     // the create member will use boost::bind to DROP the first argument.
-    
-    template 
     struct CreateParsedCommandOverload
     {};
@@ -186,9 +186,9 @@ namespace detail {
     struct CreateParsedCommandOverload
     {
         typedef typename Traits::traits traits;
-        
+
         template 
-        static typename senf::console::ParsedCommandOverload::ptr create(Function fn) 
+        static typename senf::console::ParsedCommandOverload::ptr create(Function fn)
             { return senf::console::ParsedCommandOverload::create(fn); };
     };
 
diff --git a/senf/Utils/Console/ParsedCommand.mpp b/senf/Utils/Console/ParsedCommand.mpp
index a501d4a..de1c5f8 100644
--- a/senf/Utils/Console/ParsedCommand.mpp
+++ b/senf/Utils/Console/ParsedCommand.mpp
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -103,7 +103,7 @@ protected:
 private:
     ParsedCommandOverload(Function fn);
 
-    virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command) 
+    virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
         const;
 
     Function function_;
@@ -142,7 +142,7 @@ protected:
 private:
     ParsedCommandOverload(Function fn);
 
-    virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command) 
+    virtual void v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
         const;
 
     Function function_;
@@ -180,7 +180,7 @@ senf::console::detail::ArgumentInfo<
 senf::console::ParsedCommandOverload::
 arg() const
 {
-    return static_cast< detail::ArgumentInfo< 
+    return static_cast< detail::ArgumentInfo<
         typename boost::mpl::at_c::type > & >(arg(n));
 }
 
@@ -196,7 +196,7 @@ template 
 prefix_
 senf::console::ParsedCommandOverload::
 ParsedCommandOverload(Function fn)
-    : function_ (fn) 
+    : function_ (fn)
 {
 #   define mpp_l(z,n,d) addParameter< mpp_ArgTypeN(n) >();
     BOOST_PP_REPEAT( BOOST_PP_ITERATION(), mpp_l, _ )
@@ -221,7 +221,7 @@ senf::console::detail::ArgumentInfo<
 senf::console::ParsedCommandOverload::
 arg() const
 {
-    return static_cast< detail::ArgumentInfo< 
+    return static_cast< detail::ArgumentInfo<
         typename boost::mpl::at_c::type > & >(arg(n));
 }
 
@@ -237,7 +237,7 @@ template 
 prefix_
 senf::console::ParsedCommandOverload::
 ParsedCommandOverload(Function fn)
-    : function_ (fn) 
+    : function_ (fn)
 {
 #   define mpp_l(z,n,d) addParameter< mpp_ArgTypeN(n) >();
     BOOST_PP_REPEAT( BOOST_PP_ITERATION(), mpp_l, _ )
@@ -279,7 +279,7 @@ v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
                 ArgumentTraits< mpp_ArgTypeN(n) >::parse( *(i++), mpp_ArgN(n) );                  \
         }
 #   define mpp_l_(z,n,d) mpp_l(z, BOOST_PP_SUB(BOOST_PP_DEC(BOOST_PP_ITERATION()), n), d)
-    BOOST_PP_REPEAT( BOOST_PP_ITERATION(), mpp_l_, _ ) 
+    BOOST_PP_REPEAT( BOOST_PP_ITERATION(), mpp_l_, _ )
 #   undef mpp_l
 #   undef mpp_l_
 
@@ -321,7 +321,7 @@ v_execute(boost::any & rv, std::ostream & os, ParseCommandInfo const & command)
                 ArgumentTraits< mpp_ArgTypeN(n) >::parse( *(i++), mpp_ArgN(n) );                  \
         }
 #   define mpp_l_(z,n,d) mpp_l(z, BOOST_PP_SUB(BOOST_PP_DEC(BOOST_PP_ITERATION()), n), d)
-    BOOST_PP_REPEAT( BOOST_PP_ITERATION(), mpp_l_, _ ) 
+    BOOST_PP_REPEAT( BOOST_PP_ITERATION(), mpp_l_, _ )
 #   undef mpp_l
 #   undef mpp_l_
 
@@ -354,7 +354,7 @@ struct CreateParsedCommandOverload
 
 // Create keyword arg forwarding functions
 
-template  
+template 
 next_type arg ( BOOST_PP_ENUM_BINARY_PARAMS( BOOST_PP_ITERATION(), A, const & a ),
                 typename arg_params::match< BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), A ) >::type
                     kw = arg_params()) {
diff --git a/senf/Utils/Console/ParsedCommand.test.cc b/senf/Utils/Console/ParsedCommand.test.cc
index 023ea31..20dc40f 100644
--- a/senf/Utils/Console/ParsedCommand.test.cc
+++ b/senf/Utils/Console/ParsedCommand.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -45,7 +45,7 @@ namespace {
     std::string cb4(std::ostream & os) { os << "text\n"; return "value"; }
     void cb5(std::ostream & os, std::string const & v) { os << "Value: " << v << "\n"; }
 
-    struct TestParser 
+    struct TestParser
     {
         void operator()(senf::console::ParseCommandInfo::TokensRange const &,
                         std::string & out) const
@@ -68,7 +68,7 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
     {
         std::stringstream ss;
         dir.add("cb1", fty::Command(&cb1));
-        parser.parse("test/cb1 2 3.2", 
+        parser.parse("test/cb1 2 3.2",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 ));
         BOOST_CHECK_EQUAL( ss.str(), "5\n" );
     }
@@ -108,18 +108,18 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
     {
         std::stringstream ss;
 
-        BOOST_CHECK_THROW( 
-            parser.parse("test/cb1 2 3.2 foo", 
+        BOOST_CHECK_THROW(
+            parser.parse("test/cb1 2 3.2 foo",
                          boost::bind( boost::ref(executor), boost::ref(ss), _1 )),
             senf::console::SyntaxErrorException );
 
         BOOST_CHECK_THROW(
-            parser.parse("test/cb1 2", 
+            parser.parse("test/cb1 2",
                          boost::bind( boost::ref(executor), boost::ref(ss), _1 )),
             senf::console::SyntaxErrorException );
 
         BOOST_CHECK_THROW(
-            parser.parse("test/cb1 2 foo", 
+            parser.parse("test/cb1 2 foo",
                          boost::bind( boost::ref(executor), boost::ref(ss), _1 )),
             senf::console::SyntaxErrorException );
     }
@@ -129,7 +129,7 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
         std::stringstream ss;
 
         // Just for the fun of it, use a functor and not a function pointer as parser ...
-        dir.add("cb6", 
+        dir.add("cb6",
                 fty::Command(&cb5)
                     .arg( kw::parser = TestParser() )
             );
@@ -142,9 +142,9 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
     {
         std::stringstream ss;
 
-        // This tests adding boost::function objects and at the same time validates, that 
+        // This tests adding boost::function objects and at the same time validates, that
         // compatible types also work
-        dir.add("cb7", 
+        dir.add("cb7",
                 fty::Command(boost::function(&cb2))
                     .formatter( &testFormatter )
             );
@@ -177,7 +177,7 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
 
             .arg( description   = "Bar didelfrump di desgorb. Nu widsoflar brimeldrgf." )
 
-            .arg( name          = "checkup", 
+            .arg( name          = "checkup",
                   type_name     = "number",
                   description   = "Florgel, dargel and durgel",
                   default_value = 2.1,
@@ -189,7 +189,7 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
                 .overloadDoc(
                     "Uus Primordia fundo falsidicus corium, diurnitas humo pro leto. Sui Ueraciter\n"
                     "hio eruca lenis qua Agalmate ut fors penitentia. Iugum obdormio anxio nuncupo\n"
-                    "iam, in vos nam Custodi." ) 
+                    "iam, in vos nam Custodi." )
                 .arg( "text", default_value = "" ) )
             );
 
@@ -216,8 +216,8 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
     {
         std::stringstream ss;
         senf::console::root()["test"]("cb").help(ss);
-        BOOST_CHECK_EQUAL( 
-            ss.str(), 
+        BOOST_CHECK_EQUAL(
+            ss.str(),
             "Usage:\n"
             "    1- cb arg11:int [checkup:number]\n"
             "    2- cb [text:string]\n"
@@ -248,7 +248,7 @@ SENF_AUTO_UNIT_TEST(parsedCommand)
 }
 
 namespace {
-    struct Test 
+    struct Test
     {
         senf::console::ScopedDirectory dir;
         std::string name_;
@@ -271,11 +271,11 @@ SENF_AUTO_UNIT_TEST(memberParsedCommand)
     senf::console::CommandParser parser;
     senf::console::ScopedDirectory<> dir;
     senf::console::root().add("test", dir);
-    
+
     {
         Test obj ("bar");
         dir.add("obj", obj.dir);
-        
+
         std::stringstream ss;
         parser.parse("test/obj/name \": foo\"",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 ));
@@ -285,7 +285,7 @@ SENF_AUTO_UNIT_TEST(memberParsedCommand)
 
 namespace {
 
-    senf::console::DirectoryNode::ptr dircb() 
+    senf::console::DirectoryNode::ptr dircb()
     {
         namespace fty = senf::console::factory;
 
@@ -312,11 +312,11 @@ SENF_AUTO_UNIT_TEST(directoryReturn)
         SENF_CHECK_NO_THROW(
             parser.parse("test/test { ll; }",
                          boost::bind( boost::ref(executor), boost::ref(ss), _1 )) );
-        BOOST_CHECK_EQUAL( ss.str(), 
+        BOOST_CHECK_EQUAL( ss.str(),
                            "\n"
                            "cb1                         \n" );
     }
-    
+
 }
 
 #ifdef COMPILE_CHECK
@@ -343,7 +343,7 @@ COMPILE_FAIL(defaultDoc)
 }
 
 #endif
-    
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
diff --git a/senf/Utils/Console/ProgramOptions.cc b/senf/Utils/Console/ProgramOptions.cc
index f98eb9b..50f773a 100644
--- a/senf/Utils/Console/ProgramOptions.cc
+++ b/senf/Utils/Console/ProgramOptions.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -83,7 +83,7 @@ prefix_ void senf::console::detail::ProgramOptionsSource::v_parse(RestrictedExec
                             --n;
                         }
                     }
-                    else 
+                    else
                         param = arg.substr(i+1);
                     i = arg.size();
                 }
@@ -120,7 +120,7 @@ senf::console::detail::ProgramOptionsSource::parseLongOption(std::string const &
 
     ParseCommandInfo cmd;
     Path path;
- 
+
     DirectoryNode::ptr cwd (executor.root().thisptr());
     std::string::size_type b (0);
     while (b < name.size()) {
diff --git a/senf/Utils/Console/ProgramOptions.cci b/senf/Utils/Console/ProgramOptions.cci
index 3949e38..e24539e 100644
--- a/senf/Utils/Console/ProgramOptions.cci
+++ b/senf/Utils/Console/ProgramOptions.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/ProgramOptions.cti b/senf/Utils/Console/ProgramOptions.cti
index 0091819..d37557e 100644
--- a/senf/Utils/Console/ProgramOptions.cti
+++ b/senf/Utils/Console/ProgramOptions.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/ProgramOptions.hh b/senf/Utils/Console/ProgramOptions.hh
index 2f985f3..ab3c5c5 100644
--- a/senf/Utils/Console/ProgramOptions.hh
+++ b/senf/Utils/Console/ProgramOptions.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -54,7 +54,7 @@ namespace console {
         // Parse only options under the directory of some object. The object 'ob'
         // must have been registered somewhere in the node tree
         cf.parse(ob.dir);
-        
+
         // Parse rest of the config file
         cf.parse();
         \endcode
@@ -71,7 +71,7 @@ namespace console {
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
         ///@{
-        
+
         ProgramOptions(int argc, char const ** argv, DirectoryNode & root = root());
                                         ///< Create ProgramOptions parser for given options
                                         /**< The given argc/argv values are those passed to main by
@@ -80,7 +80,7 @@ namespace console {
 
         ///@}
         ///////////////////////////////////////////////////////////////////////////
-        
+
         template 
         ProgramOptions & nonOptions(Container & container);
                                         ///< Set container to add non-option arguments to
@@ -96,7 +96,7 @@ namespace console {
                                              line. This argument will be appended (with an
                                              additional '=') to \a longOpt. If \a withArg is \c
                                              false (the default), \a longOpt may optional contain an
-                                             argument. 
+                                             argument.
                                              \param[in] letter option letter
                                              \param[in] longOpt long option alias
                                              \param[in] withArg \c true, if the option should take
diff --git a/senf/Utils/Console/ProgramOptions.ih b/senf/Utils/Console/ProgramOptions.ih
index 7bbbf0c..29c2ebf 100644
--- a/senf/Utils/Console/ProgramOptions.ih
+++ b/senf/Utils/Console/ProgramOptions.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -35,7 +35,7 @@
 namespace senf {
 namespace console {
 namespace detail {
-    
+
 #ifndef DOXYGEN
 
     class ProgramOptionsSource : public ConfigSource
@@ -48,10 +48,10 @@ namespace detail {
         template 
         ProgramOptionsSource & nonOptions(Container & container);
         ProgramOptionsSource & alias(char letter, std::string const & longOpt, bool withArg=false);
-        
+
     private:
         ProgramOptionsSource(int argc, char const ** argv);
-        
+
         virtual void v_parse(RestrictedExecutor & executor);
 
         void parseLongOption(std::string const & arg, RestrictedExecutor & executor);
@@ -84,7 +84,7 @@ namespace detail {
         };
 
         typedef std::map ShortOptions;
-        
+
         int argc_;
         char const ** argv_;
         CommandParser parser_;
diff --git a/senf/Utils/Console/ProgramOptions.test.cc b/senf/Utils/Console/ProgramOptions.test.cc
index ba131d3..65cae20 100644
--- a/senf/Utils/Console/ProgramOptions.test.cc
+++ b/senf/Utils/Console/ProgramOptions.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -89,7 +89,7 @@ SENF_AUTO_UNIT_TEST(programOptions)
         BOOST_CHECK_EQUAL( val1, "" );
         BOOST_CHECK_EQUAL( val2, true );
     }
-    
+
     {
         char const * argv[] = { "", "-ab" };
         senf::console::ProgramOptions opts(sizeof(argv)/sizeof(argv[0]), argv, root);
diff --git a/senf/Utils/Console/STLSupport.ct b/senf/Utils/Console/STLSupport.ct
index 108b974..1d0d99f 100644
--- a/senf/Utils/Console/STLSupport.ct
+++ b/senf/Utils/Console/STLSupport.ct
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -40,7 +40,7 @@ template 
 prefix_ std::string
 senf::console::detail::CollectionArgumentTraitsBase::description()
 {
-    return senf::prettyBaseName(typeid(Collection)) + "<" 
+    return senf::prettyBaseName(typeid(Collection)) + "<"
         + ArgumentTraits::description() + ">";
 }
 
@@ -83,7 +83,7 @@ senf::console::detail::CollectionReturnValueTraits::format(Collectio
     if (i != i_end)
         for (;;) {
             os << senf::console::str(*i);
-            if (++i == i_end) 
+            if (++i == i_end)
                 break;
             else
                 os << " ";
@@ -115,7 +115,7 @@ parse(ParseCommandInfo::TokensRange const & tokens, Collection & out)
 template 
 prefix_ std::string senf::console::detail::MapArgumentTraits::description()
 {
-    return senf::prettyBaseName(typeid(Collection)) + "<" 
+    return senf::prettyBaseName(typeid(Collection)) + "<"
         + ArgumentTraits::description() + ","
         + ArgumentTraits::description() + ">";
 }
@@ -145,7 +145,7 @@ senf::console::detail::MapReturnValueTraits::format(Collection const
             os << senf::console::str(i->first)
                << "="
                << senf::console::str(i->second);
-            if (++i == i_end) 
+            if (++i == i_end)
                 break;
             else
                 os << " ";
diff --git a/senf/Utils/Console/STLSupport.cti b/senf/Utils/Console/STLSupport.cti
index 6932f1a..1603192 100644
--- a/senf/Utils/Console/STLSupport.cti
+++ b/senf/Utils/Console/STLSupport.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/STLSupport.hh b/senf/Utils/Console/STLSupport.hh
index 5523f21..89c51f7 100644
--- a/senf/Utils/Console/STLSupport.hh
+++ b/senf/Utils/Console/STLSupport.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -42,7 +42,7 @@ namespace console {
 
     template 
     struct ArgumentTraits< std::vector >
-        : public detail::CollectionArgumentTraits< std::vector, 
+        : public detail::CollectionArgumentTraits< std::vector,
                                                    detail::PushBackFunctor >
     {};
 
@@ -53,7 +53,7 @@ namespace console {
 
     template 
     struct ArgumentTraits< std::list >
-        : public detail::CollectionArgumentTraits< std::list, 
+        : public detail::CollectionArgumentTraits< std::list,
                                                    detail::PushBackFunctor >
     {};
 
@@ -64,7 +64,7 @@ namespace console {
 
     template 
     struct ArgumentTraits< std::set >
-        : public detail::CollectionArgumentTraits< std::set, 
+        : public detail::CollectionArgumentTraits< std::set,
                                                    detail::InsertFunctor >
     {};
 
@@ -75,7 +75,7 @@ namespace console {
 
     template 
     struct ArgumentTraits< std::multiset >
-        : public detail::CollectionArgumentTraits< std::multiset, 
+        : public detail::CollectionArgumentTraits< std::multiset,
                                                    detail::InsertFunctor >
     {};
 
diff --git a/senf/Utils/Console/STLSupport.ih b/senf/Utils/Console/STLSupport.ih
index 2372a84..1b4a92d 100644
--- a/senf/Utils/Console/STLSupport.ih
+++ b/senf/Utils/Console/STLSupport.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -86,7 +86,7 @@ namespace detail {
     struct MapReturnValueTraits
     {
         typedef Collection type;
-        
+
         static void format(Collection const & value, std::ostream & os);
     };
 
diff --git a/senf/Utils/Console/STLSupport.test.cc b/senf/Utils/Console/STLSupport.test.cc
index 9ce13ad..2619c27 100644
--- a/senf/Utils/Console/STLSupport.test.cc
+++ b/senf/Utils/Console/STLSupport.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -62,7 +62,7 @@ namespace {
         }
         return std::make_pair(keys,sum);
     }
-                
+
 }
 
 SENF_AUTO_UNIT_TEST(vectorSupport)
@@ -86,11 +86,11 @@ SENF_AUTO_UNIT_TEST(vectorSupport)
     BOOST_CHECK_EQUAL( ss.str(), "9\n" "0\n" "5\n" "13\n" "17\n" );
 
     ss.str("");
-    SENF_CHECK_NO_THROW( 
+    SENF_CHECK_NO_THROW(
         parser.parse("help test/test",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 )) );
     BOOST_CHECK_EQUAL(
-        ss.str(), 
+        ss.str(),
         "Usage:\n"
         "    test [data:vector]\n"
         "\n"
@@ -120,11 +120,11 @@ SENF_AUTO_UNIT_TEST(listSupport)
     BOOST_CHECK_EQUAL( ss.str(), "9\n" "0\n" "5\n" "13\n" "17\n" );
 
     ss.str("");
-    SENF_CHECK_NO_THROW( 
+    SENF_CHECK_NO_THROW(
         parser.parse("help test/test",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 )) );
     BOOST_CHECK_EQUAL(
-        ss.str(), 
+        ss.str(),
         "Usage:\n"
         "    test [data:list]\n"
         "\n"
@@ -154,11 +154,11 @@ SENF_AUTO_UNIT_TEST(setSupport)
     BOOST_CHECK_EQUAL( ss.str(), "9\n" "0\n" "5\n" "13\n" "17\n" );
 
     ss.str("");
-    SENF_CHECK_NO_THROW( 
+    SENF_CHECK_NO_THROW(
         parser.parse("help test/test",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 )) );
     BOOST_CHECK_EQUAL(
-        ss.str(), 
+        ss.str(),
         "Usage:\n"
         "    test [data:set]\n"
         "\n"
@@ -187,14 +187,14 @@ SENF_AUTO_UNIT_TEST(mapSupport)
         parser.parse("test/test; test/test (); "
                      "test/test (vier=4 fuenf = 5 acht=8 )",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 )) );
-    BOOST_CHECK_EQUAL( ss.str(), "(\"barfoo bar\" 9)\n" "(\"\" 0)\n" "(achtfuenfvier 17)\n" ); // 
+    BOOST_CHECK_EQUAL( ss.str(), "(\"barfoo bar\" 9)\n" "(\"\" 0)\n" "(achtfuenfvier 17)\n" ); //
 
     ss.str("");
-    SENF_CHECK_NO_THROW( 
+    SENF_CHECK_NO_THROW(
         parser.parse("help test/test",
                      boost::bind( boost::ref(executor), boost::ref(ss), _1 )) );
     BOOST_CHECK_EQUAL(
-        ss.str(), 
+        ss.str(),
         "Usage:\n"
         "    test [data:map]\n"
         "\n"
diff --git a/senf/Utils/Console/ScopedDirectory.cci b/senf/Utils/Console/ScopedDirectory.cci
index 162c658..bb4c090 100644
--- a/senf/Utils/Console/ScopedDirectory.cci
+++ b/senf/Utils/Console/ScopedDirectory.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -105,7 +105,7 @@ senf::console::ScopedDirectoryBase::doc(std::string const & doc)
     return node().doc(doc);
 }
 
-prefix_ std::string const & senf::console::ScopedDirectoryBase::name() 
+prefix_ std::string const & senf::console::ScopedDirectoryBase::name()
     const
 {
     return node().name();
@@ -129,8 +129,8 @@ prefix_ std::string senf::console::ScopedDirectoryBase::path(DirectoryNode const
     return node().path(root);
 }
 
-prefix_ boost::shared_ptr 
-senf::console::ScopedDirectoryBase::parent() 
+prefix_ boost::shared_ptr
+senf::console::ScopedDirectoryBase::parent()
     const
 {
     return node().parent();
@@ -147,12 +147,12 @@ prefix_ void senf::console::ScopedDirectoryBase::help(std::ostream & output)
     node().help( output);
 }
 
-prefix_ std::string senf::console::ScopedDirectoryBase::shorthelp() 
+prefix_ std::string senf::console::ScopedDirectoryBase::shorthelp()
     const
 {
     return node().shorthelp();
 }
-        
+
 prefix_ senf::console::ScopedDirectoryBase::ScopedDirectoryBase()
     : node_ (DirectoryNode::create())
 {}
diff --git a/senf/Utils/Console/ScopedDirectory.cti b/senf/Utils/Console/ScopedDirectory.cti
index 5b9e3dd..f5441d0 100644
--- a/senf/Utils/Console/ScopedDirectory.cti
+++ b/senf/Utils/Console/ScopedDirectory.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/ScopedDirectory.hh b/senf/Utils/Console/ScopedDirectory.hh
index 86f5334..2b298f9 100644
--- a/senf/Utils/Console/ScopedDirectory.hh
+++ b/senf/Utils/Console/ScopedDirectory.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -94,7 +94,7 @@ namespace console {
         public:
             ScopedDirectory configDir;
 
-            MyClass() : configDir(this) 
+            MyClass() : configDir(this)
             {
                 configDIr.add(...);
             }
@@ -120,7 +120,7 @@ namespace console {
     public:
         ///////////////////////////////////////////////////////////////////////////
         // Types
-        
+
         typedef Owner owner;
 
         ///////////////////////////////////////////////////////////////////////////
diff --git a/senf/Utils/Console/ScopedDirectory.test.cc b/senf/Utils/Console/ScopedDirectory.test.cc
index 6a6ba60..5087530 100644
--- a/senf/Utils/Console/ScopedDirectory.test.cc
+++ b/senf/Utils/Console/ScopedDirectory.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -108,16 +108,16 @@ SENF_AUTO_UNIT_TEST(scopedDirectoryBase)
         BOOST_CHECK( &dir["foo"] == &dir.get("foo") );
         BOOST_CHECK( &dir("cb") == &dir.get("cb") );
         BOOST_CHECK_EQUAL(dir.name(), "dir");
-        
+
         char const * const children[] = { "cb", "foo" };
-        BOOST_CHECK_EQUAL_COLLECTIONS( 
+        BOOST_CHECK_EQUAL_COLLECTIONS(
             boost::make_transform_iterator(dir.children().begin(),
                                            select1st()),
             boost::make_transform_iterator(dir.children().end(),
                                            select1st()),
-            children, 
+            children,
             children+sizeof(children)/sizeof(children[0]) );
-        
+
         dir.doc("dir");
         std::stringstream ss;
         dir.node().help(ss);
diff --git a/senf/Utils/Console/Server.cc b/senf/Utils/Console/Server.cc
index b46cd6e..48ac147 100644
--- a/senf/Utils/Console/Server.cc
+++ b/senf/Utils/Console/Server.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -71,7 +71,7 @@ senf::console::Server::start(senf::INet4SocketAddress const & address)
 {
     senf::TCPv4ServerSocketHandle handle (address);
     Server & server (senf::console::Server::start(handle));
-    SENF_LOG((Server::SENFLogArea)(log::NOTICE)( 
+    SENF_LOG((Server::SENFLogArea)(log::NOTICE)(
                  "Console server started at " << address ));
     return server;
 }
@@ -81,7 +81,7 @@ senf::console::Server::start(senf::INet6SocketAddress const & address)
 {
     senf::TCPv6ServerSocketHandle handle (address);
     Server & server (senf::console::Server::start(handle));
-    SENF_LOG((Server::SENFLogArea)(log::NOTICE)( 
+    SENF_LOG((Server::SENFLogArea)(log::NOTICE)(
                  "Console server started at " << address ));
     return server;
 }
@@ -94,7 +94,7 @@ prefix_ senf::console::Server & senf::console::Server::start(ServerHandle handle
 }
 
 prefix_ senf::console::Server::Server(ServerHandle handle)
-    : handle_ (handle), 
+    : handle_ (handle),
       event_ ("senf::console::Server", senf::membind(&Server::newClient, this),
               handle_, scheduler::FdEvent::EV_READ),
       root_ (senf::console::root().thisptr()), mode_ (Automatic),
@@ -143,7 +143,7 @@ senf::console::detail::DumbClientReader::clientData(senf::ReadHelper
diff --git a/senf/Utils/Console/Server.hh b/senf/Utils/Console/Server.hh
index c538a5b..825bc28 100644
--- a/senf/Utils/Console/Server.hh
+++ b/senf/Utils/Console/Server.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -72,7 +72,7 @@ namespace console {
     public:
         ///////////////////////////////////////////////////////////////////////////
         // Types
-        
+
         typedef detail::ServerHandle ServerHandle;
 
         enum Mode { Automatic, Interactive, Noninteractive };
@@ -98,9 +98,9 @@ namespace console {
 
         Mode mode() const;              ///< Get mode
                                         /**< \see \ref mode(Mode) */
-        
+
         Server & mode(Mode mode);       ///< Set mode
-                                        /**< There are two Server types: 
+                                        /**< There are two Server types:
                                              \li An interactive server displays a command prompt and
                                                  optionally supports command-line editing.
                                              \li A non-interactive server does not display any
@@ -115,7 +115,7 @@ namespace console {
                                              opened. */
 
         void stop();                    ///< Stop the server
-                                        /**< All clients will be closed 
+                                        /**< All clients will be closed
                                              \warning The Server instance itself will be deleted */
 
     protected:
@@ -127,19 +127,19 @@ namespace console {
 
         void newClient(int event);
         void removeClient(Client & client);
-        
+
         ServerHandle handle_;
         scheduler::FdEvent event_;
         DirectoryNode::ptr root_;
         Mode mode_;
-        
+
         typedef std::set< boost::intrusive_ptr > Clients;
         Clients clients_;
         std::string name_;
-        
+
         friend class Client;
     };
-    
+
     /** \brief Server client instance
 
         Whenever a new client connects, a new instance of this class is created. This class shows a
@@ -149,7 +149,7 @@ namespace console {
         \ingroup console_access
      */
     class Client
-        : public senf::intrusive_refcount, 
+        : public senf::intrusive_refcount,
           private boost::base_from_member< detail::NonblockingSocketOStream >,
           public senf::log::IOStreamTarget
     {
@@ -174,7 +174,7 @@ namespace console {
         ClientHandle handle() const;    ///< Get the client's network socket handle
         std::ostream & stream();        ///< Get client's output stream
                                         /**< Data sent to this stream is sent out over the network
-                                             via the client's socket handle. Write operation is 
+                                             via the client's socket handle. Write operation is
                                              non-blocking and data may be dropped. Data is written
                                              using Client::write(). */
         std::string promptString() const; ///< Get the prompt string
@@ -204,18 +204,18 @@ namespace console {
                                              will return the associated Client instance reference.
                                              \throws std::bad_cast if \a os is not associated with a
                                                  Client instance. */
-        static unsigned getWidth(std::ostream & os, unsigned defaultWidth = 0, 
+        static unsigned getWidth(std::ostream & os, unsigned defaultWidth = 0,
                                  unsigned minWidth = 0);
                                         ///< Get width of client console if possible
                                         /**< If possible, the width of the client console attached
                                              to the stream \a os is returned. If this is not
                                              possible, the \a defaultValue will be used.
-                                             
+
                                              If the width obtained this way is smaller than \a
                                              minWidth, \a defaultValue will be returned instead. */
 
     protected:
-        
+
     private:
         Client(Server & server, ClientHandle handle);
 
@@ -223,10 +223,10 @@ namespace console {
         void setNoninteractive();
 
         size_t handleInput(std::string input, bool incremental = false);
-        virtual void v_write(senf::log::time_type timestamp, std::string const & stream, 
-                             std::string const & area, unsigned level, 
+        virtual void v_write(senf::log::time_type timestamp, std::string const & stream,
+                             std::string const & area, unsigned level,
                              std::string const & message);
-        
+
         Server & server_;
         ClientHandle handle_;
         scheduler::FdEvent readevent_;
@@ -242,15 +242,15 @@ namespace console {
         friend class detail::ClientReader;
         friend class detail::NonblockingSocketSink;
 
-        class SysBacktrace 
+        class SysBacktrace
         {
             SysBacktrace();
             static void  backtrace(std::ostream & os);
             static SysBacktrace instance_;
         };
-        
+
     };
-        
+
     /** \brief Output Console Client instance as it's string representation
         \related Client
      */
diff --git a/senf/Utils/Console/Server.ih b/senf/Utils/Console/Server.ih
index aa77d74..2e793be 100644
--- a/senf/Utils/Console/Server.ih
+++ b/senf/Utils/Console/Server.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -66,7 +66,7 @@ namespace detail {
 
         \fixme Don't throw exceptions ... set stream error indicator (if at all)
      */
-    class NonblockingSocketSink 
+    class NonblockingSocketSink
         : public boost::iostreams::sink
     {
     public:
@@ -74,7 +74,7 @@ namespace detail {
         std::streamsize write(const char * s, std::streamsize n);
 
         Client & client() const;
-        
+
     private:
         Client & client_;
     };
@@ -82,7 +82,7 @@ namespace detail {
     typedef boost::iostreams::stream NonblockingSocketOStream;
 
     typedef senf::ServerSocketHandle<
-        senf::MakeSocketPolicy< senf::TCPv4SocketProtocol::Policy, 
+        senf::MakeSocketPolicy< senf::TCPv4SocketProtocol::Policy,
                                 senf::BSDAddressingPolicy>::policy > ServerHandle;
 
     /** \brief Internal: Generic client interface
@@ -129,7 +129,7 @@ namespace detail {
     };
 
     /** \brief Internal: Primitive ClientReader implementation
-        
+
         This implementation uses the cooked telnet mode to read lines from the console. It does not
         support explicit line editing or any other advanced features.
      */
@@ -154,7 +154,7 @@ namespace detail {
     };
 
     /** \brief Internal: Primitive ClientReader implementation
-        
+
         This implementation uses the cooked telnet mode to read lines from the console. It does not
         support explicit line editing or any other advanced features.
      */
@@ -175,7 +175,7 @@ namespace detail {
         scheduler::FdEvent readevent_;
         std::string buffer_;
     };
-    
+
 }}}
 
 ///////////////////////////////ih.e////////////////////////////////////////
diff --git a/senf/Utils/Console/Server.test.cc b/senf/Utils/Console/Server.test.cc
index 9d0ba65..0f58656 100644
--- a/senf/Utils/Console/Server.test.cc
+++ b/senf/Utils/Console/Server.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Sysdir.cci b/senf/Utils/Console/Sysdir.cci
index 9b97ea9..d140d46 100644
--- a/senf/Utils/Console/Sysdir.cci
+++ b/senf/Utils/Console/Sysdir.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Sysdir.hh b/senf/Utils/Console/Sysdir.hh
index fca5601..77b9c24 100644
--- a/senf/Utils/Console/Sysdir.hh
+++ b/senf/Utils/Console/Sysdir.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Sysdir.ih b/senf/Utils/Console/Sysdir.ih
index 3e89534..be0cf5b 100644
--- a/senf/Utils/Console/Sysdir.ih
+++ b/senf/Utils/Console/Sysdir.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -40,9 +40,9 @@ namespace detail {
     public:
         using singleton::instance;
         using singleton::alive;
-        
+
         ScopedDirectory<> & sysdir();
-        
+
     private:
         SysdirManager();
 
diff --git a/senf/Utils/Console/Traits.cc b/senf/Utils/Console/Traits.cc
index 6f75d60..91c4f45 100644
--- a/senf/Utils/Console/Traits.cc
+++ b/senf/Utils/Console/Traits.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Traits.cci b/senf/Utils/Console/Traits.cci
index 6625e60..3d1ca98 100644
--- a/senf/Utils/Console/Traits.cci
+++ b/senf/Utils/Console/Traits.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Traits.ct b/senf/Utils/Console/Traits.ct
index 6f90704..433b908 100644
--- a/senf/Utils/Console/Traits.ct
+++ b/senf/Utils/Console/Traits.ct
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Traits.cti b/senf/Utils/Console/Traits.cti
index 224f57f..baca16e 100644
--- a/senf/Utils/Console/Traits.cti
+++ b/senf/Utils/Console/Traits.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -96,12 +96,12 @@ prefix_ std::string senf::console::ArgumentTraits::str(Type const & value)
             if (rv[i] == '"' || rv[i] == '\\')
                 rv.insert(i++,"\\");
             else if (rv[i] < ' ' || rv[i] > 126) {
-                rv.insert(i+1, (boost::format("x%02x") 
+                rv.insert(i+1, (boost::format("x%02x")
                                 % unsigned(static_cast(rv[i]))).str().c_str());
                 rv[i] = '\\';
                 i += 3;
             }
-        
+
         rv.insert(0,"\"");
         rv.push_back('"');
         return rv;
diff --git a/senf/Utils/Console/Traits.hh b/senf/Utils/Console/Traits.hh
index ea5ee11..b281c93 100644
--- a/senf/Utils/Console/Traits.hh
+++ b/senf/Utils/Console/Traits.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -41,17 +41,17 @@ namespace senf {
 namespace console {
 
     /** \brief Customize argument parsing
-        
+
         ArgumentTraits provides argument parsing, Additionally, this class provides a way to get a
         string-description of a type and to convert a value back into it's string representation
         used to display default values.
-        
-        The default implementation provided here 
+
+        The default implementation provided here
         \li will use senf_console_parse_argument() to parse a value. This functions default
             implementation uses \c boost::lexical_cast and thereby \c iostreams to convert an
             argument consisting of a single input token into the required type.
         \li will name types by returning the last component of the fully scoped name (e.g. \c
-            "string" for \c std::string). 
+            "string" for \c std::string).
         \li Will format values (for default value display) by forwarding the value to the
             ReturnValueTraits of that type.
 
@@ -64,7 +64,7 @@ namespace console {
     {
         typedef Type type;
 
-        static bool const singleToken = 
+        static bool const singleToken =
             boost::is_same< typeof(senf_console_parse_argument(
                                        *static_cast(0),
                                        *static_cast(0))),
@@ -163,7 +163,7 @@ namespace console {
 
     /** \brief Register enum type for argument parsing
 
-        Enum types need to be registered explicitly to support parsing. 
+        Enum types need to be registered explicitly to support parsing.
         \code
         enum Foo { Foo1, Foo2 };
         SENF_CONSOLE_REGISTER_ENUM( Foo, (Foo1)(Foo2) );
@@ -182,7 +182,7 @@ namespace console {
 
     /** \brief Register enum type for argument parsing
 
-        Enum types need to be registered explicitly to support parsing. 
+        Enum types need to be registered explicitly to support parsing.
         \code
         class SomeClass
         {
@@ -207,7 +207,7 @@ namespace console {
 
     /** \brief Format boolean value as \c enabled / \c disabled */
     void formatEnabledDisabled(bool value, std::ostream & os);
-    
+
     /** \brief Format boolean value as \c on / \c off */
     void formatOnOff(bool value, std::ostream & os);
 
@@ -242,7 +242,7 @@ namespace console {
     template <> struct ArgumentTraits : public detail::CharArgumentTraits {};
     template <> struct ReturnValueTraits : public detail::CharReturnValueTraits {};
     template <> struct ArgumentTraits : public detail::CharArgumentTraits {};
-    template <> struct ReturnValueTraits : public detail::CharReturnValueTraits {};    
+    template <> struct ReturnValueTraits : public detail::CharReturnValueTraits {};
 
 #endif
 
diff --git a/senf/Utils/Console/Traits.ih b/senf/Utils/Console/Traits.ih
index a3a0d69..f979e9e 100644
--- a/senf/Utils/Console/Traits.ih
+++ b/senf/Utils/Console/Traits.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -46,7 +46,7 @@ namespace console {
     template  struct ReturnValueTraits;
 
 namespace detail {
-    
+
     template 
     struct MatchingShortType
         : public boost::mpl::if_c::is_signed,short,unsigned short>
@@ -73,7 +73,7 @@ namespace detail {
     struct StringILess
     {
         bool operator()(std::string const & left, std::string const & right) const
-            { return boost::algorithm::to_lower_copy(left) 
+            { return boost::algorithm::to_lower_copy(left)
                   < boost::algorithm::to_lower_copy(right); }
     };
 
diff --git a/senf/Utils/Console/Traits.test.cc b/senf/Utils/Console/Traits.test.cc
index cc5697f..871037e 100644
--- a/senf/Utils/Console/Traits.test.cc
+++ b/senf/Utils/Console/Traits.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -132,7 +132,7 @@ SENF_AUTO_UNIT_TEST(boolTraits)
 
 SENF_AUTO_UNIT_TEST(stringTraits)
 {
-    BOOST_CHECK_EQUAL( 
+    BOOST_CHECK_EQUAL(
         senf::console::ArgumentTraits::str("Test\nOf\nA \"String\"\x01\x7f\xa0\xff"),
         "\"Test\\x0aOf\\x0aA \\\"String\\\"\\x01\\x7f\\xa0\\xff\"" );
 }
@@ -147,7 +147,7 @@ SENF_AUTO_UNIT_TEST(enumSupport)
     senf::console::root().add("test", dir);
 
     dir.add("test",fty::Command(&test));
-    
+
     std::stringstream ss;
     SENF_CHECK_NO_THROW(
         parser.parse("test/test Foo",
@@ -207,7 +207,7 @@ SENF_AUTO_UNIT_TEST(singleToken)
 {
     BOOST_CHECK( senf::console::ArgumentTraits::singleToken );
     BOOST_CHECK( senf::console::ArgumentTraits::singleToken );
-    BOOST_CHECK( ! senf::console::ArgumentTraits< 
+    BOOST_CHECK( ! senf::console::ArgumentTraits<
                        senf::console::FlagCollection >::singleToken );
 }
 
diff --git a/senf/Utils/Console/UDPServer.cc b/senf/Utils/Console/UDPServer.cc
index 7f77884..d2db770 100644
--- a/senf/Utils/Console/UDPServer.cc
+++ b/senf/Utils/Console/UDPServer.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -35,11 +35,11 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 prefix_ senf::console::UDPServer::UDPServer(senf::INet4SocketAddress const & address)
-    : replies_ (true), emptyReplies_ (true), target_ (), 
-      handle_ (senf::UDPv4ClientSocketHandle(address)), 
-      readevent_ ("senf::console::UDPServer::readevent", 
-                  senf::membind(&UDPServer::handleInput, this), 
-                  handle_, 
+    : replies_ (true), emptyReplies_ (true), target_ (),
+      handle_ (senf::UDPv4ClientSocketHandle(address)),
+      readevent_ ("senf::console::UDPServer::readevent",
+                  senf::membind(&UDPServer::handleInput, this),
+                  handle_,
                   senf::scheduler::FdEvent::EV_READ),
       parser_ (), executor_ ()
 {
@@ -49,10 +49,10 @@ prefix_ senf::console::UDPServer::UDPServer(senf::INet4SocketAddress const & add
 }
 
 prefix_ senf::console::UDPServer::UDPServer(senf::INet6SocketAddress const & address)
-    : replies_ (true), target_ (), handle_ (senf::UDPv6ClientSocketHandle(address)), 
-      readevent_ ("senf::console::UDPServer::readevent", 
-                  senf::membind(&UDPServer::handleInput, this), 
-                  handle_, 
+    : replies_ (true), target_ (), handle_ (senf::UDPv6ClientSocketHandle(address)),
+      readevent_ ("senf::console::UDPServer::readevent",
+                  senf::membind(&UDPServer::handleInput, this),
+                  handle_,
                   senf::scheduler::FdEvent::EV_READ),
       parser_ (), executor_ ()
 {
@@ -71,7 +71,7 @@ prefix_ senf::console::UDPServer &
 senf::console::UDPServer::replies(senf::INet4SocketAddress const & address)
 {
     SENF_ASSERT( handle_.local().family() == senf::INet4SocketAddress::addressFamily );
-    target_ = address; 
+    target_ = address;
     return *this;
 }
 
@@ -139,7 +139,7 @@ prefix_ void senf::console::UDPServer::handleInput(int events)
             stream << '\0';
         handle_.writeto(address, stream.str());
     }
-    
+
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
diff --git a/senf/Utils/Console/UDPServer.hh b/senf/Utils/Console/UDPServer.hh
index bcc8bc9..0691b00 100644
--- a/senf/Utils/Console/UDPServer.hh
+++ b/senf/Utils/Console/UDPServer.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -46,7 +46,7 @@ namespace console {
         does support multicast operation.
 
         Every UDP packet will be executed in a clean context: No directory groups are open/closed,
-        and the current directory is always the root directory. 
+        and the current directory is always the root directory.
 
         By default, the server will send command replies via UDP to the sender of the corresponding
         incoming command. Replies may however either be completely disabled or be sent to a fixed
@@ -75,7 +75,7 @@ namespace console {
                                         ///< Open UDP server on \a address
         explicit UDPServer(senf::INet6SocketAddress const & address);
                                         ///< Open UDP server on \a address
-        
+
         ///@}
         ///////////////////////////////////////////////////////////////////////////
 
diff --git a/senf/Utils/Console/UDPServer.test.cc b/senf/Utils/Console/UDPServer.test.cc
index 86ad366..58175e5 100644
--- a/senf/Utils/Console/UDPServer.test.cc
+++ b/senf/Utils/Console/UDPServer.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -64,7 +64,7 @@ namespace {
     unsigned nread (0);
     unsigned flags (0);
     std::string data;
-    
+
     void read(senf::ConnectedUDPv4ClientSocketHandle socket, int ev)
     {
         flags |= ev;
diff --git a/senf/Utils/Console/Utility.ct b/senf/Utils/Console/Utility.ct
index 747a6be..4285cc8 100644
--- a/senf/Utils/Console/Utility.ct
+++ b/senf/Utils/Console/Utility.ct
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Utility.cti b/senf/Utils/Console/Utility.cti
index 52fedd1..4038da7 100644
--- a/senf/Utils/Console/Utility.cti
+++ b/senf/Utils/Console/Utility.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Console/Utility.hh b/senf/Utils/Console/Utility.hh
index 0e30fb4..6cf2433 100644
--- a/senf/Utils/Console/Utility.hh
+++ b/senf/Utils/Console/Utility.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -51,7 +51,7 @@ namespace console {
         argument/return type \a CharT  to CharAsString:
         \code
         char foo(char v) { return v; }
-        
+
         senf::console::root().add(
             "foo", boost::function< CharAsString (CharAsString) >(&foo));
         \endcode
@@ -67,7 +67,7 @@ namespace console {
         CharAsString(CharT value_);
         operator CharT () const;
         CharT value;
-    };    
+    };
 
 #ifndef DOXYGEN
 
@@ -76,7 +76,7 @@ namespace console {
     {
         typedef CharAsString type;
         static bool const singleToken = true;
-        
+
         static void parse(ParseCommandInfo::TokensRange const & tokens, CharAsString & out);
         static std::string description();
         static std::string str(CharAsString value);
@@ -86,14 +86,14 @@ namespace console {
     struct ReturnValueTraits< CharAsString >
     {
         typedef CharAsString type;
-        
+
         static void format(CharAsString value, std::ostream & os);
     };
 
 #endif
 
     /** \brief Value range
-        
+
         A value range may be represented in the console either by a single value (setting both \a
         low and \a high to the same value) or as a lower and upper bound seperated by a colon.
 
@@ -132,7 +132,7 @@ namespace console {
     /** \brief Bit-mask flag argument type
 
         senf::console::FlagCollection supplies a special argument type for use in registering
-        console commands. This argument type is used to represent a bit-mask of single flags. 
+        console commands. This argument type is used to represent a bit-mask of single flags.
 
         \code
         // Function taking a flags argument
@@ -144,7 +144,7 @@ namespace console {
                      Baz = 4,
                      Doo = 8 };
         SENF_CONSOLE_REGISTER_ENUM(MyFlags, (Foo)(Bar)(Baz)(Boo));
-        
+
         // Register the function with a FlagCollection argument type
         consoleDir.add("func", boost::function)>(&func));
         \endcode
@@ -157,7 +157,7 @@ namespace console {
 
         The nice thing is, that \c boot::function supports compatible argument types and does
         automatic type conversion. Since a FlagCollection is convertible to and from unsigned long,
-        this conversion will work. 
+        this conversion will work.
 
         After registering this function, you can call it with a collection of flags as argument
 
diff --git a/senf/Utils/Console/Utility.test.cc b/senf/Utils/Console/Utility.test.cc
index 3333cd5..46c4a98 100644
--- a/senf/Utils/Console/Utility.test.cc
+++ b/senf/Utils/Console/Utility.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -57,7 +57,7 @@ SENF_AUTO_UNIT_TEST(charAsString)
     senf::console::root().add("test", dir);
     std::stringstream ss;
 
-    dir.add("test", 
+    dir.add("test",
             fty::Command (senf::console::CharAsString)>(
                 &charTest));
 
@@ -79,7 +79,7 @@ SENF_AUTO_UNIT_TEST(flagCollection)
     std::stringstream ss;
 
     dir.add("test",fty::Command(&collectionTest));
-    
+
     ss.str("");
     SENF_CHECK_NO_THROW(
         parser.parse("test/test foo",
diff --git a/senf/Utils/Console/Variables.cti b/senf/Utils/Console/Variables.cti
index 80d5d73..cdf72ec 100644
--- a/senf/Utils/Console/Variables.cti
+++ b/senf/Utils/Console/Variables.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -151,7 +151,7 @@ template 
 prefix_ typename senf::console::factory::VariableFactory
 senf::console::factory::VariableFactory::onChange(OnChangeHandler handler)
 {
-    setOverload_->function( 
+    setOverload_->function(
         boost::bind(detail::SetVariable(var_, handler),_2));
     return *this;
 }
@@ -193,7 +193,7 @@ senf::console::factory::VariableFactory::create(DirectoryNode & dir,
 
 template 
 prefix_ senf::console::factory::VariableFactory::VariableFactory(Variable & var)
-    : ConstVariableFactory (var), 
+    : ConstVariableFactory (var),
       setOverload_ (detail::SetVariable::create(var)),
       var_ (var)
 {}
diff --git a/senf/Utils/Console/Variables.hh b/senf/Utils/Console/Variables.hh
index 71ed3c1..de9da46 100644
--- a/senf/Utils/Console/Variables.hh
+++ b/senf/Utils/Console/Variables.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -45,7 +45,7 @@ namespace console {
 namespace factory {
 
     /** \brief Variable command attributes (const)
-        
+
         \see VariableFactory
      */
     template 
@@ -63,7 +63,7 @@ namespace factory {
         ConstVariableFactory formatter(Formatter formatter);
 
         OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const;
-        
+
         explicit ConstVariableFactory(Variable const & var);
 
     private:
@@ -71,7 +71,7 @@ namespace factory {
         boost::optional doc_;
         boost::optional shortdoc_;
     };
- 
+
     /** \brief Variable command attributes
 
         Variable commands allow to register any arbitrary variable as a command node. The variable
@@ -91,7 +91,7 @@ namespace factory {
 
         Since a variable command is added as a combination of two ordinary overloads, it is possible
         to register additional overloads with the same name before or after registering the
-        variable. 
+        variable.
 
         It is also possible, to register a variable read-only. To achieve this, just wrap it with \c
         boost::cref(). Such a variable cannot be changed only queried. Therefore, it does not have
@@ -130,7 +130,7 @@ namespace factory {
                                              \code
                                                  void parser(senf::console::ParseCommandInfo::TokensRange const & tokens, value_type & out);
                                              \endcode
-                                             
+
                                              where \c value_type is the type of the overload
                                              parameter. The parser must read and parse the complete
                                              \a tokens range and return the parsed value in \a
diff --git a/senf/Utils/Console/Variables.ih b/senf/Utils/Console/Variables.ih
index 3e3f2f5..f76e32f 100644
--- a/senf/Utils/Console/Variables.ih
+++ b/senf/Utils/Console/Variables.ih
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -69,11 +69,11 @@ namespace detail {
         typedef detail::CreateParsedCommandOverload CreateOverload;
         typedef boost::function OnChangeHandler;
         typedef void result_type;
-        
+
         SetVariable(Variable & var, OnChangeHandler handler = OnChangeHandler());
 
         static typename Traits::Overload::ptr create(Variable & var);
-        
+
         void operator()(Variable const & value) const;
 
         Variable & var_;
diff --git a/senf/Utils/Console/Variables.test.cc b/senf/Utils/Console/Variables.test.cc
index 7b3c160..6269b3f 100644
--- a/senf/Utils/Console/Variables.test.cc
+++ b/senf/Utils/Console/Variables.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -75,7 +75,7 @@ SENF_AUTO_UNIT_TEST(variables)
 
     ss.str("");
     dir("var").help(ss);
-    BOOST_CHECK_EQUAL(ss.str(), 
+    BOOST_CHECK_EQUAL(ss.str(),
                       "Usage:\n"
                       "    1- var\n"
                       "    2- var new_value:number\n"
@@ -98,19 +98,19 @@ SENF_AUTO_UNIT_TEST(variables)
 }
 
 namespace {
-    
+
     class Test2
     {
     public:
         senf::console::ScopedDirectory dir;
-        
+
         Test2() : dir(this), var_(0)
             { dir.add("var", senf::console::factory::Variable(boost::ref(var_))); }
-        
+
     private:
         int var_;
     };
-  
+
 }
 
 SENF_AUTO_UNIT_TEST(memberVariables)
diff --git a/senf/Utils/Console/testServer.cc b/senf/Utils/Console/testServer.cc
index 69192a2..9db2b09 100644
--- a/senf/Utils/Console/testServer.cc
+++ b/senf/Utils/Console/testServer.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -46,8 +46,8 @@ struct TestObject
 {
     senf::console::ScopedDirectory dir;
 
-    TestObject() 
-        : dir(this) 
+    TestObject()
+        : dir(this)
         {
             dir.add("vat", fty::Command(&TestObject::vat, this)
                     .arg("vat", "VAT in %", kw::default_value = 19)
@@ -55,7 +55,7 @@ struct TestObject
                     .doc("Returns the amount of {vat}-% VAT included in {amount}") );
         }
 
-    double vat (int vat, double amount) 
+    double vat (int vat, double amount)
         {
             return amount * vat/(100.0+vat);
         }
diff --git a/senf/Utils/Daemon/Daemon.cc b/senf/Utils/Daemon/Daemon.cc
index 27e03e9..f866dca 100644
--- a/senf/Utils/Daemon/Daemon.cc
+++ b/senf/Utils/Daemon/Daemon.cc
@@ -86,12 +86,12 @@ prefix_ bool senf::Daemon::daemon()
     return daemonize_;
 }
 
-prefix_ int senf::Daemon::argc() 
+prefix_ int senf::Daemon::argc()
 {
     return argc_;
 }
 
-prefix_ char const ** senf::Daemon::argv() 
+prefix_ char const ** senf::Daemon::argv()
 {
     return argv_;
 }
@@ -139,7 +139,7 @@ prefix_ void senf::Daemon::openLog()
             stderr_ = ::dup(fd);
             if (stderr_ < 0)
                 SENF_THROW_SYSTEM_EXCEPTION("::dup()");
-        } 
+        }
         else {
             fd = ::open(stdoutLog_.c_str(), O_WRONLY | O_APPEND | O_CREAT, 0666);
             if (fd < 0)
@@ -154,21 +154,21 @@ prefix_ void senf::Daemon::logReopen()
 {
     if (! stdoutLog_.empty()) {
         int fd (::open(stdoutLog_.c_str(), O_WRONLY | O_APPEND | O_CREAT, 0666));
-        if (fd < 0) 
+        if (fd < 0)
             goto error;
-        if (::dup2(fd, 1) < 0) 
+        if (::dup2(fd, 1) < 0)
             goto error;
         if (stderrLog_ == stdoutLog_) {
-            if (::dup2(fd, 2) < 0) 
+            if (::dup2(fd, 2) < 0)
                 goto error;
             return;
         }
     }
     if (! stderrLog_.empty()) {
         int fd (::open(stderrLog_.c_str(), O_WRONLY | O_APPEND | O_CREAT, 0666));
-        if (fd < 0) 
+        if (fd < 0)
             goto error;
-        if (::dup2(fd, 2) < 0) 
+        if (::dup2(fd, 2) < 0)
             goto error;
     }
     return;
@@ -194,7 +194,7 @@ namespace {
 prefix_ void senf::Daemon::detach()
 {
     if (daemonize_ && ! detached_) {
-        // Wow .. ouch .. 
+        // Wow .. ouch ..
         // To ensure all data is written to the console log file in the correct order, we suspend
         // execution here until the parent process tells us to continue via SIGUSR1: We block
         // SIGUSR1 and install our own signal handler saving the old handler and signal mask. Then
@@ -262,7 +262,7 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv)
             if (pidfileCreate())
                 pidfileCreated_ = true;
             else {
-                std::cerr << "PID file '" << pidfile_ 
+                std::cerr << "PID file '" << pidfile_
                           << "' creation failed. Daemon running ?" << std::endl;
                 return 1;
             }
@@ -375,7 +375,7 @@ prefix_ void senf::Daemon::fork()
     LIBC_CALL( ::sigprocmask, (SIG_BLOCK, &cldsig, &oldsig) );
 
     if (! senf::scheduler::empty() ) {
-        std::cerr << 
+        std::cerr <<
             "\n"
             "*** WARNING ***\n"
             "Scheduler not empty before fork(). THIS MUST NOT HAPPEN.\n"
@@ -385,7 +385,7 @@ prefix_ void senf::Daemon::fork()
             "\n*** WARNING ***\n"
             "\n";
     }
-    
+
     LIBC_CALL_RV( pid, ::fork, () );
 
     if (pid == 0) {
@@ -406,7 +406,7 @@ prefix_ void senf::Daemon::fork()
 
     // Ouch ... ensure, the daemon watcher does not remove the pidfile ...
     pidfile_ = "";
-    
+
     LIBC_CALL( ::close, (coutpipe[1]) );
     LIBC_CALL( ::close, (cerrpipe[1]) );
 
@@ -449,7 +449,7 @@ prefix_ bool senf::Daemon::pidfileCreate()
         }
 
         if (::link(tempname.c_str(), pidfile_.c_str()) < 0) {
-            if (errno != EEXIST) 
+            if (errno != EEXIST)
                 SENF_THROW_SYSTEM_EXCEPTION("") << linkErrorFormat % pidfile_ % tempname;
         }
         else {
@@ -464,8 +464,8 @@ prefix_ bool senf::Daemon::pidfileCreate()
             int old_pid (-1);
             std::ifstream pidf (pidfile_.c_str());
             if ( ! (pidf >> old_pid)
-                 || old_pid < 0 
-                 || ::kill(old_pid, 0) >= 0 
+                 || old_pid < 0
+                 || ::kill(old_pid, 0) >= 0
                  || errno == EPERM ) {
                 LIBC_CALL( ::unlink, (tempname.c_str()) );
                 return false;
@@ -496,7 +496,7 @@ prefix_ bool senf::Daemon::pidfileCreate()
                 return false;
             }
         }
-        
+
         {
             std::ofstream pidf (tempname.c_str());
             pidf << ::getpid() << std::endl;
@@ -571,7 +571,7 @@ prefix_ void senf::Daemon::installSighandlers()
     ::sigaction(SIGFPE,    &sa, NULL);
     ::sigaction(SIGBUS,    &sa, NULL);
     ::sigaction(SIGSEGV,   &sa, NULL);
-#ifdef SIGSTKFLT //SIGSTKFLT is used for stack faults on coprocessors. That condition doesn't exist on MIPS 
+#ifdef SIGSTKFLT //SIGSTKFLT is used for stack faults on coprocessors. That condition doesn't exist on MIPS
     ::sigaction(SIGSTKFLT, &sa, NULL);
 #endif
     ::sigaction(SIGSYS,    &sa, NULL);
@@ -588,8 +588,8 @@ prefix_ senf::detail::DaemonWatcher::DaemonWatcher(int pid, int coutpipe, int ce
       stderr_(stderr), sigChld_(false),
       cldSignal_ (SIGCHLD, senf::membind(&DaemonWatcher::sigChld, this)),
       timer_ ("senf::detail::DaemonWatcher::childOk", senf::membind(&DaemonWatcher::childOk, this)),
-      coutForwarder_(coutpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 1)), 
-      cerrForwarder_(cerrpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 2)) 
+      coutForwarder_(coutpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 1)),
+      cerrForwarder_(cerrpipe_, boost::bind(&DaemonWatcher::pipeClosed, this, 2))
 {
     coutForwarder_.addTarget(1);
     if (stdout_ >= 0)
@@ -654,7 +654,7 @@ prefix_ void senf::detail::DaemonWatcher::childOk()
 // senf::detail::DaemonWatcher::Forwarder
 
 prefix_ senf::detail::DaemonWatcher::Forwarder::Forwarder(int src, Callback cb)
-    : src_(src), cb_(cb), 
+    : src_(src), cb_(cb),
       readevent_("senf::detail::DaemonWatcher::Forwarder::readevent", senf::membind(&Forwarder::readData, this),
                  src_, scheduler::FdEvent::EV_READ)
 {}
@@ -677,16 +677,16 @@ prefix_ void senf::detail::DaemonWatcher::Forwarder::readData(int event)
     while (1) {
         n = ::read(src_,buf,1024);
         if (n<0) {
-            if (errno != EINTR) 
+            if (errno != EINTR)
                 SENF_THROW_SYSTEM_EXCEPTION("::read()");
-        } 
-        else 
+        }
+        else
             break;
     }
 
     if (n == 0) {
         if (buffer_.empty())
-            cb_(); 
+            cb_();
         src_ = -1;
         readevent_.disable();
         return;
@@ -703,7 +703,7 @@ prefix_ void senf::detail::DaemonWatcher::Forwarder::readData(int event)
 }
 
 prefix_ void senf::detail::DaemonWatcher::Forwarder::writeData(int event, Target * target)
-{    
+{
     if (event != scheduler::FdEvent::EV_WRITE) {
         // Broken pipe while writing data ? Not much, we can do here, we just drop the data
         targets_.erase_and_destroy(Targets::current(*target),DestroyDelete());
diff --git a/senf/Utils/Daemon/Daemon.cci b/senf/Utils/Daemon/Daemon.cci
index 50c8c6c..8ae89db 100644
--- a/senf/Utils/Daemon/Daemon.cci
+++ b/senf/Utils/Daemon/Daemon.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Daemon/Daemon.hh b/senf/Utils/Daemon/Daemon.hh
index 38284d2..747120f 100644
--- a/senf/Utils/Daemon/Daemon.hh
+++ b/senf/Utils/Daemon/Daemon.hh
@@ -52,7 +52,7 @@ namespace senf {
         \li Optional foreground execution. The daemon may be started in the foreground for
             debugging purposes. In this case, the console log file(s) is/are automatically
             suppressed.
-        
+
         Starting the daemon process proceeds along the following steps:
         \li The daemon is started by calling the daemon class instances start() member. This
             normally happens from the \c main() function generated by \ref SENF_DAEMON_MAIN().
@@ -62,7 +62,7 @@ namespace senf {
             created. The parent (foreground) process keeps running overseeing the daemon process.
         \li main() is called. This virtual member may optionally be overridden in the derived
             class. Here we assume, main() is not overridden so the default implementation is used.
-        \li main() calls init(). 
+        \li main() calls init().
         \li after init() returns, main() calls detach().
         \li detach() signals successful startup to the parent process. The parent process terminates
             leaving the daemon process running in the background.
@@ -98,7 +98,7 @@ namespace senf {
         arguments. It just checks, if any of above arguments are present and precesses them. Other
         arguments are completely ignored. The command line parameters should be completely processed
         within init().
-        
+
       */
     class Daemon : boost::noncopyable
     {
@@ -107,13 +107,13 @@ namespace senf {
 
         ///////////////////////////////////////////////////////////////////////////
         // Types
-        
+
         /// Select standard stream to redirect
-        enum StdStream { 
+        enum StdStream {
             StdOut  /** Standard output stream */
         ,   StdErr  /** Standard error stream */
         ,   Both    /** Both, standard output and error stream */
-        }; 
+        };
 
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
@@ -128,12 +128,12 @@ namespace senf {
         void daemonize(bool);           ///< Configure whether to run in fore- or background
         bool daemon();                  ///< \c true, if running as daemon
 
-        void consoleLog(std::string const &, StdStream which = Both); 
+        void consoleLog(std::string const &, StdStream which = Both);
                                         ///< Configure console log file
                                         /**< May be called multiple times to set the log file
                                              for stdout and stderr seperately. Any standard stream
                                              not assigned to a log file will be redirected to
-                                             /dev/null. 
+                                             /dev/null.
 
                                              When running in the foreground, the log files will be
                                              ignored. */
@@ -166,7 +166,7 @@ namespace senf {
                                              SIGHUP calls logReopen. */
 
         ///\}
-        
+
         int start(int argc, char const ** argv); ///< Called from main() to launch daemon.
                                         /**< Normally not called directly but from the
                                              \ref SENF_DAEMON_MAIN macro. */
diff --git a/senf/Utils/Daemon/Daemon.ih b/senf/Utils/Daemon/Daemon.ih
index fed8bf3..8d45a88 100644
--- a/senf/Utils/Daemon/Daemon.ih
+++ b/senf/Utils/Daemon/Daemon.ih
@@ -52,7 +52,7 @@ namespace detail {
 
     private:
 
-        class Forwarder 
+        class Forwarder
         {
         public:
             typedef boost::function Callback;
@@ -96,7 +96,7 @@ namespace detail {
             Callback cb_;
             scheduler::FdEvent readevent_;
         };
-        
+
         void pipeClosed(int id);
         void sigChld(siginfo_t const &);
         void childDied();
diff --git a/senf/Utils/Daemon/Daemon.test.cc b/senf/Utils/Daemon/Daemon.test.cc
index 09e7ee3..bea493c 100644
--- a/senf/Utils/Daemon/Daemon.test.cc
+++ b/senf/Utils/Daemon/Daemon.test.cc
@@ -56,20 +56,20 @@ namespace {
 
     class MyDaemon : public senf::Daemon
     {
-        void configure() { 
-            std::cout << "Running configure()" << std::endl; 
+        void configure() {
+            std::cout << "Running configure()" << std::endl;
             pidFile("invalid.pid");
             consoleLog("invalid.log");
             senf::Daemon::configure();
         }
 
-        void init() { 
-            std::cout << "Running init()" << std::endl; 
+        void init() {
+            std::cout << "Running init()" << std::endl;
             std::cerr << "(stderr)" << std::endl;
         }
 
         void run() {
-            std::cout << "Running run()" << std::endl; 
+            std::cout << "Running run()" << std::endl;
             delay(2000);
         }
     };
@@ -107,10 +107,10 @@ namespace {
         }
         signal(SIGCHLD, SIG_DFL);
         int status;
-        if (::waitpid(pid, &status, 0) < 0) 
+        if (::waitpid(pid, &status, 0) < 0)
             throw senf::SystemException("::waitpid()");
         if (WIFSIGNALED(status))
-            std::cerr << "Terminated with signal " 
+            std::cerr << "Terminated with signal "
                       << senf::signalName(WTERMSIG(status)) << "(" << WTERMSIG(status) << ")\n";
         else if (WIFEXITED(status))
             std::cerr << "Exited normally with exit status " << WEXITSTATUS(status) << "\n";
@@ -121,8 +121,8 @@ namespace {
 
 SENF_AUTO_UNIT_TEST(testDaemon)
 {
-    char const * args[] = { "run", 
-                            "--console-log=testDaemon.log", 
+    char const * args[] = { "run",
+                            "--console-log=testDaemon.log",
                             "--pid-file=testDaemon.pid" };
 
     SENF_CHECK_NO_THROW( BOOST_CHECK_EQUAL( run(sizeof(args)/sizeof(*args), args), 0 ) );
@@ -131,7 +131,7 @@ SENF_AUTO_UNIT_TEST(testDaemon)
     BOOST_CHECK( ! boost::filesystem::exists("invalid.pid") );
     BOOST_CHECK( boost::filesystem::exists("testDaemon.pid") );
     BOOST_REQUIRE( boost::filesystem::exists("testDaemon.log") );
-    
+
     boost::filesystem::rename("testDaemon.log", "testDaemon.log.1");
     {
         std::ifstream pidFile ("testDaemon.pid");
@@ -146,7 +146,7 @@ SENF_AUTO_UNIT_TEST(testDaemon)
     BOOST_CHECK( ! boost::filesystem::exists("testDaemon.pid") );
     BOOST_CHECK( boost::filesystem::exists("testDaemon.log") );
     BOOST_CHECK( boost::filesystem::exists("testDaemon.log.1") );
-    
+
     std::ifstream log ("testDaemon.log.1");
     std::stringstream data;
     data << log.rdbuf();
diff --git a/senf/Utils/Daemon/Mainpage.dox b/senf/Utils/Daemon/Mainpage.dox
index e73b224..6ae1bd0 100644
--- a/senf/Utils/Daemon/Mainpage.dox
+++ b/senf/Utils/Daemon/Mainpage.dox
@@ -27,7 +27,7 @@
     member functions.
     \code
     #include 
-    
+
     class MyDaemon : public senf::Daemon
     {
         void configure() {
@@ -38,7 +38,7 @@
             // here after setting default parameters
             senf::Daemon::configure();
         }
-    
+
         void init() {
             // Initialize application. Setup all necessary objects. After init()
             // has completed, the startup should not fail
@@ -65,10 +65,10 @@
     Since there are times, where separating init() and run() into two separate functions is
     difficult, instead of defining init() and run(), the member main() may be defined. This member
     must call detach() as soon as initialization is completed to detach from the foreground
-    terminal.    
+    terminal.
     \code
     #include 
-    
+
     class MyDaemon : public senf::Daemon
     {
         // 'configure()' like above. Don't implement 'init()' or 'run()' if you implement 'main()'.
@@ -97,7 +97,7 @@
     SENF_DAEMON_MAIN(MyDaemon);
     \endcode
 
-    \see 
+    \see
         \ref senf::Daemon class \n
         \ref SENF_DAEMON_MAIN() main() implementation macro
  */
diff --git a/senf/Utils/DiscardStream.cci b/senf/Utils/DiscardStream.cci
index dcdd535..cb83794 100644
--- a/senf/Utils/DiscardStream.cci
+++ b/senf/Utils/DiscardStream.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/DiscardStream.hh b/senf/Utils/DiscardStream.hh
index de4823b..5879256 100644
--- a/senf/Utils/DiscardStream.hh
+++ b/senf/Utils/DiscardStream.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/DiscardStream.test.cc b/senf/Utils/DiscardStream.test.cc
index 93dd9bc..5232932 100644
--- a/senf/Utils/DiscardStream.test.cc
+++ b/senf/Utils/DiscardStream.test.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
diff --git a/senf/Utils/Exception.cc b/senf/Utils/Exception.cc
index 1b3763c..39c132e 100644
--- a/senf/Utils/Exception.cc
+++ b/senf/Utils/Exception.cc
@@ -56,7 +56,7 @@ prefix_ void senf::ExceptionMixin::addBacktrace()
 }
 #endif
 
-/////////////////////////////////////////////////////////////////////////// 
+///////////////////////////////////////////////////////////////////////////
 // senf::Exception
 
 prefix_ senf::Exception::~Exception()
diff --git a/senf/Utils/Exception.cci b/senf/Utils/Exception.cci
index 6e61b52..f51f78a 100644
--- a/senf/Utils/Exception.cci
+++ b/senf/Utils/Exception.cci
@@ -83,7 +83,7 @@ prefix_ senf::SystemException::SystemException(int code _SENF_EXC_DEBUG_ARGS_ND)
     init("", code _SENF_EXC_DEBUG_ARGS_P);
 }
 
-prefix_ senf::SystemException::SystemException(std::string const & descr, int code 
+prefix_ senf::SystemException::SystemException(std::string const & descr, int code
                                                _SENF_EXC_DEBUG_ARGS_ND)
 {
     init(descr, code _SENF_EXC_DEBUG_ARGS_P);
@@ -105,7 +105,7 @@ prefix_ bool senf::SystemException::anyOf(int c0, int c1, int c2, int c3, int c4
                                           int c6, int c7, int c8, int c9)
     const
 {
-    return 
+    return
         (c0 && code_ == c0) ||
         (c1 && code_ == c1) ||
         (c2 && code_ == c2) ||
diff --git a/senf/Utils/Exception.hh b/senf/Utils/Exception.hh
index 1bed5ce..ffd2bb4 100644
--- a/senf/Utils/Exception.hh
+++ b/senf/Utils/Exception.hh
@@ -62,7 +62,7 @@
     use Boost.Format:
 
     \code
-    try { 
+    try {
         // ...
     }
     catch (senf::ExceptionMixin & e) {
@@ -96,7 +96,7 @@
         SENF_WRAP_EXC(std::bad_cast)
         SENF_WRAP_EXC(somelib::FooException)
     }
-    \endcode 
+    \endcode
     The re-thrown exception can then be caught as std::bad_cast or as senf::ExceptionMixin
     as needed. It is safe, to wrap an exception twice (the macro will detect this case).
     \code
@@ -147,7 +147,7 @@ namespace senf {
                                         /**< Adds \a text to the description text. */
 
     protected:
-        explicit ExceptionMixin(std::string const & description = ""); 
+        explicit ExceptionMixin(std::string const & description = "");
                                         ///< Initialize exception with string
                                         /**< \a description is the initial error description
                                              string. This should probably be a string constant
@@ -181,12 +181,12 @@ namespace senf {
         virtual char const * what() const throw();
                                         ///< get exception description and backtrace if available
                                         /**< get description of the exception (message()) and backtrace
-                                             information if SENF is compiled with \c SENF_DEBUG */ 
+                                             information if SENF is compiled with \c SENF_DEBUG */
 
     protected:
         explicit Exception(std::string const & description = "");
     };
-    
+
     /** \brief Wrapper for standard non-senf exceptions
 
         This class wraps an exception of type \a BaseException and adds functionality from
@@ -229,7 +229,7 @@ namespace senf {
                                              exception description string. This operator allows to
                                              use Exception instances like streams. The conversion is
                                              performed using boost::lexical_cast and is
-                                             therefor identical to a streaming operation. 
+                                             therefor identical to a streaming operation.
                                              \see \ref exception */
 
 
@@ -250,7 +250,7 @@ namespace senf {
 
         \code
         // Standard usage: Take \c errno from environment
-        throw senf::SystemException("::open()") 
+        throw senf::SystemException("::open()")
             << " while opening configuration file: " << filename;
 
         // You may however explicitly specify the errno value
@@ -294,13 +294,13 @@ namespace senf {
         int errorNumber() const;        ///< Error code (\c errno number)
         char const * errorString() const; ///< Error string (\c strerror() value)
 
-        bool anyOf(int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0, 
+        bool anyOf(int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0,
                    int c6=0, int c7=0, int c8=0, int c9=0) const;
                                         ///< \c true, if errorNumber() is one of \a c0 ... \a c9
 
     private:
         void init(std::string const & descr, int code _SENF_EXC_DEBUG_ARGS_ND);
-        
+
         int code_;
     };
 
@@ -330,4 +330,4 @@ namespace senf {
 // compile-command: "scons -u test"
 // comment-column: 40
 // End:
- 
+
diff --git a/senf/Utils/Format.cc b/senf/Utils/Format.cc
index 6b6e172..2e511b2 100644
--- a/senf/Utils/Format.cc
+++ b/senf/Utils/Format.cc
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -38,8 +38,8 @@
 
 namespace {
 
-    char const SIPrefix[] = { 'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 
-                              ' ', 
+    char const SIPrefix[] = { 'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm',
+                              ' ',
                               'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' };
     unsigned const SIScales = 8;
 
@@ -59,7 +59,7 @@ prefix_ std::ostream & senf::format::operator<<(std::ostream & os, eng const & v
         os.fill(v_.fill_);
 
     unsigned prec (os.precision());
-    if (prec < 4) 
+    if (prec < 4)
         prec = 4;
     unsigned w (os.width());
     char fill (os.fill());
@@ -68,7 +68,7 @@ prefix_ std::ostream & senf::format::operator<<(std::ostream & os, eng const & v
     std::ios_base::fmtflags align (flags & std::ios_base::adjustfield);
     if (! std::isnan(v_.d_))
         minw += prec+3;
-    
+
     float ref (std::fabs(v_.v_));
     float v (v_.v_);
     float d (0.0);
@@ -93,7 +93,7 @@ prefix_ std::ostream & senf::format::operator<<(std::ostream & os, eng const & v
     if (w > 0) {
         if ((align == 0 || align == std::ios_base::right || align == std::ios_base::internal))
             os << std::setw(prec+2+(w>minw ? w-minw : 0));
-        else 
+        else
             os << std::right << std::setfill(' ') << std::setw(prec+2);
     }
     else
@@ -113,7 +113,7 @@ prefix_ std::ostream & senf::format::operator<<(std::ostream & os, eng const & v
             os << SIPrefix[scale/3+SIScales];
     }
     else if ((flags & std::ios_base::showpoint) || scale != 0)
-        os << ((flags & std::ios_base::uppercase)?'E':'e') 
+        os << ((flags & std::ios_base::uppercase)?'E':'e')
            << std::showpos << std::internal << std::setw(3) << scale;
     else if (w > 0)
         os << "    ";
@@ -135,8 +135,8 @@ prefix_ std::string senf::format::detail::dumpintUnsigned(unsigned long long v,
     int bytes ((bits+7)/8);
     int digs (int(2.4*bytes)+1);
     std::stringstream ss;
-    ss << (sign ? (sign<0 ? "-" : " ") : "") 
-       << "0x" << std::setw(2*bytes) << std::setfill('0') << std::hex 
+    ss << (sign ? (sign<0 ? "-" : " ") : "")
+       << "0x" << std::setw(2*bytes) << std::setfill('0') << std::hex
        << 1u*v
        << " (" << std::setw(digs+(sign ? 1 : 0)) << std::setfill(' ') << std::dec;
     if (sign)
diff --git a/senf/Utils/Format.cci b/senf/Utils/Format.cci
index c74c184..b9cf5c5 100644
--- a/senf/Utils/Format.cci
+++ b/senf/Utils/Format.cci
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -157,26 +157,26 @@ prefix_ senf::format::eng const & senf::format::eng::right()
 // senf::format::IndentHelper
 
 prefix_ senf::format::IndentHelper::IndentHelper()
-    : instance_level(1) 
+    : instance_level(1)
 {
-    ++static_level; 
+    ++static_level;
 }
 
 prefix_ senf::format::IndentHelper::~IndentHelper()
 {
-    static_level -= instance_level; 
+    static_level -= instance_level;
 }
 
 prefix_ void senf::format::IndentHelper::increase()
 {
-    ++static_level; 
-    ++instance_level; 
+    ++static_level;
+    ++instance_level;
 }
 
-prefix_ unsigned int senf::format::IndentHelper::level() 
+prefix_ unsigned int senf::format::IndentHelper::level()
     const
-{ 
-    return static_level; 
+{
+    return static_level;
 }
 
 prefix_ std::ostream & senf::format::operator<<(std::ostream & os, senf::format::IndentHelper const & indent)
diff --git a/senf/Utils/Format.cti b/senf/Utils/Format.cti
index 7ce91f4..e70cc4a 100644
--- a/senf/Utils/Format.cti
+++ b/senf/Utils/Format.cti
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -31,9 +31,9 @@
 ///////////////////////////////cti.p///////////////////////////////////////
 
 template 
-prefix_ std::string 
+prefix_ std::string
 senf::format::dumpint(T const & v, typename boost::enable_if >::type *)
-{ 
+{
    return detail::dumpintSigned(v, std::numeric_limits::digits);
 }
 
@@ -41,13 +41,13 @@ template 
 prefix_ std::string
 senf::format::dumpint(T const & v, typename boost::enable_if >::type *)
 {
-   return detail::dumpintUnsigned(v, std::numeric_limits::digits); 
+   return detail::dumpintUnsigned(v, std::numeric_limits::digits);
 }
 
 template 
-prefix_ std::string 
+prefix_ std::string
 senf::format::dumpint(T const & v, typename boost::enable_if >::type *)
-{ 
+{
    return detail::dumpintSigned(v.value(), std::numeric_limits::digits);
 }
 
@@ -55,7 +55,7 @@ template 
 prefix_ std::string
 senf::format::dumpint(T const & v, typename boost::enable_if >::type *)
 {
-   return detail::dumpintUnsigned(v.value(), std::numeric_limits::digits); 
+   return detail::dumpintUnsigned(v.value(), std::numeric_limits::digits);
 }
 
 ///////////////////////////////cti.e///////////////////////////////////////
diff --git a/senf/Utils/Format.hh b/senf/Utils/Format.hh
index f21ff05..502a4dd 100644
--- a/senf/Utils/Format.hh
+++ b/senf/Utils/Format.hh
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2009 
+// Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund 
@@ -80,7 +80,7 @@ namespace format {
         \par \c std::\c showpoint, \c std::\c noshowpoint
             If the \c showpoint flag is set, the exponent will be output even if it is 0. Otherwise,
             if \c width is set, the exponent will be replaced with 4 blanks.
-        
+
         \par \c std::\c uppercase, \c std::\c nouppercase
             If the \c uppercase flag is set, the exponent letter will be an uppercase 'E' instead of
             'e'. SI prefixes are \e not uppercased, since some SI prefixes differ only in case.
@@ -104,7 +104,7 @@ namespace format {
         os << std::setw(1) << senf::format::eng(1.23);
           -> "   1.230    "
 
-        os << std::setw(25) << std::setprecision(5) << std::showpos << std::uppercase 
+        os << std::setw(25) << std::setprecision(5) << std::showpos << std::uppercase
            << std::internal << senf::format::eng(12345,67);
           -> "+       12.35+-000.07E+03"
 
@@ -114,7 +114,7 @@ namespace format {
         senf::str(senf::format::eng(12.345,67).setw().setprecision(5).showpoint().uppercase())
           -> "  12.35+-67.00E+00"
         \endcode
-        
+
         \param[in] v value
         \param[in] d optional delta
 
@@ -148,7 +148,7 @@ namespace format {
     private:
         float v_;
         float d_;
-        
+
         mutable bool haveWidth_;
         mutable unsigned width_;
         mutable bool havePrecision_;
@@ -184,29 +184,29 @@ namespace format {
     template 
     streamable_type dumpint(T const & v);
 
-#else 
+#else
 
-    template  
-    std::string dumpint(T const & v, 
+    template 
+    std::string dumpint(T const & v,
                         typename boost::enable_if >::type * = 0);
 
-    template  
-    std::string dumpint(T const & v, 
+    template 
+    std::string dumpint(T const & v,
                         typename boost::enable_if >::type * = 0);
-    
-    template  
-    std::string dumpint(T const & v, 
+
+    template 
+    std::string dumpint(T const & v,
                         typename boost::enable_if >::type * = 0);
 
-    template  
-    std::string dumpint(T const & v, 
+    template 
+    std::string dumpint(T const & v,
                         typename boost::enable_if >::type * = 0);
 
 #endif
-    
+
     /** \brief Helper class to easily achieve indent levels
-       
-        This class helps to achieve indent levels across function calls. Every instance 
+
+        This class helps to achieve indent levels across function calls. Every instance
         increases the static indent level. On destruction the level is decreased to the level
         before the instance.
         The following example illustrates the use of this class:
@@ -222,16 +222,16 @@ namespace format {
                 std::cout << indent << "f2 end\n";
             }
             f2()
-        \endcode 
+        \endcode
         Output:
         
             f2 begin
               f1
             f2 end
         
- Here f1() and f2() don't need to know to current indent level, + Here f1() and f2() don't need to know to current indent level, they just increase the level by instantiating IndentHelper. - + \ingroup senf_utils_format */ class IndentHelper @@ -239,7 +239,7 @@ namespace format { static unsigned int static_level; unsigned int instance_level; public: - + IndentHelper(); ///< Construct new IndentHelper instance /**< The static indent level is increased by one. */ ~IndentHelper(); ///< Destruct IndentHelper instance @@ -249,7 +249,7 @@ namespace format { /**< The indent level of the instance is increases by one. */ unsigned int level() const; ///< return the current indent level }; - + /** \brief Output indent to given ostream \related IndentHelper */ diff --git a/senf/Utils/Format.ih b/senf/Utils/Format.ih index 0a4a709..fb889a4 100644 --- a/senf/Utils/Format.ih +++ b/senf/Utils/Format.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Format.test.cc b/senf/Utils/Format.test.cc index 8dd4bae..3db080f 100644 --- a/senf/Utils/Format.test.cc +++ b/senf/Utils/Format.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -86,9 +86,9 @@ SENF_AUTO_UNIT_TEST(formatEng) CheckFormat( (1.345e-3, 3.456), "0.0+-3.5" ); # undef CheckFormat - + // From documentation - + { std::stringstream ss; ss << senf::format::eng(1.23); @@ -103,7 +103,7 @@ SENF_AUTO_UNIT_TEST(formatEng) { std::stringstream ss; - ss << std::setw(25) << std::setprecision(5) << std::showpos << std::uppercase + ss << std::setw(25) << std::setprecision(5) << std::showpos << std::uppercase << std::internal << senf::format::eng(12345,67); BOOST_CHECK_EQUAL( ss.str(), "+ 12.35+-000.07E+03" ); } @@ -135,7 +135,7 @@ SENF_AUTO_UNIT_TEST(formatEng) SENF_AUTO_UNIT_TEST(dumpint) { std::stringstream ss; - + # define CheckFormat(v,s) \ { \ ss.str(""); \ @@ -167,7 +167,7 @@ SENF_AUTO_UNIT_TEST(indent) { std::stringstream ss; f2(ss); - BOOST_CHECK_EQUAL( ss.str(), + BOOST_CHECK_EQUAL( ss.str(), " f2_1\n" " f1\n" " f2_2\n" diff --git a/senf/Utils/IgnoreValue.cti b/senf/Utils/IgnoreValue.cti index 1af4336..ccfa45e 100644 --- a/senf/Utils/IgnoreValue.cti +++ b/senf/Utils/IgnoreValue.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2010 +// Copyright (C) 2010 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/IgnoreValue.hh b/senf/Utils/IgnoreValue.hh index 8db6a75..061193d 100644 --- a/senf/Utils/IgnoreValue.hh +++ b/senf/Utils/IgnoreValue.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2010 +// Copyright (C) 2010 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/IpChecksum.hh b/senf/Utils/IpChecksum.hh index a8ea1ff..96d4902 100644 --- a/senf/Utils/IpChecksum.hh +++ b/senf/Utils/IpChecksum.hh @@ -33,7 +33,7 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - + /** \brief Calculate TCP/IP 16bit checksum value This class allows calculation of the 16bit checksum value as defined in the TCP/IP v4 @@ -68,7 +68,7 @@ namespace senf { ///< Feed range of bytes boost::uint16_t sum() const; ///< Calculate checksum - + protected: private: @@ -76,7 +76,7 @@ namespace senf { bool odd_; }; - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Utils/IteratorTraits.hh b/senf/Utils/IteratorTraits.hh index bb2fa5a..e044a74 100644 --- a/senf/Utils/IteratorTraits.hh +++ b/senf/Utils/IteratorTraits.hh @@ -54,7 +54,7 @@ namespace senf { } template - void do(Iterator i, boost::true_type) + void do(Iterator i, boost::true_type) { typename Iterator::pointer p (senf::storage_iterator(i)); // Manipulate the container by manipulating the data pointed at via 'p' @@ -71,7 +71,7 @@ namespace senf { Thie \ref senf::storage_iterator helper function will convert an iterator to a pointer to the same element the iterator is referencing. - + This trait will return \c true for pointers. Additonally it should be configured to return true for all standard containers which obey above implementation restrictions. This typically includes \c std::vector and \c std::basic_string. @@ -95,7 +95,7 @@ namespace senf { {}; /** \brief Convert contiguous storage iterator to pointer - + storage_iterator will convert a contiguous storage iterator into a pointer to the same element in the container. This allows to directly access the containers storage. @@ -104,7 +104,7 @@ namespace senf { */ template typename std::iterator_traits::pointer storage_iterator(Iterator i); - + } ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Utils/IteratorTraits.ih b/senf/Utils/IteratorTraits.ih index 20e2476..a536042 100644 --- a/senf/Utils/IteratorTraits.ih +++ b/senf/Utils/IteratorTraits.ih @@ -44,7 +44,7 @@ namespace senf { {}; template - struct contiguous_storage_iterator< + struct contiguous_storage_iterator< ::__gnu_cxx::__normal_iterator > > : public boost::true_type {}; diff --git a/senf/Utils/Logger/AreaRegistry.cc b/senf/Utils/Logger/AreaRegistry.cc index 11bec47..22f4291 100644 --- a/senf/Utils/Logger/AreaRegistry.cc +++ b/senf/Utils/Logger/AreaRegistry.cc @@ -63,7 +63,7 @@ prefix_ void senf::log::detail::AreaBase::updateRoutingCache(Target & target, if (i->limit < l) l = i->limit; } - if (i == i_end) + if (i == i_end) routingCache_[stream.index].routes.push_back(RouteEntry(limit, &target)); else for (; i != i_end; ++i) diff --git a/senf/Utils/Logger/AreaRegistry.cci b/senf/Utils/Logger/AreaRegistry.cci index d748687..85380a2 100644 --- a/senf/Utils/Logger/AreaRegistry.cci +++ b/senf/Utils/Logger/AreaRegistry.cci @@ -97,7 +97,7 @@ prefix_ bool senf::log::detail::AreaBase::alive() prefix_ unsigned senf::log::detail::AreaBase::limit(StreamBase const & stream) const { - return stream.index >= routingCache_.size() ? + return stream.index >= routingCache_.size() ? DISABLED::value : routingCache_[stream.index].limit; } diff --git a/senf/Utils/Logger/AreaRegistry.hh b/senf/Utils/Logger/AreaRegistry.hh index 89b23e6..f6c49a6 100644 --- a/senf/Utils/Logger/AreaRegistry.hh +++ b/senf/Utils/Logger/AreaRegistry.hh @@ -37,13 +37,13 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { -namespace log { +namespace log { namespace detail { struct AreaBase; } - /** \brief Area registry - - The area registry keeps track of all areas defined. + /** \brief Area registry + + The area registry keeps track of all areas defined. The area registry exposes a forward sequence interface which allows to query the list of all registered areas. @@ -56,7 +56,7 @@ namespace log { { typedef std::map Registry; - struct SelectName + struct SelectName { typedef std::string result_type; std::string const & operator()(Registry::value_type const & v) const; @@ -89,8 +89,8 @@ namespace log { friend class senf::singleton; friend class detail::AreaBase; friend class Target; - }; - + }; + }} ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Utils/Logger/AreaRegistry.ih b/senf/Utils/Logger/AreaRegistry.ih index d5cd809..477ff25 100644 --- a/senf/Utils/Logger/AreaRegistry.ih +++ b/senf/Utils/Logger/AreaRegistry.ih @@ -49,7 +49,7 @@ namespace detail { { AreaBase(); virtual ~AreaBase(); - + std::string fullName() const; virtual std::string v_name() const; @@ -57,8 +57,8 @@ namespace detail { bool alive() const; unsigned limit(StreamBase const & stream) const; - void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const; - void removeRoutingCache(Target & target, StreamBase const & stream) const; + void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const; + void removeRoutingCache(Target & target, StreamBase const & stream) const; void write(time_type timestamp, StreamBase const & stream, unsigned level, std::string const & msg) const; diff --git a/senf/Utils/Logger/AreaRegistry.test.cc b/senf/Utils/Logger/AreaRegistry.test.cc index d49f7cb..d7b8dbf 100644 --- a/senf/Utils/Logger/AreaRegistry.test.cc +++ b/senf/Utils/Logger/AreaRegistry.test.cc @@ -39,10 +39,10 @@ SENF_AUTO_UNIT_TEST(areaRegistry) { BOOST_CHECK( true ); #if 0 - // Need to rewrite this test ... + // Need to rewrite this test ... char const * areas[] = { "GlobalTestArea", - "senf::log::DefaultArea", - "senf::log::test::Foo", + "senf::log::DefaultArea", + "senf::log::test::Foo", "senf::log::test::myArea" }; BOOST_CHECK_EQUAL_COLLECTIONS( senf::log::AreaRegistry::instance().begin(), diff --git a/senf/Utils/Logger/Config.hh b/senf/Utils/Logger/Config.hh index 9f0f735..ccd8ba4 100644 --- a/senf/Utils/Logger/Config.hh +++ b/senf/Utils/Logger/Config.hh @@ -77,7 +77,7 @@
All the entries specified via \c SENF_LOG_CONF are applied in a fixed order: - + \li First the entries which have both a stream and an area specified are checked \li next all entries with area but no stream given are checked \li followed by all entries with a given stream but no area @@ -105,7 +105,7 @@ consoleLog.route(); fileLog.route(); - \endcode + \endcode Here we see an already relatively complex setup: All debug messages (that is, those, which are not disabled at compile time) are routed to the console. We also route important transactions to the console \e except transactions from the \c foo::SomeClass area. The \c fileLog simply @@ -119,13 +119,13 @@ enabled \e explicitly by setting \c SENF_LOG_CONF so they can be routed. \section config_fallback Fallback routing - + There are two cases, where this setup may lead to inadvertently lost log messages: \li When using a library which does internally use the Logger but not initializing the logger in your application. \li When log messages are created during initialization of static objects. Since no route is set up in these cases, the messages will be dropped. - + To counter this problem, the logger is initially in fallback routing state. If any log message arrives in this state, the message will be logged to the console if it is above the default runtime limit of it's stream. The first routing statement on any target will take the @@ -175,7 +175,7 @@ namespace log {
\c cd \e pathChange current directory
\c ls [ \e path ]List contents of \e path or current directory
name ::= arbitrary C++ identifier
- \ref SENF_LOG_CONF is a Boost.Preprocessor style sequence of 3-tuples. + \ref SENF_LOG_CONF is a Boost.Preprocessor style sequence of 3-tuples. The first tuple element \e optional_stream specifies the stream to match. If this is (_), the entry will match any stream. @@ -195,13 +195,13 @@ namespace log { # endif /** \brief Check, if logging is enabled for stream/area/level tuple - + This is a template meta-function which will check, whether logging to the given combination of parameters \a Stream, \a Area and \a Level is compile-time enabled. The logging might still be disabled at runtime. \code - if (senf::log::Enabled::value) { // ... } diff --git a/senf/Utils/Logger/Config.test.cc b/senf/Utils/Logger/Config.test.cc index 2bda862..f5abd00 100644 --- a/senf/Utils/Logger/Config.test.cc +++ b/senf/Utils/Logger/Config.test.cc @@ -37,21 +37,21 @@ SENF_AUTO_UNIT_TEST(logConfig) { - BOOST_CHECK(( senf::log::Enabled< senf::log::Debug, - senf::log::DefaultArea, + BOOST_CHECK(( senf::log::Enabled< senf::log::Debug, + senf::log::DefaultArea, senf::log::NOTICE >::value )); - BOOST_CHECK(( ! senf::log::Enabled< senf::log::Debug, - senf::log::DefaultArea, + BOOST_CHECK(( ! senf::log::Enabled< senf::log::Debug, + senf::log::DefaultArea, senf::log::VERBOSE >::value )); - BOOST_CHECK(( ! senf::log::Enabled< senf::log::test::myStream, - senf::log::DefaultArea, + BOOST_CHECK(( ! senf::log::Enabled< senf::log::test::myStream, + senf::log::DefaultArea, senf::log::VERBOSE >::value )); - BOOST_CHECK(( senf::log::Enabled< senf::log::test::myStream, - senf::log::test::Foo, + BOOST_CHECK(( senf::log::Enabled< senf::log::test::myStream, + senf::log::test::Foo, senf::log::VERBOSE >::value )); } diff --git a/senf/Utils/Logger/ConsoleTarget.hh b/senf/Utils/Logger/ConsoleTarget.hh index b83b4dd..1d94c3d 100644 --- a/senf/Utils/Logger/ConsoleTarget.hh +++ b/senf/Utils/Logger/ConsoleTarget.hh @@ -32,7 +32,7 @@ //#include "ConsoleTarget.mpp" ///////////////////////////////hh.p//////////////////////////////////////// -namespace senf { +namespace senf { namespace log { /** \brief Write %log messages to std::cout @@ -53,7 +53,7 @@ namespace log { /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ - + static ConsoleTarget & instance(); ///@} diff --git a/senf/Utils/Logger/FileTarget.cc b/senf/Utils/Logger/FileTarget.cc index 33d64e2..50cf375 100644 --- a/senf/Utils/Logger/FileTarget.cc +++ b/senf/Utils/Logger/FileTarget.cc @@ -36,7 +36,7 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - + std::string getNodename(std::string const & filename, std::string const & nodename) { if (! nodename.empty()) @@ -48,8 +48,8 @@ namespace { prefix_ senf::log::FileTarget::FileTarget(std::string const & filename, std::string const & nodename) - : ofstream_t (filename.c_str(), std::ofstream::app), - IOStreamTarget (getNodename(filename, nodename), ofstream_t::member), + : ofstream_t (filename.c_str(), std::ofstream::app), + IOStreamTarget (getNodename(filename, nodename), ofstream_t::member), file_ (filename) { namespace fty = senf::console::factory; @@ -61,7 +61,7 @@ prefix_ senf::log::FileTarget::FileTarget(std::string const & filename, fty::Command(SENF_MEMBINDFNP(void, FileTarget, reopen, ())) .doc("Reopen logfile") ); consoleDir() - .add("reopen", + .add("reopen", fty::Command(SENF_MEMBINDFNP(void, FileTarget, reopen, (std::string const &))) .arg("filename","new filename") .overloadDoc("Reopen logfile under new name") ); @@ -118,7 +118,7 @@ prefix_ senf::log::FileTarget::RegisterConsole::RegisterConsole() } prefix_ boost::shared_ptr -senf::log::FileTarget::RegisterConsole::create(std::string const & filename, +senf::log::FileTarget::RegisterConsole::create(std::string const & filename, std::string const & nodename) { std::auto_ptr tp (new FileTarget(filename, nodename)); diff --git a/senf/Utils/Logger/FileTarget.hh b/senf/Utils/Logger/FileTarget.hh index 5a80a7a..505cdc6 100644 --- a/senf/Utils/Logger/FileTarget.hh +++ b/senf/Utils/Logger/FileTarget.hh @@ -48,7 +48,7 @@ namespace log { \code senf::log::FileTarget target ("file.name"); - + // Route all messages to this file. target.route(); \endcode @@ -58,7 +58,7 @@ namespace log { \ingroup targets */ - class FileTarget + class FileTarget : private boost::base_from_member, public IOStreamTarget { @@ -69,7 +69,7 @@ namespace log { ///\name Structors and default members ///@{ - explicit FileTarget(std::string const & filename, std::string const & nodename = ""); + explicit FileTarget(std::string const & filename, std::string const & nodename = ""); ///< Construct FileTarget writing to \a file ///@} diff --git a/senf/Utils/Logger/FileTarget.test.cc b/senf/Utils/Logger/FileTarget.test.cc index 5606648..be4c63d 100644 --- a/senf/Utils/Logger/FileTarget.test.cc +++ b/senf/Utils/Logger/FileTarget.test.cc @@ -62,11 +62,11 @@ SENF_AUTO_UNIT_TEST(fileTarget) BOOST_CHECK_EQUAL( std::string(buffer), message); SENF_CHECK_NO_THROW( boost::filesystem::remove(filename) ); - + target.reopen(); BOOST_REQUIRE( boost::filesystem::exists(filename)); SENF_CHECK_NO_THROW( boost::filesystem::remove(filename) ); - + filename = std::string("/tmp/senf_fileTarget_test2.log"); target.reopen( filename); BOOST_REQUIRE( boost::filesystem::exists(filename)); diff --git a/senf/Utils/Logger/IOStreamTarget.cci b/senf/Utils/Logger/IOStreamTarget.cci index c5e1a80..6b61f2c 100644 --- a/senf/Utils/Logger/IOStreamTarget.cci +++ b/senf/Utils/Logger/IOStreamTarget.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/IOStreamTarget.hh b/senf/Utils/Logger/IOStreamTarget.hh index 229ab63..ff66dff 100644 --- a/senf/Utils/Logger/IOStreamTarget.hh +++ b/senf/Utils/Logger/IOStreamTarget.hh @@ -44,9 +44,9 @@ namespace log { \verbatim [][] \endverbatim The \e area will be omitted if it is \c senf::log::DefaultArea. - + \warning The class keeps a reference to the passed stream. - + \ingroup targets */ class IOStreamTarget @@ -68,10 +68,10 @@ namespace log { using detail::LogFormat::showArea; using detail::LogFormat::timeFormat; using detail::LogFormat::tag; - + protected: - void v_write(time_type timestamp, std::string const & stream, - std::string const & area, unsigned level, + void v_write(time_type timestamp, std::string const & stream, + std::string const & area, unsigned level, std::string const & message); private: diff --git a/senf/Utils/Logger/Levels.hh b/senf/Utils/Logger/Levels.hh index e390f44..35b58bd 100644 --- a/senf/Utils/Logger/Levels.hh +++ b/senf/Utils/Logger/Levels.hh @@ -36,7 +36,7 @@ namespace senf { namespace log { /** \defgroup loglevels Log levels - + These are the valid %log levels with some additional special values:
VERBOSE
Really verbose %log messages. Messages at this level are used for @@ -54,13 +54,13 @@ namespace log {
CRITICAL
Error condition which does not terminate the program completely but has non-reversible adverse effects
- +
FATAL
Error condition which does terminate program execution or enforces a restart or some kind of re-initialization with loss of state and context.
There are also some special values which must not be used as a %log level: - -
DISABLED
Disable all %log messages.
+ +
DISABLED
Disable all %log messages.
NONE
Special value which signifies inheritance of the default %log level.
@@ -74,7 +74,7 @@ namespace log { */ ///\{ - + /** \brief Log level %VERBOSE \see loglevels */ struct VERBOSE : public detail::LevelBase { static unsigned const value = 1; }; @@ -108,7 +108,7 @@ namespace log { struct NONE : public detail::LevelBase { static unsigned const value = 0; }; ///\} - + static char const * const LEVELNAMES[8] = { "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" }; diff --git a/senf/Utils/Logger/Levels.ih b/senf/Utils/Logger/Levels.ih index 92989eb..4d04452 100644 --- a/senf/Utils/Logger/Levels.ih +++ b/senf/Utils/Logger/Levels.ih @@ -33,7 +33,7 @@ namespace senf { namespace log { namespace detail { - + /// Internal: Log level base class struct LevelBase {}; diff --git a/senf/Utils/Logger/Log.hh b/senf/Utils/Logger/Log.hh index da88f1d..53e7ba5 100644 --- a/senf/Utils/Logger/Log.hh +++ b/senf/Utils/Logger/Log.hh @@ -49,12 +49,12 @@ SENF_LOG( (senf::log::Debug)(senf::log::NOTICE)(FroblizerArea)("The log message") ); \endcode - The argument is comprised of a sequence of parameters and the %log message itself. + The argument is comprised of a sequence of parameters and the %log message itself. The parameters are - the %log stream, - the %log area, - the %log level. - + These parameters are optional and may be specified in arbitrary order (with the %log message always being the last sequence element) and even multiple times in the parameter sequence. If some argument type occurs multiple times, the last occurrence wins. If any one of @@ -71,7 +71,7 @@ The %log level senf::log::NONE is special. If the %log level is set to this value, the %log level will be set from the stream provided default value. - + All these parameters must be compile time constants (they are all types, so it's difficult for them to be something else). diff --git a/senf/Utils/Logger/Log.ih b/senf/Utils/Logger/Log.ih index 0d3f030..d5d633c 100644 --- a/senf/Utils/Logger/Log.ih +++ b/senf/Utils/Logger/Log.ih @@ -41,7 +41,7 @@ SENFLogParameters::area, \ SENFLogParameters::level >(log.str()); \ } \ - } while(0) + } while(0) #define SENF_LOG_BLOCK_TPL_(parameters, block) \ do { \ @@ -53,7 +53,7 @@ typename SENFLogParameters::area, \ typename SENFLogParameters::level>(log.str()); \ } \ - } while(0) + } while(0) ///////////////////////////////ih.e//////////////////////////////////////// #endif diff --git a/senf/Utils/Logger/Log.test.cc b/senf/Utils/Logger/Log.test.cc index a9b80ba..ba1d448 100644 --- a/senf/Utils/Logger/Log.test.cc +++ b/senf/Utils/Logger/Log.test.cc @@ -42,7 +42,7 @@ SENF_AUTO_UNIT_TEST(logger) target.route(); // We cannot easily check the exact log string since that includes the current date/time - + SENF_LOG_DEFAULT_STREAM(senf::log::Debug); SENF_LOG_DEFAULT_AREA(senf::log::DefaultArea); SENF_LOG_DEFAULT_LEVEL(senf::log::VERBOSE); @@ -54,7 +54,7 @@ SENF_AUTO_UNIT_TEST(logger) SENF_LOG((senf::log::VERBOSE)("Log message 2")); BOOST_CHECK( target.str().empty() ); target.clear(); - + SENF_LOG((senf::log::IMPORTANT)("Important message")); std::cerr << target.str(); BOOST_CHECK( ! target.str().empty() ); diff --git a/senf/Utils/Logger/LogFormat.cc b/senf/Utils/Logger/LogFormat.cc index f77ca72..cd8afc2 100644 --- a/senf/Utils/Logger/LogFormat.cc +++ b/senf/Utils/Logger/LogFormat.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -130,7 +130,7 @@ prefix_ std::string senf::log::detail::LogFormat::prefix(time_type timestamp, << std::setfill('0') << std::setw(9) << (delta % 1000000000ll); } - else + else datestream_ << senf::ClockService::abstime(timestamp); datestream_ << ' '; } diff --git a/senf/Utils/Logger/LogFormat.cci b/senf/Utils/Logger/LogFormat.cci index 7d9c083..45f596f 100644 --- a/senf/Utils/Logger/LogFormat.cci +++ b/senf/Utils/Logger/LogFormat.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/LogFormat.hh b/senf/Utils/Logger/LogFormat.hh index 96bd3fa..b74cb8c 100644 --- a/senf/Utils/Logger/LogFormat.hh +++ b/senf/Utils/Logger/LogFormat.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -66,7 +66,7 @@ namespace detail { void tag(std::string const & tag); ///< Set tag (log line prefix) protected: - std::string prefix(time_type timestamp, std::string const & stream, + std::string prefix(time_type timestamp, std::string const & stream, std::string const & area, unsigned level); bool isPlainFormat() const; void consoleFormat(std::ostream & os); diff --git a/senf/Utils/Logger/Mainpage.dox b/senf/Utils/Logger/Mainpage.dox index 7a5509d..35c8651 100644 --- a/senf/Utils/Logger/Mainpage.dox +++ b/senf/Utils/Logger/Mainpage.dox @@ -63,8 +63,8 @@ disabled at compile time. senf::log::VERBOSE message will therefore only appear, if you explictly enable the messages for the area in question using (here for the area some::Area) -
 
-        g++ ... -DSENF_LOG_CONF="(( (senf)(log)(Debug), (some)(Area), VERBOSE ))" 
+        
+        g++ ... -DSENF_LOG_CONF="(( (senf)(log)(Debug), (some)(Area), VERBOSE ))"
         
in addition to routing the messages at runtime. For more, see \ref config. @@ -72,7 +72,7 @@ any number of \e targets. A \e target receives messages and using it's routing information decides, wether the message is output or not. A message may be routed to multiple targets simultaneously or may not be output by any target at all. (see: \ref targets) - + \section logging_tutorial Tutorial introduction Using the logging library mostly concerns using \ref SENF_LOG statements in your code. There are @@ -81,7 +81,7 @@ \code namespace foo { - // Define a new log stream with default level, runtime limit and compile time limit + // Define a new log stream with default level, runtime limit and compile time limit // set to senf::log::MESSAGE SENF_LOG_DEFINE_STREAM( UserLog, senf::log::MESSAGE, senf::log::MESSAGE, senf::log::MESSAGE ); @@ -140,7 +140,7 @@ design goals \li Flexible configuration at compile and runtime \li Concise usage and simple interface - \li Zero overhead for compile-time disabled log messages + \li Zero overhead for compile-time disabled log messages I did not find any non-mcaro implementation which was not either completely convoluted, unusable or slow. So I turned to a macro based implementation which can provide all the diff --git a/senf/Utils/Logger/Parameters.ih b/senf/Utils/Logger/Parameters.ih index 98d00c0..7abeada 100644 --- a/senf/Utils/Logger/Parameters.ih +++ b/senf/Utils/Logger/Parameters.ih @@ -44,7 +44,7 @@ namespace senf { namespace log { - + class DefaultArea; class Debug; class NONE; @@ -84,7 +84,7 @@ namespace detail { senf::mpl::rv<5> Parameters_select_(AliasBase *); template - struct Parameters_ + struct Parameters_ : public Param::template apply::type {}; @@ -92,7 +92,7 @@ namespace detail { // this name is created by SENF_LOG_CLASS_AREA() template senf::mpl::rv<6> Parameters_select_( - T *, + T *, typename boost::disable_if< boost::is_convertible >::type * = 0, typename boost::disable_if< boost::is_convertible >::type * = 0, typename boost::disable_if< boost::is_convertible >::type * = 0, @@ -107,16 +107,16 @@ namespace detail { template struct Parameters : public Base { - typedef typename boost::mpl::if_c< Base::level::value == NONE::value, - typename Base::stream::defaultLevel, + typedef typename boost::mpl::if_c< Base::level::value == NONE::value, + typename Base::stream::defaultLevel, typename Base::level >::type level; static bool const compileEnabled = senf::log::Enabled< - typename Base::stream, - typename Base::area_base, + typename Base::stream, + typename Base::area_base, level>::value; - static bool enabled() { + static bool enabled() { return compileEnabled && ( senf::log::detail::TargetRegistry::instance().fallbackRouting() || Base::area::instance().limit(Base::stream::instance()) <= level::value ); @@ -133,8 +133,8 @@ namespace detail { template struct apply { typedef Parameters_< - Base, - Param, + Base, + Param, SENF_MPL_RV(Parameters_select_(static_cast(0)))> type; }; }; diff --git a/senf/Utils/Logger/StreamRegistry.cci b/senf/Utils/Logger/StreamRegistry.cci index cace8a1..4b19deb 100644 --- a/senf/Utils/Logger/StreamRegistry.cci +++ b/senf/Utils/Logger/StreamRegistry.cci @@ -39,7 +39,7 @@ prefix_ senf::log::StreamRegistry::StreamRegistry() prefix_ senf::log::StreamRegistry::iterator senf::log::StreamRegistry::begin() { - return boost::make_transform_iterator(registry_.begin(), + return boost::make_transform_iterator(registry_.begin(), ::__gnu_cxx::select1st()); } diff --git a/senf/Utils/Logger/StreamRegistry.hh b/senf/Utils/Logger/StreamRegistry.hh index 8821e3a..3d14804 100644 --- a/senf/Utils/Logger/StreamRegistry.hh +++ b/senf/Utils/Logger/StreamRegistry.hh @@ -43,21 +43,21 @@ namespace log { namespace detail { struct StreamBase; } - /** \brief Stream registry - + /** \brief Stream registry + The stream registry keeps track of all streams defined. stream classes are defined as singletons and will automatically register with this registry. The stream registry exposes a forward sequence interface which is a sequence of the names of all registered streams. */ - class StreamRegistry + class StreamRegistry : public senf::singleton { typedef std::map Registry; public: - typedef boost::transform_iterator< ::__gnu_cxx::select1st, + typedef boost::transform_iterator< ::__gnu_cxx::select1st, Registry::const_iterator > iterator; # ifdef DOXYGEN diff --git a/senf/Utils/Logger/StreamRegistry.ih b/senf/Utils/Logger/StreamRegistry.ih index 4216553..91cba86 100644 --- a/senf/Utils/Logger/StreamRegistry.ih +++ b/senf/Utils/Logger/StreamRegistry.ih @@ -36,11 +36,11 @@ namespace log { namespace detail { /// Internal: Log stream base class - struct StreamBase + struct StreamBase { StreamBase(); virtual ~StreamBase(); - + std::string fullName() const; virtual std::string v_name() const; virtual unsigned defaultRuntimeLimit() const = 0; diff --git a/senf/Utils/Logger/StreamRegistry.test.cc b/senf/Utils/Logger/StreamRegistry.test.cc index eba72e8..acb9fb5 100644 --- a/senf/Utils/Logger/StreamRegistry.test.cc +++ b/senf/Utils/Logger/StreamRegistry.test.cc @@ -37,7 +37,7 @@ SENF_AUTO_UNIT_TEST(streamRegistry) { - char const * streams[] = + char const * streams[] = { "senf::SenfLog", "senf::log::Debug", "senf::log::test::myStream" }; BOOST_CHECK_EQUAL_COLLECTIONS( senf::log::StreamRegistry::instance().begin(), diff --git a/senf/Utils/Logger/StringTarget.hh b/senf/Utils/Logger/StringTarget.hh index a8bc5a2..78c620c 100644 --- a/senf/Utils/Logger/StringTarget.hh +++ b/senf/Utils/Logger/StringTarget.hh @@ -35,14 +35,14 @@ namespace senf { namespace log { - + /** \brief Store %log messages in a string buffer - This target is mostly useful for debug purposes. + This target is mostly useful for debug purposes. \ingroup targets */ - class StringTarget + class StringTarget : private boost::base_from_member, public IOStreamTarget { @@ -69,7 +69,7 @@ namespace log { }; -}} +}} ///////////////////////////////hh.e//////////////////////////////////////// //#include "StringTarget.cci" diff --git a/senf/Utils/Logger/SyslogTarget.cc b/senf/Utils/Logger/SyslogTarget.cc index 6aeec08..bbd22a4 100644 --- a/senf/Utils/Logger/SyslogTarget.cc +++ b/senf/Utils/Logger/SyslogTarget.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/SyslogTarget.cci b/senf/Utils/Logger/SyslogTarget.cci index f9c6271..5f3ed0d 100644 --- a/senf/Utils/Logger/SyslogTarget.cci +++ b/senf/Utils/Logger/SyslogTarget.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/SyslogTarget.hh b/senf/Utils/Logger/SyslogTarget.hh index eeebbb9..76508d9 100644 --- a/senf/Utils/Logger/SyslogTarget.hh +++ b/senf/Utils/Logger/SyslogTarget.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -39,7 +39,7 @@ namespace senf { namespace console { class DirectoryNode; } namespace log { - + /** \brief Log target writing to the syslog The SyslogTarget will send all log messages to the syslog at the given facility. @@ -52,7 +52,7 @@ namespace log { \endcode Valid facility values (taken from man 3 syslog): - \par "" + \par "" LOG_AUTHPRIV, LOG_CRON, LOG_DAEMON, LOG_FTP, LOG_KERN, LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, @@ -74,7 +74,7 @@ namespace log { \ingroup targets */ - class SyslogTarget + class SyslogTarget : public Target { public: @@ -88,16 +88,16 @@ namespace log { /////////////////////////////////////////////////////////////////////////// private: - void v_write(time_type timestamp, std::string const & stream, - std::string const & area, unsigned level, + void v_write(time_type timestamp, std::string const & stream, + std::string const & area, unsigned level, std::string const & message); int facility_; public: static int const LEVELMAP[8]; - - enum LogFacility { + + enum LogFacility { AUTHPRIV = LOG_AUTHPRIV, CRON = LOG_CRON, DAEMON = LOG_DAEMON, diff --git a/senf/Utils/Logger/SyslogTarget.test.cc b/senf/Utils/Logger/SyslogTarget.test.cc index 4ae4535..a838682 100644 --- a/senf/Utils/Logger/SyslogTarget.test.cc +++ b/senf/Utils/Logger/SyslogTarget.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -38,7 +38,7 @@ SENF_AUTO_UNIT_TEST(syslogTarget) { senf::log::SyslogTarget syslog; - + syslog.route(); BOOST_WARN_MESSAGE( false, "Check the system log for the test message" ); SENF_LOG(("SENF syslog test message")); diff --git a/senf/Utils/Logger/SyslogUDPTarget.cc b/senf/Utils/Logger/SyslogUDPTarget.cc index 28eccd0..1c2533a 100644 --- a/senf/Utils/Logger/SyslogUDPTarget.cc +++ b/senf/Utils/Logger/SyslogUDPTarget.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -82,7 +82,7 @@ prefix_ void senf::log::SyslogUDPTarget::v_write(time_type timestamp, std::strin std::string line; unsigned sz (896-prf.size()); - for (; i != i_end; ++i) + for (; i != i_end; ++i) for (unsigned j (0); j < i->size(); j += sz) { line = prf; line += std::string(*i, j, sz); @@ -112,8 +112,8 @@ prefix_ senf::log::SyslogUDPTarget::RegisterConsole::RegisterConsole() namespace fty = senf::console::factory; detail::TargetRegistry::instance().consoleDir() - .add("udp-target", - fty::Command(&RegisterConsole::create) .arg("address", "target address to send log messages to") @@ -137,22 +137,22 @@ prefix_ senf::log::SyslogUDPTarget::RegisterConsole::RegisterConsole() " syslog false; # no syslog format, just plain udp\n" " }\n") ); detail::TargetRegistry::instance().consoleDir() - .add("udp-target", - fty::Command(&RegisterConsole::create) .arg("address") .arg("facility", kw::default_value = USER) ); detail::TargetRegistry::instance().consoleDir() - .add("udp-target", - fty::Command(&RegisterConsole::create) .arg("address") .arg("facility", kw::default_value = USER) ); detail::TargetRegistry::instance().consoleDir() - .add("udp-target", - fty::Command(&RegisterConsole::create) .arg("address") diff --git a/senf/Utils/Logger/SyslogUDPTarget.cci b/senf/Utils/Logger/SyslogUDPTarget.cci index 847e742..0d49bea 100644 --- a/senf/Utils/Logger/SyslogUDPTarget.cci +++ b/senf/Utils/Logger/SyslogUDPTarget.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/SyslogUDPTarget.hh b/senf/Utils/Logger/SyslogUDPTarget.hh index a11f84c..e978951 100644 --- a/senf/Utils/Logger/SyslogUDPTarget.hh +++ b/senf/Utils/Logger/SyslogUDPTarget.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -43,7 +43,7 @@ namespace log { /** \brief Log target writing UDP syslog packets - The SyslogUDPTarget will send all %log messages directly via UDP to a target host. This + The SyslogUDPTarget will send all %log messages directly via UDP to a target host. This host should have a syslog daemon or relay running. The protocol is defined in RFC-3164. @@ -57,7 +57,7 @@ namespace log { Valid facility values are from man 3 syslog: - \par "" + \par "" LOG_AUTHPRIV, LOG_CRON, LOG_DAEMON, LOG_FTP, LOG_KERN, LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, @@ -122,9 +122,9 @@ namespace log { void syslog(bool enabled=true); ///< Set syslog format private: - void init(); - void v_write(time_type timestamp, std::string const & stream, - std::string const & area, unsigned level, + void init(); + void v_write(time_type timestamp, std::string const & stream, + std::string const & area, unsigned level, std::string const & message); void consoleFormat(std::ostream & os); @@ -138,7 +138,7 @@ namespace log { bool syslogFormat_; public: - enum LogFacility { + enum LogFacility { AUTHPRIV = LOG_AUTHPRIV, CRON = LOG_CRON, DAEMON = LOG_DAEMON, diff --git a/senf/Utils/Logger/SyslogUDPTarget.test.cc b/senf/Utils/Logger/SyslogUDPTarget.test.cc index 209f353..442c4c3 100644 --- a/senf/Utils/Logger/SyslogUDPTarget.test.cc +++ b/senf/Utils/Logger/SyslogUDPTarget.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/Target.cc b/senf/Utils/Logger/Target.cc index 40af9e2..9c7968c 100644 --- a/senf/Utils/Logger/Target.cc +++ b/senf/Utils/Logger/Target.cc @@ -48,7 +48,7 @@ namespace log { namespace detail { - SENF_CONSOLE_REGISTER_ENUM_MEMBER( TargetRegistry, Level, + SENF_CONSOLE_REGISTER_ENUM_MEMBER( TargetRegistry, Level, (VERBOSE)(NOTICE)(MESSAGE)(IMPORTANT)(CRITICAL)(FATAL) ); }}} @@ -329,15 +329,15 @@ namespace { prefix_ void senf::log::Target::consoleList(std::ostream & os) { - static char const * levels[] = { + static char const * levels[] = { "verbose", "verbose", "notice", "message", "important", "critical", "fatal", "disabled" }; boost::format fmt ("%2d %-29s %-29s %-9s %-6s\n"); os << fmt % "#" % "STREAM" % "AREA" % "LEVEL" % "ACTION"; unsigned n (0); for (iterator i (begin()); i != end(); ++i, ++n) - os << fmt - % n + os << fmt + % n % formatLabel(i->stream()) % formatLabel(i->area()) % levels[i->level()] @@ -470,7 +470,7 @@ prefix_ boost::shared_ptr senf::log::detail::TargetRegistry::consoleSelf(std::ostream & os) { return senf::console::Client::get(os).consoleDir().node().thisptr(); -} +} /////////////////////////////////////////////////////////////////////////// // senf::log::detail::LogParameters @@ -514,7 +514,7 @@ prefix_ std::ostream & senf::log::operator<<(std::ostream & os, senf::log::Targe namespace { - char const * levelNames[] = { + char const * levelNames[] = { "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" }; void parseParamToken(std::string const & value, senf::log::detail::LogParameters & out) @@ -536,7 +536,7 @@ namespace { out.area = a; return; } - + char const ** i ( std::find(levelNames+1, levelNames+sizeof(levelNames)/sizeof(levelNames[0])-1, value)); if (i == levelNames+sizeof(levelNames)/sizeof(levelNames[0])-1) @@ -569,7 +569,7 @@ senf_console_parse_argument(console::ParseCommandInfo::TokensRange const & token LogParameters & out) { out.clear(); - + for (console::ParseCommandInfo::TokensRange::iterator i (tokens.begin()); i != tokens.end(); ++i) parseParamToken(i->value(), out); diff --git a/senf/Utils/Logger/Target.cci b/senf/Utils/Logger/Target.cci index 7e02f91..374aab5 100644 --- a/senf/Utils/Logger/Target.cci +++ b/senf/Utils/Logger/Target.cci @@ -80,21 +80,21 @@ prefix_ bool senf::log::Target::empty() prefix_ senf::log::Target::RoutingEntry::RoutingEntry(detail::StreamBase const * stream, detail::AreaBase const * area, unsigned level, action_t action) - : stream_(stream), area_(area), level_(level), action_(action) + : stream_(stream), area_(area), level_(level), action_(action) {} prefix_ senf::log::Target::RoutingEntry::RoutingEntry() - : stream_(0), area_(0), level_(0), action_(ACCEPT) + : stream_(0), area_(0), level_(0), action_(ACCEPT) {} prefix_ bool senf::log::Target::RoutingEntry::operator==(RoutingEntry const & other) const -{ - return - stream_ == other.stream_ && - area_ == other.area_ && +{ + return + stream_ == other.stream_ && + area_ == other.area_ && level_ == other.level_ && - action_ == other.action_; + action_ == other.action_; } prefix_ std::string senf::log::Target::RoutingEntry::stream() diff --git a/senf/Utils/Logger/Target.cti b/senf/Utils/Logger/Target.cti index 5d906ee..124aa2c 100644 --- a/senf/Utils/Logger/Target.cti +++ b/senf/Utils/Logger/Target.cti @@ -54,9 +54,9 @@ template prefix_ void senf::log::Target::route(action_t action, int index) { typedef detail::RouteParameters Params; - route( detail::InstanceP::value(), - detail::InstanceP::value(), - Params::Level::value, + route( detail::InstanceP::value(), + detail::InstanceP::value(), + Params::Level::value, action, index); } @@ -76,13 +76,13 @@ template prefix_ void senf::log::Target::unroute(action_t action) { typedef detail::RouteParameters Params; - unroute( detail::InstanceP::value(), - detail::InstanceP::value(), - Params::Level::value, + unroute( detail::InstanceP::value(), + detail::InstanceP::value(), + Params::Level::value, action); } -#endif +#endif /////////////////////////////////////////////////////////////////////////// // namespace senf::log::detail members diff --git a/senf/Utils/Logger/Target.hh b/senf/Utils/Logger/Target.hh index 385ac4b..40a2165 100644 --- a/senf/Utils/Logger/Target.hh +++ b/senf/Utils/Logger/Target.hh @@ -119,7 +119,7 @@ namespace log { The routing table is processed from first route to last route, the first matching entry determines the fate of a log messages. Therefore, the ordering of routing entries is important. - + If no position is explicitly specified, new routing entries are added to the end of the routing table. All routing statements however take an index as optional argument to explicitly specify the position of the new routing entry. diff --git a/senf/Utils/Logger/Target.ih b/senf/Utils/Logger/Target.ih index 324baff..7a7c832 100644 --- a/senf/Utils/Logger/Target.ih +++ b/senf/Utils/Logger/Target.ih @@ -54,7 +54,7 @@ namespace detail { std::ostream & operator<<(std::ostream & os, LogParameters const & pm); - void senf_console_parse_argument(console::ParseCommandInfo::TokensRange const & tokens, + void senf_console_parse_argument(console::ParseCommandInfo::TokensRange const & tokens, LogParameters & out); /** \brief Internal: Target registry */ @@ -62,18 +62,18 @@ namespace detail { : public senf::singleton { public: - enum Level { - VERBOSE = senf::log::VERBOSE::value, - NOTICE = senf::log::NOTICE::value, - MESSAGE = senf::log::MESSAGE::value, - IMPORTANT = senf::log::IMPORTANT::value, - CRITICAL = senf::log::CRITICAL::value, + enum Level { + VERBOSE = senf::log::VERBOSE::value, + NOTICE = senf::log::NOTICE::value, + MESSAGE = senf::log::MESSAGE::value, + IMPORTANT = senf::log::IMPORTANT::value, + CRITICAL = senf::log::CRITICAL::value, FATAL = senf::log::FATAL::value }; using senf::singleton::instance; - void write(StreamBase const & stream, AreaBase const & area, unsigned level, + void write(StreamBase const & stream, AreaBase const & area, unsigned level, std::string const & msg); void routed(); @@ -86,7 +86,7 @@ namespace detail { private: TargetRegistry(); ~TargetRegistry(); - + void registerTarget(Target * target, std::string const & name); void unregisterTarget(Target * target); @@ -104,7 +104,7 @@ namespace detail { console::LazyDirectory consoleDir_; Targets dynamicTargets_; - + friend class senf::log::Target; friend class senf::singleton; }; @@ -115,7 +115,7 @@ namespace detail { #ifndef DOXYGEN - // This code takes the routing target template arguments in any order and sorts them + // This code takes the routing target template arguments in any order and sorts them // by type (Stream, Area and Level). senf::mpl::rv<0u> RouteParameterCheck_(...); diff --git a/senf/Utils/Logger/Target.test.cc b/senf/Utils/Logger/Target.test.cc index 441bbd8..381df1c 100644 --- a/senf/Utils/Logger/Target.test.cc +++ b/senf/Utils/Logger/Target.test.cc @@ -37,17 +37,17 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - + struct RouteCheck { typedef std::string result_type; std::string operator()(senf::log::Target::RoutingEntry const & entry) const { - static char const * levels[] = { + static char const * levels[] = { "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" }; static char const * actions[] = { "ACCEPT", "REJECT" }; std::stringstream s; - s << entry.stream() << "-" << entry.area() << "-" << levels[entry.level()] << "-" + s << entry.stream() << "-" << entry.area() << "-" << levels[entry.level()] << "-" << actions[entry.action()]; return s.str(); } @@ -59,11 +59,11 @@ SENF_AUTO_UNIT_TEST(target) { senf::log::StringTarget target; - BOOST_CHECK_THROW( target.route("senf::log::test::myStream", "invalid_area"), + BOOST_CHECK_THROW( target.route("senf::log::test::myStream", "invalid_area"), senf::log::Target::InvalidAreaException ); BOOST_CHECK_THROW( target.route("invalid_stream", ""), senf::log::Target::InvalidStreamException ); - BOOST_CHECK_THROW( target.unroute("senf::log::test::myStream", "invalid_area"), + BOOST_CHECK_THROW( target.unroute("senf::log::test::myStream", "invalid_area"), senf::log::Target::InvalidAreaException ); BOOST_CHECK_THROW( target.unroute("invalid_stream", ""), senf::log::Target::InvalidStreamException ); @@ -73,18 +73,18 @@ SENF_AUTO_UNIT_TEST(target) target.route(senf::log::Target::ACCEPT, 0); target.route( senf::log::Target::ACCEPT, 2); - target.route("senf::log::test::myStream", "", senf::log::IMPORTANT::value, + target.route("senf::log::test::myStream", "", senf::log::IMPORTANT::value, senf::log::Target::REJECT, 4); target.route("senf::log::Debug", "senf::log::test::Foo", senf::log::VERBOSE::value, senf::log::Target::REJECT, -5); - target.route("senf::log::Debug", "", senf::log::MESSAGE::value, + target.route("senf::log::Debug", "", senf::log::MESSAGE::value, senf::log::Target::ACCEPT, -7); typedef boost::transform_iterator iterator; iterator i (boost::make_transform_iterator(target.begin(), RouteCheck())); iterator const i_end (boost::make_transform_iterator(target.end(), RouteCheck())); - char const * data[] = { + char const * data[] = { "senf::log::Debug--MESSAGE-ACCEPT", "senf::log::test::myStream--VERBOSE-ACCEPT", "senf::log::Debug-senf::log::test::Foo-VERBOSE-REJECT", @@ -100,7 +100,7 @@ SENF_AUTO_UNIT_TEST(target) target.unroute(); target.unroute(); target.unroute(senf::log::Target::REJECT); - target.unroute("senf::log::test::myStream", "", senf::log::IMPORTANT::value, + target.unroute("senf::log::test::myStream", "", senf::log::IMPORTANT::value, senf::log::Target::REJECT); target.unroute(1); target.flush(); diff --git a/senf/Utils/Logger/TimeSource.cc b/senf/Utils/Logger/TimeSource.cc index 2c0f5a9..ff226a6 100644 --- a/senf/Utils/Logger/TimeSource.cc +++ b/senf/Utils/Logger/TimeSource.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/TimeSource.cci b/senf/Utils/Logger/TimeSource.cci index 2978ea2..cf247c4 100644 --- a/senf/Utils/Logger/TimeSource.cci +++ b/senf/Utils/Logger/TimeSource.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/TimeSource.cti b/senf/Utils/Logger/TimeSource.cti index 708de01..6b6d12d 100644 --- a/senf/Utils/Logger/TimeSource.cti +++ b/senf/Utils/Logger/TimeSource.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Logger/TimeSource.hh b/senf/Utils/Logger/TimeSource.hh index cc18474..4dc160e 100644 --- a/senf/Utils/Logger/TimeSource.hh +++ b/senf/Utils/Logger/TimeSource.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -61,7 +61,7 @@ namespace log { This time source is installed by default and uses gettimeofday() (via the Boost.DateTime library) to get the current universal time. - + \ingroup config */ struct SystemTimeSource : public TimeSource diff --git a/senf/Utils/Logger/TimeSource.ih b/senf/Utils/Logger/TimeSource.ih index e6becd4..4a5a990 100644 --- a/senf/Utils/Logger/TimeSource.ih +++ b/senf/Utils/Logger/TimeSource.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -44,10 +44,10 @@ namespace detail { time_type now(); void timeSource(std::auto_ptr source); - + private: TimeSourceManager(); - + boost::scoped_ptr timeSource_; friend class senf::singleton; diff --git a/senf/Utils/Logger/main.test.hh b/senf/Utils/Logger/main.test.hh index aafc4df..342b69c 100644 --- a/senf/Utils/Logger/main.test.hh +++ b/senf/Utils/Logger/main.test.hh @@ -46,7 +46,7 @@ SENF_LOG_DEFINE_AREA(GlobalTestArea); namespace senf { namespace log { namespace test { - + struct Foo { SENF_LOG_CLASS_AREA(); diff --git a/senf/Utils/Mainpage.dox b/senf/Utils/Mainpage.dox index ff7e569..c96ddab 100644 --- a/senf/Utils/Mainpage.dox +++ b/senf/Utils/Mainpage.dox @@ -53,17 +53,17 @@ namespace senf { \section basic_mixins Mixin classes - +
\ref intrusive_refcountmixin to simplify writing classes for use with boost::intrusive_ptr
\ref safe_boola mixin class to provide a really safe replacement for operator bool - +
\ref singletonmixin to make a class a singleton
- + \section memory_management Memory Management @@ -72,7 +72,7 @@ namespace senf { buffers \ref pool_alloc_mixinmixin to provide pool allocation to a class - + \ref contiguous_storage_iteratortraits class to check iterator type for raw pointer accessibility @@ -87,7 +87,7 @@ namespace senf { \ref TypeIdValueclass wrapping a typeid in a way that it can be used like any other value type, e.g. as the key in a map. - + \section miscstuff Miscellaneous @@ -95,7 +95,7 @@ namespace senf { \ref exceptionstandard exception for system errors (errno) \ref senf_statisticsstatistics functionality - + \ref hexdumpa simple but usefull function to write binary data in in hexadecimal format. @@ -106,7 +106,7 @@ namespace senf { stringJoin()Utility to join a string range into a single string (with separator) - + make_transform_range()\c boost::make_transform_iterator() with support for ranges diff --git a/senf/Utils/Operators.hh b/senf/Utils/Operators.hh index f555b4f..8b41bdc 100644 --- a/senf/Utils/Operators.hh +++ b/senf/Utils/Operators.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2010 +// Copyright (C) 2010 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -33,7 +33,7 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - + template > struct strict_totally_ordered1 : boost::totally_ordered1< T, boost::equivalent1< T, B > > diff --git a/senf/Utils/Phoenix.hh b/senf/Utils/Phoenix.hh index 773bc5a..4f1e6e0 100644 --- a/senf/Utils/Phoenix.hh +++ b/senf/Utils/Phoenix.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ namespace senf { namespace phoenix { - + /** \brief \c push_back phoenix functor push_back(c, x) := c.push_back(x) diff --git a/senf/Utils/Phoenix.ih b/senf/Utils/Phoenix.ih index fb548e5..66fcee5 100644 --- a/senf/Utils/Phoenix.ih +++ b/senf/Utils/Phoenix.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -46,7 +46,7 @@ namespace detail { struct clear { template struct result { typedef void type; }; - + template void operator()(A1 & a1) const { a1.clear(); } diff --git a/senf/Utils/Range.cti b/senf/Utils/Range.cti index 6559c55..389b404 100644 --- a/senf/Utils/Range.cti +++ b/senf/Utils/Range.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -31,7 +31,7 @@ ///////////////////////////////cti.p/////////////////////////////////////// template -prefix_ boost::iterator_range< +prefix_ boost::iterator_range< boost::transform_iterator< Fn, typename boost::range_const_iterator::type > > senf::make_transform_range(Range const & range, Fn const & fn) @@ -42,7 +42,7 @@ senf::make_transform_range(Range const & range, Fn const & fn) } template -prefix_ boost::iterator_range< +prefix_ boost::iterator_range< boost::transform_iterator< Fn, typename boost::range_iterator::type > > senf::make_transform_range(Range & range, Fn const & fn) diff --git a/senf/Utils/Range.hh b/senf/Utils/Range.hh index e1e02dc..4232f90 100644 --- a/senf/Utils/Range.hh +++ b/senf/Utils/Range.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -34,20 +34,20 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - + /** \brief Make a \c boost::iterator_range from \c boost::trasform_iterator This helper is like \c boost::make_transform_iterator, however for ranges instead of - iterators. + iterators. */ template - boost::iterator_range< + boost::iterator_range< boost::transform_iterator< Fn, typename boost::range_const_iterator::type > > make_transform_range(Range const & range, Fn const & fn); template - boost::iterator_range< + boost::iterator_range< boost::transform_iterator< Fn, typename boost::range_iterator::type > > make_transform_range(Range & range, Fn const & fn); diff --git a/senf/Utils/ScopeExit.cci b/senf/Utils/ScopeExit.cci index 09ff9cf..724974e 100644 --- a/senf/Utils/ScopeExit.cci +++ b/senf/Utils/ScopeExit.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/ScopeExit.hh b/senf/Utils/ScopeExit.hh index ee72622..72c1a2a 100644 --- a/senf/Utils/ScopeExit.hh +++ b/senf/Utils/ScopeExit.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Statistics.cc b/senf/Utils/Statistics.cc index 0e1965f..01122b2 100644 --- a/senf/Utils/Statistics.cc +++ b/senf/Utils/Statistics.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -88,17 +88,17 @@ prefix_ void senf::StatisticsBase::consoleList(unsigned level, std::ostream & os { namespace fmt = senf::format; - os << boost::format("%s%-5d%|15t| %12.5g %19.5g %12.5g\n") - % std::string(2*level,' ') % rank() + os << boost::format("%s%-5d%|15t| %12.5g %19.5g %12.5g\n") + % std::string(2*level,' ') % rank() % fmt::eng(min()).setw() % fmt::eng(avg(),dev()).setw() % fmt::eng(max()).setw(); { OutputMap::const_iterator i (outputs_.begin()); OutputMap::const_iterator i_end (outputs_.end()); for (; i != i_end; ++i) os << boost::format(" %3d %12.5g %19.5g %12.5g\n") - % i->second.n - % fmt::eng(i->second.min).setw() - % fmt::eng(i->second.avg, i->second.dev).setw() + % i->second.n + % fmt::eng(i->second.min).setw() + % fmt::eng(i->second.avg, i->second.dev).setw() % fmt::eng(i->second.max).setw(); } { @@ -230,7 +230,7 @@ prefix_ void senf::Statistics::consoleCollect(std::vector & ranks) for (; i != i_end; ++i) stats = & (stats->collect(*i)); - + } prefix_ boost::shared_ptr @@ -239,7 +239,7 @@ senf::Statistics::consoleOutput(std::vector & ranks, unsigned window) StatisticsBase * stats (this); std::vector::const_iterator i (ranks.begin()); std::vector::const_iterator const i_end (ranks.end()); - + try { for (; i != i_end; ++i) stats = &(*stats)[*i]; @@ -248,7 +248,7 @@ senf::Statistics::consoleOutput(std::vector & ranks, unsigned window) for (; i != i_end; ++i) stats = & (stats->collect(*i)); - + return stats->output(window).dir().node().thisptr(); } diff --git a/senf/Utils/Statistics.cci b/senf/Utils/Statistics.cci index 5a31e36..3b9ed9b 100644 --- a/senf/Utils/Statistics.cci +++ b/senf/Utils/Statistics.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Statistics.cti b/senf/Utils/Statistics.cti index d34b9ba..fab1d56 100644 --- a/senf/Utils/Statistics.cti +++ b/senf/Utils/Statistics.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -35,7 +35,7 @@ template prefix_ senf::StatisticsBase::OutputProxy::OutputProxy(Owner * owner, OutputEntry * entry) - : owner_ (owner), entry_ (entry) + : owner_ (owner), entry_ (entry) {} template diff --git a/senf/Utils/Statistics.hh b/senf/Utils/Statistics.hh index f95f8bf..b4cf0bf 100644 --- a/senf/Utils/Statistics.hh +++ b/senf/Utils/Statistics.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -47,7 +47,7 @@ namespace senf { /** \defgroup senf_statistics Statistics The statistics functionality has two parts: - + \li the senf::Statistics class \li statistics sources @@ -61,10 +61,10 @@ namespace senf { class Collector; class Statistics; - + /** \brief Internal: Generic Statistics collection */ class StatisticsBase - { + { typedef std::map Children; struct Transform { @@ -111,7 +111,7 @@ namespace senf { // Function object struct Collector { - void operator()(float min, float avg, float max, float dev) + void operator()(float min, float avg, float max, float dev) { ... } }; \endcode @@ -125,7 +125,7 @@ namespace senf { template Owner & connect(Target & target, std::string label="") const; ///< Connect externally managed target - template Owner & connect(std::auto_ptr target, + template Owner & connect(std::auto_ptr target, std::string label="") const; ///< Connect internally managed target Owner & noconnect() const; ///< Don't connect the output @@ -136,7 +136,7 @@ namespace senf { private: #endif OutputProxy(Owner * owner, OutputEntry * entry); - template + template OutputProxy(Owner * owner, OutputProxy const & other); private: @@ -145,7 +145,7 @@ namespace senf { template friend class OutputProxy; }; - + /////////////////////////////////////////////////////////////////////////// ///\name Accessing the current value ///\{ @@ -169,7 +169,7 @@ namespace senf { /**< This member will return a reference to the collector collecting \a rank values. \param[in] rank Number of values the requested - collector collects into each combined value. + collector collects into each combined value. \throws InvalidRankException if \a rank is not a valid registered rank value. */ CollectorRange collectors(); ///< List all child collectors @@ -187,7 +187,7 @@ namespace senf { Statistics & base(); ///< Get base statistics object /**< Returns the base statistics object. If this is a child collector, this will return the outermost - statistics object, otherwise it will return + statistics object, otherwise it will return \c *this. */ std::string path() const; ///< Get the path to this collector @@ -242,7 +242,7 @@ namespace senf { float max_; float dev_; Children children_; - + struct QueueEntry { float min; float avg; @@ -267,7 +267,7 @@ namespace senf { struct Target : public TargetBase { boost::scoped_ptr target_; - Target(std::auto_ptr target, std::string const & label) + Target(std::auto_ptr target, std::string const & label) : TargetBase (label), target_ (target.release()) {} explicit Target(std::string const & label) : TargetBase (label), target_ (0) {} @@ -337,7 +337,7 @@ namespace senf { .collect(10u) // seconds .collect(60u) // minutes .collect(60u); // hours - + packetStats[10u].collect(100u); // 100 seconds rateAnalyzer.startStatistics(senf::ClockService::milliseconds(100u)); @@ -410,7 +410,7 @@ namespace senf { \see senf::StatisticsBase::OutputProxy for the output proxy (connect) interface \ingroup senf_statistics */ - class Statistics + class Statistics : public StatisticsBase, boost::noncopyable { public: @@ -436,7 +436,7 @@ namespace senf { \param[in] max maximal data values since last call \param[in] dev standard deviation of avg value */ - void operator()(float value, float dev=0.0f); + void operator()(float value, float dev=0.0f); ///< Same as enter() with \a min == \a avg == \a max /**< Provided so a Statistics instance can be directly used as a signal target. */ @@ -463,10 +463,10 @@ namespace senf { class Collector : public StatisticsBase { public: - virtual unsigned rank() const; + virtual unsigned rank() const; StatisticsBase::OutputProxy output(unsigned n = 1u); - + private: Collector(StatisticsBase * owner, unsigned rank); void enter(float min, float avg, float max, float dev); diff --git a/senf/Utils/Statistics.test.cc b/senf/Utils/Statistics.test.cc index 4e2f084..8a32ac6 100644 --- a/senf/Utils/Statistics.test.cc +++ b/senf/Utils/Statistics.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -41,7 +41,7 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - + struct GetRange { typedef senf::Collector const & first_argument_type; @@ -56,7 +56,7 @@ namespace { typedef boost::tokenizer Tokenizer; struct Pred { bool operator()(std::string const & s) const - { try { boost::lexical_cast(s); return true; } + { try { boost::lexical_cast(s); return true; } catch (std::bad_cast &) { return false; } } }; typedef boost::filter_iterator FilterIterator; @@ -69,11 +69,11 @@ namespace { typedef TransformIterator iterator; typedef TransformIterator const_iterator; - + splitFloats(std::string const & s) : s_ (s), sep_ (" \n"), tok_ (s_, sep_) {} - TransformIterator begin() const + TransformIterator begin() const { return TransformIterator(FilterIterator(tok_.begin(), tok_.end())); } - TransformIterator end() const + TransformIterator end() const { return TransformIterator(FilterIterator(tok_.end(), tok_.end())); } std::string s_; @@ -126,24 +126,24 @@ SENF_AUTO_UNIT_TEST(statistics) senf::StatisticsLogger("level3")); unsigned children1[] = { 4u }; - BOOST_CHECK_EQUAL_COLLECTIONS( + BOOST_CHECK_EQUAL_COLLECTIONS( boost::make_transform_iterator(stats.collectors().begin(), GetRange()), boost::make_transform_iterator(stats.collectors().end(), GetRange()), children1, children1 + sizeof(children1)/sizeof(children1[0]) ); unsigned children2[] = { 3u }; - BOOST_CHECK_EQUAL_COLLECTIONS( + BOOST_CHECK_EQUAL_COLLECTIONS( boost::make_transform_iterator(stats[4].collectors().begin(), GetRange()), boost::make_transform_iterator(stats[4].collectors().end(), GetRange()), children2, children2 + sizeof(children2)/sizeof(children2[0]) ); unsigned children3[] = { 2u }; - BOOST_CHECK_EQUAL_COLLECTIONS( + BOOST_CHECK_EQUAL_COLLECTIONS( boost::make_transform_iterator(stats[4][3].collectors().begin(), GetRange()), boost::make_transform_iterator(stats[4][3].collectors().end(), GetRange()), children3, children3 + sizeof(children3)/sizeof(children3[0]) ); - float values[][3] = { + float values[][3] = { { -1.0f, 2.3f, 2.5f }, { 0.3f, 2.4f, 3.8f }, { -1.1f, -0.3f, 0.0f }, { -0.3f, 3.2f, 3.3f }, { 1.0f, 1.1f, 1.1f }, { 0.5f, 0.5f, 0.5f }, { 0.0f, 0.0f, 0.0f }, { -2.0f, -1.8f, -1.0f }, { 0.0f, 2.3f, 2.4f }, diff --git a/senf/Utils/StatisticsTargets.cc b/senf/Utils/StatisticsTargets.cc index 712844f..e947200 100644 --- a/senf/Utils/StatisticsTargets.cc +++ b/senf/Utils/StatisticsTargets.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -57,11 +57,11 @@ namespace { { RegisterStatisticsLogger(); - static void adder(senf::StatisticsBase & stats, + static void adder(senf::StatisticsBase & stats, unsigned rank, senf::console::DirectoryNode & dir); - static void consoleCreate(senf::StatisticsBase & stats, + static void consoleCreate(senf::StatisticsBase & stats, unsigned rank, std::string const & prefix); }; @@ -80,7 +80,7 @@ prefix_ void RegisterStatisticsLogger::adder(senf::StatisticsBase & stats, { namespace kw = senf::console::kw; namespace fty = senf::console::factory; - + dir.add("logger", fty::Command( boost::bind(&consoleCreate, boost::ref(stats), rank, _1)) .arg("prefix","Optional prefix string to add to each log message", diff --git a/senf/Utils/StatisticsTargets.cci b/senf/Utils/StatisticsTargets.cci index b42e9e8..ebd1838 100644 --- a/senf/Utils/StatisticsTargets.cci +++ b/senf/Utils/StatisticsTargets.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/StatisticsTargets.ct b/senf/Utils/StatisticsTargets.ct index 881ed18..b53c840 100644 --- a/senf/Utils/StatisticsTargets.ct +++ b/senf/Utils/StatisticsTargets.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/StatisticsTargets.cti b/senf/Utils/StatisticsTargets.cti index 922578e..d6e256d 100644 --- a/senf/Utils/StatisticsTargets.cti +++ b/senf/Utils/StatisticsTargets.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/StatisticsTargets.hh b/senf/Utils/StatisticsTargets.hh index 536f654..055ee51 100644 --- a/senf/Utils/StatisticsTargets.hh +++ b/senf/Utils/StatisticsTargets.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -42,7 +42,7 @@ namespace senf { */ typedef unspecified StatisticsStream; #else - SENF_LOG_DEFINE_STREAM(StatisticsStream, + SENF_LOG_DEFINE_STREAM(StatisticsStream, senf::log::MESSAGE, senf::log::MESSAGE, senf::log::MESSAGE); #endif diff --git a/senf/Utils/StatisticsTargets.ih b/senf/Utils/StatisticsTargets.ih index fcca853..c43de90 100644 --- a/senf/Utils/StatisticsTargets.ih +++ b/senf/Utils/StatisticsTargets.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,7 +45,7 @@ namespace detail { : public senf::singleton { public: - typedef void (*AddFn)(senf::StatisticsBase &, unsigned, + typedef void (*AddFn)(senf::StatisticsBase &, unsigned, senf::console::DirectoryNode &); using senf::singleton::instance; @@ -66,7 +66,7 @@ namespace detail { { StatisticsLogger(std::string const & label_); void operator()(float min, float avg, float max, float dev); - + std::string label; }; diff --git a/senf/Utils/String.ct b/senf/Utils/String.ct index 01c4459..8b6c847 100644 --- a/senf/Utils/String.ct +++ b/senf/Utils/String.ct @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,7 +40,7 @@ prefix_ std::string senf::stringJoin(ForwardReadableRange const & range, std::st typename boost::range_const_iterator::type i (boost::begin(range)); typename boost::range_const_iterator::type const i_end (boost::end(range)); std::stringstream ss; - + if (i != i_end) { for (;;) { ss << *i; @@ -116,7 +116,7 @@ namespace detail { (*interpreter_) << mod; return *this; } - + private: boost::shared_ptr< senf::detail::lexical_stream > interpreter_; }; @@ -127,7 +127,7 @@ prefix_ Target senf::lexical_cast(Source const & arg) { senf::detail::lexical_stream interpreter; Target result; - + if (!(interpreter << arg && interpreter >> result)) boost::throw_exception(boost::bad_lexical_cast(typeid(Source), typeid(Target))); return result; diff --git a/senf/Utils/String.cti b/senf/Utils/String.cti index 8d39ba9..02e42c7 100644 --- a/senf/Utils/String.cti +++ b/senf/Utils/String.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/String.hh b/senf/Utils/String.hh index ee71b55..ed1e65b 100644 --- a/senf/Utils/String.hh +++ b/senf/Utils/String.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -33,7 +33,7 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - + /** \brief Join string range with separator into single string This utility will build string by joining all elements of \a range into a single string diff --git a/senf/Utils/String.test.cc b/senf/Utils/String.test.cc index f351e07..2c7e278 100644 --- a/senf/Utils/String.test.cc +++ b/senf/Utils/String.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,13 +45,13 @@ SENF_AUTO_UNIT_TEST(stringJoin) SENF_AUTO_UNIT_TEST(lexicalCast) { - SENF_CHECK_NO_THROW( - BOOST_CHECK_EQUAL( - senf::lexical_cast()[std::setbase(0)](std::string("0x1a2b")), + SENF_CHECK_NO_THROW( + BOOST_CHECK_EQUAL( + senf::lexical_cast()[std::setbase(0)](std::string("0x1a2b")), 6699u ) ); - SENF_CHECK_NO_THROW( - BOOST_CHECK_EQUAL( - senf::lexical_cast()[std::hex][std::uppercase][std::showbase](6699u), + SENF_CHECK_NO_THROW( + BOOST_CHECK_EQUAL( + senf::lexical_cast()[std::hex][std::uppercase][std::showbase](6699u), "0X1A2B" ) ); SENF_CHECK_NO_THROW( BOOST_CHECK_EQUAL( diff --git a/senf/Utils/Termlib/AbstractTerminal.hh b/senf/Utils/Termlib/AbstractTerminal.hh index 95408f6..6465ce8 100644 --- a/senf/Utils/Termlib/AbstractTerminal.hh +++ b/senf/Utils/Termlib/AbstractTerminal.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -39,7 +39,7 @@ namespace term { This abstract interface base class provides an abstract interface to a terminal. There are two parts to this interface: - + \li The interface which allows the terminal user to get information about the terminal \li The interface which allows the terminal to send messages to the terminal user diff --git a/senf/Utils/Termlib/Editor.cc b/senf/Utils/Termlib/Editor.cc index cceb4d8..bc081ca 100644 --- a/senf/Utils/Termlib/Editor.cc +++ b/senf/Utils/Termlib/Editor.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ prefix_ senf::term::BaseEditor::BaseEditor(AbstractTerminal & terminal) : terminal_ (&terminal), keyTimeout_ (senf::ClockService::milliseconds(DEFAULT_KEY_TIMEOUT_MS)), - timer_ ("senf::term::BaseEditor::keySequenceTimeout", + timer_ ("senf::term::BaseEditor::keySequenceTimeout", senf::membind(&BaseEditor::keySequenceTimeout, this)), column_ (0u), displayHeight_ (1u), line_ (0u) { @@ -278,7 +278,7 @@ prefix_ void senf::term::BaseEditor::write(std::string const & s) /////////////////////////////////////////////////////////////////////////// prefix_ senf::term::LineEditor::LineEditor(AbstractTerminal & terminal, AcceptCallback cb) - : BaseEditor(terminal), enabled_ (false), prompt_ ("$"), promptWidth_ (1u), editWidth_ (0u), + : BaseEditor(terminal), enabled_ (false), prompt_ ("$"), promptWidth_ (1u), editWidth_ (0u), text_ (""), point_ (0u), displayPos_ (0u), lastKey_ (0u), callback_ (cb), historyPoint_ (0u) { defineKey(KeyParser::Return, &bindings::accept); @@ -656,11 +656,11 @@ prefix_ void senf::term::bindings::complete(LineEditor & editor, Completer compl completer(editor, b, e, prefix, completions); if (completions.empty()) return; - if (e > text.size()) + if (e > text.size()) e = text.size(); if (b > e) b = e; - + // Find common start string of all completions unsigned commonStart (completions[0].size()); unsigned maxLen (commonStart); @@ -701,8 +701,8 @@ prefix_ void senf::term::bindings::complete(LineEditor & editor, Completer compl std::string line; for (unsigned column (0); column < nColumns && i != completions.end(); ++column, ++i) { std::string entry (colWidth, ' '); - std::copy(i->begin(), - i->size() > colWidth-2 ? i->begin()+colWidth-2 : i->end(), + std::copy(i->begin(), + i->size() > colWidth-2 ? i->begin()+colWidth-2 : i->end(), entry.begin()); line += entry; } diff --git a/senf/Utils/Termlib/Editor.hh b/senf/Utils/Termlib/Editor.hh index 7db6faf..3ee829e 100644 --- a/senf/Utils/Termlib/Editor.hh +++ b/senf/Utils/Termlib/Editor.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -102,7 +102,7 @@ namespace term { void write(char ch); void write(std::string const & s); - + AbstractTerminal * terminal_; Terminfo tifo_; KeyParser keyParser_; @@ -113,7 +113,7 @@ namespace term { unsigned displayHeight_; unsigned line_; }; - + /** \brief Single line interactive text editor LineEditor implements a single-line input widget on an arbitrary AbstractTerminal. @@ -125,7 +125,7 @@ namespace term { \li The LineEditor supports an arbitrary auxiliary display area below the input line \li The LineEditor has hide() / show() support to allow editing to be temporarily interrupted. - + The LineEditor will query the user for an input line. When the user accepts a line, LineEditor will call a user callback function. After the callback has been called, the editor is disabled. To accept a new input line, call show(). @@ -154,7 +154,7 @@ namespace term { See the senf::term::bindings namespace for a list of all default provided key binding functions. - + \section editor_complete Completion suppoprt @@ -163,7 +163,7 @@ namespace term { bindings::complete(): \code - void myCompleter(senf::term::LineEditor & editor, unsigned & b, unsigned & e, + void myCompleter(senf::term::LineEditor & editor, unsigned & b, unsigned & e, std::string & prefix, std::vector & completions) { // Get text to complete @@ -174,7 +174,7 @@ namespace term { } senf::term::LineEditor editor (...); - editor.defineKey(senf::term::KeyParser::TAB, + editor.defineKey(senf::term::KeyParser::TAB, boost::bind(&senf::term::bindings::complete, _1, &myCompleter)); \endcode @@ -184,16 +184,16 @@ namespace term { The completion protocol is as follows: When completion is desired, the completer function is called. \a b and \a e are set to 0 and editor.point() respectively. \a prefix and \a completions are empty. - + \li the completer may restrict the to-be-completed string to any subrange by changing \a b and \a e accordingly. \li If there is an initial substring which applies to \e all completions but should not be listed in the list of completions, assign this value to \a prefix. - \li Add all possible completions to the \a completions vector not including the \a prefix. + \li Add all possible completions to the \a completions vector not including the \a prefix. \li The completion result is taken from the size of the \a completions vector \e only: If this vector is empty, completion failed (even if \a prefix is set), a single entry in \a completions (even if it is the empty string) signals a unique completion. - + \section editor_auxarea The aux display area @@ -228,7 +228,7 @@ namespace term { /**< \param[in] terminal abstract terminal interface \param[in] cb callback to call for complete input line */ - + /////////////////////////////////////////////////////////////////////////// ///\name Overall edit control @@ -304,7 +304,7 @@ namespace term { void unsetKey(keycode_t key); ///< Remove all bindings for \a key ///\} - + private: virtual bool cb_init(); virtual void cb_windowSizeChanged(); @@ -349,14 +349,14 @@ namespace bindings { void nextHistory (LineEditor & editor); ///< Move to next history entry void clearScreen (LineEditor & editor); ///< Clear screen and redisplay editor - typedef boost::function &)> Completer; void complete (LineEditor & editor, Completer completer); ///< Complete text at cursor /**< This function calls \a completer to find the list of possible completions for the text between \a b and \a e (as passed to the completer). The completer must add - all possible completions to the \a completions vector. + all possible completions to the \a completions vector. \see \ref editor_complete */ diff --git a/senf/Utils/Termlib/Mainpage.dox b/senf/Utils/Termlib/Mainpage.dox index 8ca4408..9357f46 100644 --- a/senf/Utils/Termlib/Mainpage.dox +++ b/senf/Utils/Termlib/Mainpage.dox @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Termlib/Telnet.cc b/senf/Utils/Termlib/Telnet.cc index 0ce7e45..6e09183 100644 --- a/senf/Utils/Termlib/Telnet.cc +++ b/senf/Utils/Termlib/Telnet.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -38,7 +38,7 @@ prefix_ senf::term::BaseTelnetProtocol::BaseTelnetProtocol(Handle handle) : handle_ (handle), charState_ (NORMAL), command_ (CMD_NONE), option_ (0), inputEvent_ ("senf::term::BaseTelnetProtocol::input", - senf::membind(&BaseTelnetProtocol::readHandler, this), handle, + senf::membind(&BaseTelnetProtocol::readHandler, this), handle, senf::scheduler::FdEvent::EV_READ), outputEvent_ ("senf::term::BaseTelnetProtocol::output", senf::membind(&BaseTelnetProtocol::writeHandler, this), handle, @@ -212,7 +212,7 @@ prefix_ void senf::term::BaseTelnetProtocol::handleCommand(char c) handleChar(c); break; } -} +} prefix_ void senf::term::BaseTelnetProtocol::handleOption(char c) { @@ -343,14 +343,14 @@ prefix_ void senf::term::BaseTelnetProtocol::readHandler(int state) } prefix_ void senf::term::BaseTelnetProtocol::writeHandler(int state) -{ +{ if (state != senf::scheduler::FdEvent::EV_WRITE) { outputEvent_.disable(); inputEvent_.disable(); v_eof(); return; } - sendQueue_.erase(sendQueue_.begin(), + sendQueue_.erase(sendQueue_.begin(), handle_.write(boost::make_iterator_range( sendQueue_.begin(), sendQueue_.end()))); if (sendQueue_.empty()) @@ -403,7 +403,7 @@ prefix_ void senf::term::BaseTelnetProtocol::response(OptInfo & info, bool enabl } else if (enabled != info.enabled) { // Request to change the current state - if (!enabled || + if (!enabled || (enabled && (info.wantState == OptInfo::WANTED || info.wantState == OptInfo::ACCEPTED))) { // accept the request info.optionState = OptInfo::ACKNOWLEDGED; diff --git a/senf/Utils/Termlib/Telnet.cci b/senf/Utils/Termlib/Telnet.cci index 9804e99..67ad169 100644 --- a/senf/Utils/Termlib/Telnet.cci +++ b/senf/Utils/Termlib/Telnet.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Termlib/Telnet.cti b/senf/Utils/Termlib/Telnet.cti index e50e845..478e2e1 100644 --- a/senf/Utils/Termlib/Telnet.cti +++ b/senf/Utils/Termlib/Telnet.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Termlib/Telnet.hh b/senf/Utils/Termlib/Telnet.hh index e127a95..4806880 100644 --- a/senf/Utils/Termlib/Telnet.hh +++ b/senf/Utils/Termlib/Telnet.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -102,7 +102,7 @@ namespace term { \c v_handleOptionParameters() member is called. \code - class MyTelnetHandler + class MyTelnetHandler : public senf::term::BaseTelnetProtocol::TelnetHandler { public: @@ -113,14 +113,14 @@ namespace term { protected: MyTelnetHandler() { registerHandler(this); } - + private: virtual void v_init() { sendOptionParameters(OPTION_CODE, "my special subnegotiation"); incrementRequestCounter(); } - + virtual void v_handleOptionParameters(std::string const & data) { if (data == "another special subnegotiation") @@ -139,8 +139,8 @@ namespace term { static unsigned const DEFAULT_REQUEST_TIMEOUT_MS = 500u; typedef ClientSocketHandle::policy> Handle; ///< Type of socket handle required @@ -165,7 +165,7 @@ namespace term { void sendEC(); ///< Send EraseCharacter to peer void sendEL(); ///< Send EraseLine to peer void sendGA(); ///< Send GoAhead to peer - + void sendOptionParameters(option_type option, std::string const & data); ///< Send extended option parameter to peer /**< This will send \a data as extended option parameter of @@ -189,7 +189,7 @@ namespace term { bool localOption(option_type option); ///< \c true, if \a option locally enabled bool peerOption(option_type option); ///< \c true, if \a option enabled in peer - + protected: explicit BaseTelnetProtocol(Handle handle); ///< Construct telnet protocol handler BaseTelnetProtocol(); ///< Provided for TelnetHandler mixins only @@ -235,7 +235,7 @@ namespace term { virtual void v_handleEC(); ///< Called, when the peer sends an EraseCharacter virtual void v_handleEL(); ///< Called, when the peer sends an EraseLine virtual void v_handleGA(); ///< Called, when the peer sends a GoAhead - + private: void handleChar(char c); void handleNormalChar(char c); @@ -258,7 +258,7 @@ namespace term { void writeHandler(int state); void timeout(); - enum Command { + enum Command { CMD_NONE = 0, CMD_SE = 240, CMD_NOP = 241, @@ -294,7 +294,7 @@ namespace term { WantState wantState; OptionState optionState; bool enabled; - + }; OptInfo & getOption(bool local, option_type option); @@ -312,7 +312,7 @@ namespace term { typedef std::vector SendQueue; SendQueue sendQueue_; - enum CharState { NORMAL, IAC_SEEN, EXPECT_OPTION, CR_SEEN, + enum CharState { NORMAL, IAC_SEEN, EXPECT_OPTION, CR_SEEN, SB_OPTION, SB_DATA, SB_IAC_SEEN }; CharState charState_; @@ -332,7 +332,7 @@ namespace term { }; /** \brief Telnet handler base class - + \see BaseTelnetProtocol */ struct BaseTelnetProtocol::TelnetHandler @@ -348,7 +348,7 @@ namespace term { See http://www.iana.org/assignments/telnet-options for a list of options - \ingroup telnet_group + \ingroup telnet_group */ namespace telnetopt { BaseTelnetProtocol::option_type const ECHO = 1u; } namespace telnetopt { BaseTelnetProtocol::option_type const TRANSMIT_BINARY = 0u; } @@ -383,7 +383,7 @@ namespace telnethandler { void nextTerminalType(); ///< Request another terminal type std::string const & terminalType() const; ///< Return current terminal type - + protected: TerminalType(); @@ -395,18 +395,18 @@ namespace telnethandler { }; /** \brief Implement NAWS (Negotiation About Window Size) option - + This telnet handler implements the NAWS option. The client terminals window size will be requested during initialization. The current window size may always be accessed using the - width() and height() members. - + width() and height() members. + Whenever the window size is changed, the v_windowSizeChanged() function is called. This function must be implemented in a derived class. \see BaseTelnetProtocol for how to integrate this handler \n RFC 1073 Telnet Window Size Option */ - class NAWS + class NAWS : public BaseTelnetProtocol::TelnetHandler { public: @@ -417,7 +417,7 @@ namespace telnethandler { protected: NAWS(); - + # ifndef DOXYGEN private: # endif @@ -432,7 +432,7 @@ namespace telnethandler { unsigned width_; unsigned height_; }; - + } }} diff --git a/senf/Utils/Termlib/Telnet.test.cc b/senf/Utils/Termlib/Telnet.test.cc index e0f45bf..0d7c918 100644 --- a/senf/Utils/Termlib/Telnet.test.cc +++ b/senf/Utils/Termlib/Telnet.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/Termlib/TelnetTerminal.cc b/senf/Utils/Termlib/TelnetTerminal.cc index 758a360..e01c98f 100644 --- a/senf/Utils/Termlib/TelnetTerminal.cc +++ b/senf/Utils/Termlib/TelnetTerminal.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -73,7 +73,7 @@ prefix_ void senf::term::TelnetTerminal::v_setupComplete() if (setupFailed_) v_setupFailed(); - else if (! (width() > 0 + else if (! (width() > 0 && ! terminalType().empty() && localOption(telnetopt::SUPPRESS_GO_AHEAD) && peerOption(telnetopt::SUPPRESS_GO_AHEAD) @@ -98,7 +98,7 @@ prefix_ void senf::term::TelnetTerminal::v_setupComplete() if (! init) log << " terminal initialization (cb_init) failed\n"; })); - + setupFailed_ = true; requestPeerOption(telnetopt::SUPPRESS_GO_AHEAD, false); requestLocalOption(telnetopt::SUPPRESS_GO_AHEAD, false); diff --git a/senf/Utils/Termlib/TelnetTerminal.hh b/senf/Utils/Termlib/TelnetTerminal.hh index 434acb7..b1661d9 100644 --- a/senf/Utils/Termlib/TelnetTerminal.hh +++ b/senf/Utils/Termlib/TelnetTerminal.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,7 +40,7 @@ namespace term { /** \brief AbstractTerminal interface implementation based on telnet This class provides a telnet server implementation implementing the AbstractTerminal - interface. + interface. TelnetTerminal provides one additional callback which needs to be implemented in a derived class: v_setupFailed(). This member will be called, when not all required telnet options are diff --git a/senf/Utils/Termlib/Terminfo.cc b/senf/Utils/Termlib/Terminfo.cc index 44bdb6f..83459b1 100644 --- a/senf/Utils/Termlib/Terminfo.cc +++ b/senf/Utils/Termlib/Terminfo.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -194,13 +194,13 @@ namespace { { std::vector stack; - void push(senf::term::Terminfo::number_t v) + void push(senf::term::Terminfo::number_t v) { stack.push_back(v); } - senf::term::Terminfo::number_t pop() - { + senf::term::Terminfo::number_t pop() + { if (stack.empty()) return 0; else { @@ -282,11 +282,11 @@ prefix_ std::string senf::term::Terminfo::formatString(properties::String p, case '~': stack.push(~stack.pop()); break; case 't': bCondValue = stack.pop(); case 'e': if ((bCondValue = !bCondValue)) // this also supports elsif - --(i = prgstr.begin() + std::min (prgstr.find ("%e", i-prgstr.begin()), + --(i = prgstr.begin() + std::min (prgstr.find ("%e", i-prgstr.begin()), prgstr.find ("%;", i-prgstr.begin()))); case '?': case ';': break; - case 'p': + case 'p': switch (*++i) { case '1': stack.push(arg1); break; case '2': stack.push(arg2); break; @@ -338,7 +338,7 @@ prefix_ std::string senf::term::Terminfo::formatString(properties::String p, NumberVec::const_iterator i (numbers_.begin()); NumberVec::const_iterator const i_end (numbers_.end()); for (; i != i_end; ++i, ++n) - if (*i != NoValue + if (*i != NoValue && n < sizeof(properties::NumericNames)/sizeof(properties::NumericNames[0])) os << " " << properties::NumericNames[n] << " = " << *i << "\n"; } @@ -424,7 +424,7 @@ prefix_ void senf::term::Terminfo::load(std::istream & is) } if (booleans_.size() & 1) is.ignore(1u); - + numbers_.resize(h.nNumbers); for (NumberVec::iterator i (numbers_.begin()); i != numbers_.end(); ++i) { number_t v; @@ -442,7 +442,7 @@ prefix_ void senf::term::Terminfo::load(std::istream & is) if (!is) throw InvalidTerminfoException(); *i = v; } - + stringPool_.resize(h.stringPoolSz); is.read(&(stringPool_[0]), stringPool_.size()); if (!is) throw InvalidTerminfoException(); @@ -561,7 +561,7 @@ senf::term::KeyParser::lookup(std::string const & key) if (key.empty()) return std::make_pair(KeyCode(0), 0); - // There are several cases: + // There are several cases: // a) 'key' is an incomplete key sequence. In this case, 'key' will precede all completions in // the key table. The first possible completion is found by 'upper_bound' // b) 'key' is a complete key sequence. This is the key sequence *preceding* the 'upper_bound' diff --git a/senf/Utils/Termlib/Terminfo.hh b/senf/Utils/Termlib/Terminfo.hh index 2413e66..601051b 100644 --- a/senf/Utils/Termlib/Terminfo.hh +++ b/senf/Utils/Termlib/Terminfo.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -56,11 +56,11 @@ namespace term { */ /** \brief Terminfo database entry - + This class reads a single terminfo database entry and allows to access the terminfo - properties. - - \ingroup terminfo_group + properties. + + \ingroup terminfo_group */ class Terminfo { @@ -90,11 +90,11 @@ namespace term { CpiChangesRes, LpiChangesRes, BackspacesWithBs, CrtNoScrolling, NoCorrectlyWorkingCr, GnuHasMetaKey, LinefeedIsNewline, HasHardwareTabs, ReturnDoesClrEol }; - + /** \brief Boolean property names \hideinitializer */ static char const * const BooleanNames[]; - + /** \brief Numeric terminfo properties */ enum Numeric { Columns, InitTabs, Lines, LinesOfMemory, MagicCookieGlitch, PaddingBaudRate, @@ -185,11 +185,11 @@ namespace term { typedef char const* string_t; ///< String terminfo property type /////////////////////////////////////////////////////////////////////////// - + Terminfo(); explicit Terminfo(std::string const & term); ///< Load terminfo entry \a term void load(std::string const & term); ///< Load terminfo entry \a term - + bool getFlag(properties::Boolean p) const; ///< Get boolean property value number_t getNumber(properties::Numeric p) const; ///< Get numeric property value string_t getString(properties::String p) const; ///< Get string property value @@ -199,7 +199,7 @@ namespace term { bool hasProperty(properties::String p ) const; ///< \c true, if string property \a p exists std::string formatString(properties::String p, - number_t arg1=NoValue, number_t arg2=NoValue, + number_t arg1=NoValue, number_t arg2=NoValue, number_t arg3=NoValue, number_t arg4=NoValue, number_t arg5=NoValue, number_t arg6=NoValue, number_t arg7=NoValue, number_t arg8=NoValue, @@ -239,8 +239,8 @@ namespace term { All keys are returned as keyboard code's. Values 0 to 255 represent ordinary ASCII characters, larger values are special keys taken from the KeyCode \c enum - - \ingroup terminfo_group + + \ingroup terminfo_group */ class KeyParser { @@ -311,7 +311,7 @@ namespace term { Keytable table_; }; - + }} ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/senf/Utils/Termlib/Terminfo.test.cc b/senf/Utils/Termlib/Terminfo.test.cc index a55cd47..608fc81 100644 --- a/senf/Utils/Termlib/Terminfo.test.cc +++ b/senf/Utils/Termlib/Terminfo.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -56,7 +56,7 @@ SENF_AUTO_UNIT_TEST(terminfo) //ifo.dump(std::cout); //kp.dump(std::cout); - BOOST_CHECK_EQUAL( kp.lookup("\e[5\x7e"), + BOOST_CHECK_EQUAL( kp.lookup("\e[5\x7e"), Pair(senf::term::KeyParser::PageUp, 4u) ); BOOST_CHECK_EQUAL( kp.lookup("\e"), Pair(senf::term::KeyParser::Incomplete, 1u) ); diff --git a/senf/Utils/Termlib/telnetServer.cc b/senf/Utils/Termlib/telnetServer.cc index e0a1b57..1382210 100644 --- a/senf/Utils/Termlib/telnetServer.cc +++ b/senf/Utils/Termlib/telnetServer.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -40,17 +40,17 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - - class MyTelnet + + class MyTelnet : public senf::term::TelnetTerminal { public: - explicit MyTelnet(Handle handle) - : senf::term::BaseTelnetProtocol (handle), - editor_ (*this, senf::membind(&MyTelnet::executeLine, this)) + explicit MyTelnet(Handle handle) + : senf::term::BaseTelnetProtocol (handle), + editor_ (*this, senf::membind(&MyTelnet::executeLine, this)) { editor_.prompt("myTelnet-with-an-endlesssly-long-prompt$"); - editor_.defineKey(senf::term::KeyParser::Ctrl('D'), + editor_.defineKey(senf::term::KeyParser::Ctrl('D'), senf::membind(&MyTelnet::deleteCharOrExit, this)); } diff --git a/senf/Utils/TypeIdValue.cc b/senf/Utils/TypeIdValue.cc index 55fad7d..4972e00 100644 --- a/senf/Utils/TypeIdValue.cc +++ b/senf/Utils/TypeIdValue.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/TypeIdValue.cti b/senf/Utils/TypeIdValue.cti index 1bd58b6..b16f289 100644 --- a/senf/Utils/TypeIdValue.cti +++ b/senf/Utils/TypeIdValue.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/TypeIdValue.hh b/senf/Utils/TypeIdValue.hh index 182c3c9..c473565 100644 --- a/senf/Utils/TypeIdValue.hh +++ b/senf/Utils/TypeIdValue.hh @@ -73,24 +73,24 @@ namespace senf { std::type_info const * p_; }; - /** + /** \related TypeIdValue */ TypeIdValue const typeIdValue(); - /** + /** \related TypeIdValue */ template TypeIdValue const typeIdValue(); - /** + /** \related TypeIdValue */ template TypeIdValue const typeIdValue(Type const & ob); - /** + /** \related TypeIdValue */ std::ostream & operator<<(std::ostream & os, TypeIdValue const & v); diff --git a/senf/Utils/auto_unit_test.cti b/senf/Utils/auto_unit_test.cti index 97d41b3..5f810e6 100644 --- a/senf/Utils/auto_unit_test.cti +++ b/senf/Utils/auto_unit_test.cti @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/auto_unit_test.hh b/senf/Utils/auto_unit_test.hh index a05e41b..4e22f64 100644 --- a/senf/Utils/auto_unit_test.hh +++ b/senf/Utils/auto_unit_test.hh @@ -59,7 +59,7 @@ /** \brief Check for compile failure - \c COMPILE_FAIL() is used to check, that a certain piece of code will produce a compile + \c COMPILE_FAIL() is used to check, that a certain piece of code will produce a compile time failure. \code @@ -70,7 +70,7 @@ // fails to compile .... int x = "foo"; } - + COMPILE_FAIL(bar) { ... } @@ -78,7 +78,7 @@ \endcode This check is performed by the extended unit-test builder in \c senfscons. - + \ingroup unittest */ #define COMPILE_FAIL(n) void n() @@ -144,7 +144,7 @@ namespace test { #ifdef DOXYGEN /** \brief Check for non-equality - + \c SENF_CHECK_NOT_EQUAL() is the opposite of \c BOOST_CHECK_EQUAL. \hideinitializer \ingroup unittest diff --git a/senf/Utils/auto_unit_test.ih b/senf/Utils/auto_unit_test.ih index 01283d6..ad9ce10 100644 --- a/senf/Utils/auto_unit_test.ih +++ b/senf/Utils/auto_unit_test.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -37,7 +37,7 @@ namespace test { namespace detail { template - struct ConvertingIterator + struct ConvertingIterator : public boost::iterator_adaptor< ConvertingIterator, Iterator, Type, boost::use_default, Type> { diff --git a/senf/Utils/hexdump.cc b/senf/Utils/hexdump.cc index e332a6f..4bda711 100644 --- a/senf/Utils/hexdump.cc +++ b/senf/Utils/hexdump.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -27,7 +27,7 @@ #include "hexdump.ih" // Custom includes -#include +#include //#include "hexdump.mpp" #define prefix_ @@ -66,7 +66,7 @@ prefix_ senf::detail::HexDumper::~HexDumper() } } -#endif +#endif ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "hexdump.mpp" diff --git a/senf/Utils/hexdump.cci b/senf/Utils/hexdump.cci index 1b1d2ca..b43a142 100644 --- a/senf/Utils/hexdump.cci +++ b/senf/Utils/hexdump.cci @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -38,7 +38,7 @@ prefix_ senf::detail::HexDumper::HexDumper(std::ostream & os, unsigned block_siz : os_ (os), ias_ (os_), block_size_ (block_size), offset_ (0) {} -#endif +#endif ///////////////////////////////cci.e/////////////////////////////////////// #undef prefix_ diff --git a/senf/Utils/hexdump.ct b/senf/Utils/hexdump.ct index 277c671..98757ba 100644 --- a/senf/Utils/hexdump.ct +++ b/senf/Utils/hexdump.ct @@ -53,7 +53,7 @@ prefix_ std::string senf::hexdumpQuote(Iterator i, Iterator i_end) #undef prefix_ //#include "hexdump.mpp" - + // Local Variables: // mode: c++ // fill-column: 100 diff --git a/senf/Utils/hexdump.ih b/senf/Utils/hexdump.ih index 0acf34a..a003510 100644 --- a/senf/Utils/hexdump.ih +++ b/senf/Utils/hexdump.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/intrusive_refcount.cc b/senf/Utils/intrusive_refcount.cc index 49d2259..848e203 100644 --- a/senf/Utils/intrusive_refcount.cc +++ b/senf/Utils/intrusive_refcount.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/intrusive_refcount.hh b/senf/Utils/intrusive_refcount.hh index d3b980f..d1e1563 100644 --- a/senf/Utils/intrusive_refcount.hh +++ b/senf/Utils/intrusive_refcount.hh @@ -60,10 +60,10 @@ namespace senf { private: refcount_t refcount_; - + template void intrusive_ptr_add_ref(); template void intrusive_ptr_release(); - + template friend void senf::intrusive_ptr_add_ref(intrusive_refcount_t const * p); template @@ -78,7 +78,7 @@ namespace senf { publicly from intrusive_refcount_t. \code - class SomeClass + class SomeClass : public intrusive_refcount_t { // ... @@ -95,7 +95,7 @@ namespace senf { { // Call intrusive_base::release() to decrement the // refcount. This call will return 'true' when the refcount reaches 0. - + // Return 'true', if the instance shall be deleted } @@ -103,7 +103,7 @@ namespace senf { friend class intrusive_base; }; \endcode - + Two additional benefits of using intrusive_refcount are \li The object can access it's own refcount \li It is valid and safe to convert a plain object pointer to an intrusive_ptr at any time diff --git a/senf/Utils/intrusive_refcount.test.cc b/senf/Utils/intrusive_refcount.test.cc index dad19d1..98e3b27 100644 --- a/senf/Utils/intrusive_refcount.test.cc +++ b/senf/Utils/intrusive_refcount.test.cc @@ -104,7 +104,7 @@ SENF_AUTO_UNIT_TEST(intrusive_refcount_t) BOOST_CHECK_EQUAL(p->refcount(),1u); BOOST_CHECK_EQUAL(p->is_shared(),false); BOOST_CHECK_EQUAL(TesterCustom::refs,1u); - + { TesterCustom::ptr pp (p); diff --git a/senf/Utils/membind.hh b/senf/Utils/membind.hh index b77c3bd..2a5a4e9 100644 --- a/senf/Utils/membind.hh +++ b/senf/Utils/membind.hh @@ -124,9 +124,9 @@ Foo() { // Get bound member function for second overload - SENF_MEMBINDFNP(int, Foo, foo, () const) + SENF_MEMBINDFNP(int, Foo, foo, () const) } - + }; \endcode diff --git a/senf/Utils/mpl.hh b/senf/Utils/mpl.hh index 4f504fb..52da7b1 100644 --- a/senf/Utils/mpl.hh +++ b/senf/Utils/mpl.hh @@ -42,8 +42,8 @@ namespace mpl { /** \brief Marker class for empty default values etc. This is like Boosts \c boost::mpl::na just an empty class used as template default argument - to mark missing arguments - + to mark missing arguments + \note Don't use this as an empty base class. We may add some informative members to this. \ingroup senfmpl */ @@ -113,14 +113,14 @@ namespace mpl { \ingroup senfmpl */ template - struct rv { - char _[SENF_MPL_RV_ALIGNMENT][n+1]; + struct rv { + char _[SENF_MPL_RV_ALIGNMENT][n+1]; }; /** \brief Get return value of overload selector - + Used together with senf::mpl::rv to implement overload selection. - + \see \ref senf::mpl::rv \ingroup senfmpl \hideinitializer @@ -128,7 +128,7 @@ namespace mpl { # define SENF_MPL_RV(expr) (sizeof(expr)/SENF_MPL_RV_ALIGNMENT-1) /** \brief Take an arbitrary unsigned integer template argument - + Used together with SFINAE: The expression take_uint< \a expr > is only valid if \a expr is valid and returns a value convertible to an unsigned integer. @@ -138,7 +138,7 @@ namespace mpl { template struct take_uint {}; /** \brief Take an arbitrary integer template argument - + Used together with SFINAE: The expression take_int< \a expr > is only valid if \a expr is valid and returns a value convertible to an integer. @@ -148,7 +148,7 @@ namespace mpl { template struct take_int {}; /** \brief Take an arbitrary type template argument - + Used together with SFINAE: The expression take_class< \a expr > is only valid if \a expr is valid and is a type. diff --git a/senf/Utils/parameter.hh b/senf/Utils/parameter.hh index 37287fb..0200cda 100644 --- a/senf/Utils/parameter.hh +++ b/senf/Utils/parameter.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -24,7 +24,7 @@ \brief parameter public header */ /** \defgroup boost_parameter Boost.Parameter utilities - + Here we define some utilities for the Boost.Parameter library. @@ -47,7 +47,7 @@ namespace senf { ///\{ /** \brief Test \a ArgumentPack, whether the \a TagType argument was supplied - + This check will test, whether the argument identified by the \a TagType keyword tag type was specified in the \a ArgumentPack. This inherits from \c boost::mpl::true_ or \c boost::mpl::false_ accordingly. @@ -57,7 +57,7 @@ namespace senf { */ template struct has_parameter - : public boost::mpl::not_< + : public boost::mpl::not_< boost::is_same< typename boost::parameter::binding< ArgumentPack, TagType, void>::type, void > >::type {}; diff --git a/senf/Utils/parameter.test.cc b/senf/Utils/parameter.test.cc index 7af4e1f..2162481 100644 --- a/senf/Utils/parameter.test.cc +++ b/senf/Utils/parameter.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/pool_alloc_mixin.hh b/senf/Utils/pool_alloc_mixin.hh index 2cdfe5e..0a3b2af 100644 --- a/senf/Utils/pool_alloc_mixin.hh +++ b/senf/Utils/pool_alloc_mixin.hh @@ -73,7 +73,7 @@ namespace senf { the simple typedef is replaced with a nested struct. */ template - struct pool + struct pool : public boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) > { typedef boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) > type; diff --git a/senf/Utils/preprocessor.hh b/senf/Utils/preprocessor.hh index 915f9be..b358f04 100644 --- a/senf/Utils/preprocessor.hh +++ b/senf/Utils/preprocessor.hh @@ -42,8 +42,8 @@ ///\{ ///\ingroup senfpp -/** \brief Return last element of a sequence - \hideinitializer +/** \brief Return last element of a sequence + \hideinitializer */ #define SENF_PP_SEQ_BACK(seq) BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)),seq) diff --git a/senf/Utils/safe_bool.hh b/senf/Utils/safe_bool.hh index 44c1861..f178696 100644 --- a/senf/Utils/safe_bool.hh +++ b/senf/Utils/safe_bool.hh @@ -105,7 +105,7 @@ namespace senf { ... } \endcode - + If the class to be made using senf::safe_bool is itself comparable via it's own \c operator==, you must use comparable_safe_bool instead of safe_bool to not loose this capability. diff --git a/senf/Utils/signalnames.cc b/senf/Utils/signalnames.cc index 4fc09d2..1af70af 100644 --- a/senf/Utils/signalnames.cc +++ b/senf/Utils/signalnames.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -36,11 +36,11 @@ prefix_ std::string const & senf::signalName(int signal) { static std::string const names[] = { - "", - "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE", - "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", - "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN", "SIGTTOU", - "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO", + "", + "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE", + "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", + "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN", "SIGTTOU", + "SIGURG", "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO", "SIGPWR", "SIGSYS" }; return names[ diff --git a/senf/Utils/signalnames.hh b/senf/Utils/signalnames.hh index b5b8f34..091f9df 100644 --- a/senf/Utils/signalnames.hh +++ b/senf/Utils/signalnames.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund diff --git a/senf/Utils/singleton.test.cc b/senf/Utils/singleton.test.cc index a28a5ef..3d9247c 100644 --- a/senf/Utils/singleton.test.cc +++ b/senf/Utils/singleton.test.cc @@ -87,7 +87,7 @@ namespace { ~AliveTest2(); }; - AliveTest1::AliveTest1() + AliveTest1::AliveTest1() { test2Alive = AliveTest2::alive(); } diff --git a/senf/Utils/type_traits.hh b/senf/Utils/type_traits.hh index 910b4e4..24df850 100644 --- a/senf/Utils/type_traits.hh +++ b/senf/Utils/type_traits.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -54,12 +54,12 @@ namespace senf If the function described in \a Traits does not take any arguments, it is returned unchanged. - + \code typedef boost::function_traits traits - BOOST_STATIC_ASSERT(( boost::is_same< - senf::function_traits_remove_arg< traits >::type, - boost::function_traits + BOOST_STATIC_ASSERT(( boost::is_same< + senf::function_traits_remove_arg< traits >::type, + boost::function_traits >::value )); \endcode @@ -69,7 +69,7 @@ namespace senf struct function_traits_remove_arg {}; /** \brief Get argument type from function traits - + function_traits_arg will return the type of the \a index-th argument from \a Traits. If the function has no argument at that index, \c void is returned @@ -77,18 +77,18 @@ namespace senf typedef boost::function_traits traits; BOOST_STATIC_ASSERT(( boost:is_same< senf::function_traits_arg_type< traits, 0 >::type, - int + int >::value )); BOOST_STATIC_ASSERT(( boost::is_same< senf::function_traits_arg_type< traits, 2 >::type, void >::value )); \endcode - + \tparam Traits \c boost::function_traits instantiation \tparam index 0 based argument index */ - template < class Traits, int index, bool flag = (index < Traits::arity) > + template < class Traits, int index, bool flag = (index < Traits::arity) > struct function_traits_arg_type {}; #ifndef DOXYGEN @@ -107,12 +107,12 @@ namespace senf will be returned unchanged. \code - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< int (Class::*) >::type, - int + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< int (Class::*) >::type, + int >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< void (Class::*)(int) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< void (Class::*)(int) >::type, void (int) >::value )); \endcode @@ -160,7 +160,7 @@ namespace senf { typedef void type; }; - + #ifndef DOXYGEN template < class C, class T > struct member_class @@ -179,14 +179,14 @@ namespace senf This meta function will remove a plain or member pointer from the given type. If \a T is neither a member pointer nor an ordinary pointer, \a T will be returned unchanged. - + \code - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_any_pointer< int (Class::*) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_any_pointer< int (Class::*) >::type, int >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_any_pointer< void (Class::*)(int) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_any_pointer< void (Class::*)(int) >::type, void (int) > ); BOOST_STATIC_ASSERT(( boost::is_same< senf::remove_any_pointer < int (*)() >::type, @@ -206,7 +206,7 @@ namespace senf {}; /** \brief Test object if it is a function or member-function (pointer) - + is_any_function will inherit from \c boost::true_type, when \a T is a function type, function pointer type or a member function pointer type. Otherwise, it will inherit from \c boost::false_type. @@ -226,7 +226,7 @@ namespace senf {}; /** \brief Remove reference and CV qualification from type - + remove_cvref will remove all the 'ornaments' from a type as typically used to pass arguments: references and any CV spec. It will thus convert a typical argument type into it's basic type. diff --git a/senf/Utils/type_traits.mpp b/senf/Utils/type_traits.mpp index 2b0eb3c..33831f7 100644 --- a/senf/Utils/type_traits.mpp +++ b/senf/Utils/type_traits.mpp @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -82,13 +82,13 @@ struct function_traits_arg_type typedef typename Traits::mpp_CurArg() type; }; -template +template struct remove_member_pointer { typedef T type (mpp_Args()); }; -template +template struct remove_member_pointer { typedef T type (mpp_Args()); @@ -112,7 +112,7 @@ struct remove_member_pointer (save-excursion (re-search-backward "^// Undefine local Macros") (forward-line 1) (delete-region (point) (progn (search-forward "// ////") (forward-line -1) (point))) (insert "\n") (let ((b (point)) - (e (progn (insert (save-excursion (re-search-backward + (e (progn (insert (save-excursion (re-search-backward "^// Local Macros") (search-forward "#define") (beginning-of-line) (buffer-substring (point) (progn (search-forward "// ////") (search-backward "#define") (forward-line 1) (point))))) (point)))) diff --git a/senf/Utils/type_traits.test.cc b/senf/Utils/type_traits.test.cc index 1e1706b..1ad1a6d 100644 --- a/senf/Utils/type_traits.test.cc +++ b/senf/Utils/type_traits.test.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -45,9 +45,9 @@ SENF_AUTO_UNIT_TEST(typeTraits) { typedef boost::function_traits traits; - BOOST_STATIC_ASSERT(( boost::is_same< - senf::function_traits_remove_arg< traits >::type, - boost::function_traits + BOOST_STATIC_ASSERT(( boost::is_same< + senf::function_traits_remove_arg< traits >::type, + boost::function_traits >::value )); BOOST_STATIC_ASSERT(( boost::is_same< @@ -59,36 +59,36 @@ SENF_AUTO_UNIT_TEST(typeTraits) void >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< Class (Class::*) >::type, - Class + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< Class (Class::*) >::type, + Class >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< Class const (Class::*) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< Class const (Class::*) >::type, Class const >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< Class (Class::*)(int) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< Class (Class::*)(int) >::type, Class (int) >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< Class const (Class::*)(int) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< Class const (Class::*)(int) >::type, Class const (int) >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< void (Class::*)(int) const>::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< void (Class::*)(int) const>::type, void (int) >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< Class const (Class::*)(int) const>::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< Class const (Class::*)(int) const>::type, Class const (int) >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< void (Class::* const)(int)>::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< void (Class::* const)(int)>::type, void (int) >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_member_pointer< void (Class::* const)(int) const>::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_member_pointer< void (Class::* const)(int) const>::type, void (int) >::value )); @@ -101,12 +101,12 @@ SENF_AUTO_UNIT_TEST(typeTraits) void >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_any_pointer< int (Class::*) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_any_pointer< int (Class::*) >::type, int >::value )); - BOOST_STATIC_ASSERT(( boost::is_same< - senf::remove_any_pointer< void (Class::*)(int) >::type, + BOOST_STATIC_ASSERT(( boost::is_same< + senf::remove_any_pointer< void (Class::*)(int) >::type, void (int) >::value )); BOOST_STATIC_ASSERT(( boost::is_same< @@ -140,7 +140,7 @@ SENF_AUTO_UNIT_TEST(typeTraits) BOOST_STATIC_ASSERT(( senf::is_pair< std::pair >::value )); BOOST_STATIC_ASSERT(( ! senf::is_pair< void () >::value )); - + BOOST_CHECK( true ); } diff --git a/senf/config.hh b/senf/config.hh index e31bc20..cfa9319 100644 --- a/senf/config.hh +++ b/senf/config.hh @@ -19,17 +19,17 @@ // along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - + /** \file \brief config public header */ - + #ifndef HH_config_ #define HH_config_ 1 - + // Custom includes #include #include - + ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { @@ -66,7 +66,7 @@ namespace config { # # // Add other compilers here ... # -# // dynamic arrays are part of C99. Which is NOT part of C++ +# // dynamic arrays are part of C99. Which is NOT part of C++ # // but lets try nonetheless ... # elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define SENF_BUFFER_USE_LOCALS 1 @@ -90,10 +90,10 @@ namespace config { # define SENF_DEBUG_BACKTRACE_NUMCALLERS 64 # endif # -# ifndef SENF_CONSOLE_MAX_COMMAND_ARITY +# ifndef SENF_CONSOLE_MAX_COMMAND_ARITY # define SENF_CONSOLE_MAX_COMMAND_ARITY 6 # endif -# +# # ifndef PHOENIX_LIMIT # define PHOENIX_LIMIT 6 # endif @@ -101,10 +101,10 @@ namespace config { # if __GLIBC__>=2 && __GLIBC_MINOR__>=8 # define HAVE_TIMERFD 1 # endif - + ///////////////////////////////hh.e//////////////////////////////////////// #endif - + // Local Variables: // mode: c++ @@ -115,4 +115,4 @@ namespace config { // ispell-local-dictionary: "american" // compile-command: "scons -u all_tests" // End: - + diff --git a/tools/find-sources.sh b/tools/find-sources.sh index 33ea4b8..4a1e734 100755 --- a/tools/find-sources.sh +++ b/tools/find-sources.sh @@ -11,6 +11,7 @@ set -f find . \ -name .svn -prune -o \ -name .git -prune -o \ + -name .sconf_temp -prune -o \ -name doc -prune -o \ -name debian -prune -o \ -name dist -prune -o \