Packtes: Add missing 'nothrow' parameters
g0dil [Thu, 17 Jan 2008 15:07:28 +0000 (15:07 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@619 270642c3-0616-0410-b53a-bc976706d245

Examples/RateStuffer/ratestuffer.cc
Packets/DefaultBundle/IPv6Extensions.hh
Packets/DefaultBundle/IPv6Packet.cc
Packets/DefaultBundle/LlcSnapPacket.cc
Packets/MPEGDVBBundle/GREPacket.hh
Packets/MPEGDVBBundle/MPESection.cc
Packets/MPEGDVBBundle/TLVPacket.ct
Packets/PacketType.hh

index b9e774c..c9dbd89 100644 (file)
@@ -47,8 +47,8 @@ class RateFilter
     SENF_PPI_MODULE(RateFilter);
 public:
 
-    connector::ActiveInput input;
-    connector::ActiveOutput output;
+    connector::ActiveInput<> input;
+    connector::ActiveOutput<> output;
 
     RateFilter(senf::ClockService::clock_type interval);
 
@@ -82,8 +82,8 @@ class RateStuffer
     RateFilter              rateFilter;
 
 public:
-    connector::PassiveInput & input;
-    connector::ActiveOutput & output;
+    connector::PassiveInput<> & input;
+    connector::ActiveOutput<> & output;
 
     RateStuffer(senf::ClockService::clock_type interval, 
                 senf::Packet packet,
index 728a621..7f1bcbc 100644 (file)
@@ -93,7 +93,7 @@ namespace senf {
         static void dump(packet p, std::ostream & os);
 
         static void finalize(packet p)
-            { p->nextHeader() << key(p.next()); }
+            { p->nextHeader() << key(p.next(nothrow)); }
     };
 
     /** \brief IPv6 fragment extension packet typedef */
index 2f3fe8b..7f4029c 100644 (file)
@@ -66,7 +66,7 @@ prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os)
 prefix_ void senf::IPv6PacketType::finalize(packet p)
 {
     p->length() << (p.size() - IPv6PacketParser::fixed_bytes);
-    p->nextHeader() << key(p.next());
+    p->nextHeader() << key(p.next(nothrow));
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
index e804d8f..99461bb 100644 (file)
@@ -61,7 +61,7 @@ prefix_ senf::PacketInterpreterBase::factory_t senf::LlcSnapPacketType::nextPack
 
 prefix_ void senf::LlcSnapPacketType::finalize(packet p)
 {
-    optional_registry_key_t k = key(p.next());
+    optional_registry_key_t k = key(p.next(nothrow));
     if (k)
         p->type_length() << k;
     else
index 87c3e2a..26a4a19 100644 (file)
@@ -95,7 +95,7 @@ namespace senf {
           return p->protocol_type();
         }
         static void finalize(packet p) {
-          p->protocol_type() << key(p.next());
+          p->protocol_type() << key(p.next(nothrow));
           p->version_number() = 0; // as per RFC2784, 2.3.1
 
           if (p->checksum_present()) { 
index 5cbc486..8035cdb 100644 (file)
@@ -99,7 +99,7 @@ prefix_ senf::PacketInterpreterBase::factory_t senf::MPESectionType::nextPacketT
 
 prefix_ void senf::MPESectionType::finalize(packet p)
 {
-    p->llc_snap_flag() = p.next().is<LlcSnapPacket>() ? 1 : 0;
+    p->llc_snap_flag() = p.next(nothrow) && p.next().is<LlcSnapPacket>() ? 1 : 0;
     p->section_length() = p.data().size() - 3;
 //    p->crc() = p->calcCrc();
 }
index 1b965a4..9afc7d7 100644 (file)
@@ -43,10 +43,15 @@ prefix_ void senf::TLVPacketType<TypeParser, LengthParser>::dump(packet p, std::
 template <class TypeParser, class LengthParser>
 prefix_ void senf::TLVPacketType<TypeParser, LengthParser>::finalize(packet p)
 {
-    PacketData::size_type size = p.next().data().size();
-    if ( size > LengthParser::max_value )
-        throw(UnsuportedTLVPacketException());
-    p->length() = size;
+    try {
+        PacketData::size_type size = p.next().data().size();
+        if ( size > LengthParser::max_value )
+            throw(UnsuportedTLVPacketException());
+        p->length() = size;
+    }
+    catch (InvalidPacketChainException & ex) {
+        ;
+    }
 }
 
 template <class TypeParser, class LengthParser>
index 8a519db..6f07b6b 100644 (file)
@@ -276,7 +276,7 @@ namespace senf {
                 // 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());
+                p->typeField << key(p.next(senf::nothrow));
 
                 // optionally complete the packet by generating auto-generated information
                 // (like checksums)