SENFSCons.Binary(env, bin, f,
LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ],
- OBJECTS = [ '#/Packets/MPEGDVBBundle/MPEGDVBBundle.o' ]);
+ OBJECTS = [ '#/Packets/DefaultBundle/DefaultBundle.o',
+ '#/Packets/MPEGDVBBundle/MPEGDVBBundle.o' ]);
ULEdec::iterator ULEdec::readNewSNDUPacket(iterator i, iterator const i_end)
{
bool dbit = false;
- senf::Packet::size_type sndu_length;
- sndu_length = *i++ << 8 | *i++;
+ senf::Packet::size_type sndu_length = *i++ << 8 | *i++;
if (sndu_length & 0x8000) {
sndu_length &= 0x7FFF;
dbit = true;
if (this->snduPacket->crc() != this->snduPacket->calcCrc()) {
throw ULEdecException("CRC Error");
}
+// senf::Packet nextPacket = this->snduPacket.next();
+// senf::hexdump(
+// nextPacket.data().begin(),
+// nextPacket.data().end(),
+// std::cout);
+
}
// Custom includes
#include <iomanip>
#include "Utils/hexdump.hh"
+#include "Packets/DefaultBundle/EthernetPacket.hh"
#define prefix_
ule_crc32() ).checksum();
}
+//prefix_ senf::SNDUPacketType::registry_key_t senf::SNDUPacketType::nextPacketKey(packet p)
+//{
+// return p->type();
+//}
+
+prefix_ void senf::SNDUPacketType::init(packet p)
+{
+ p->init();
+}
+
+prefix_ senf::PacketInterpreterBase::factory_t senf::SNDUPacketType::nextPacketType(packet p)
+{
+ if (p.data().size() < 8)
+ return no_factory();
+ PkReg_Entry const * e;
+ if (p->type() < 1536)
+ e = PacketRegistry<senf::ULEExtHeaderTypes>::lookup( p->type(), nothrow );
+ else
+ e = PacketRegistry<senf::EtherTypes>::lookup( 0x86dd, nothrow );
+ return e ? e->factory() : no_factory();
+}
+
+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
+ return range(
+ boost::next(p.data().begin(), sz),
+ boost::prior(p.data().end(), 4)); // - 32 bits crc
+}
+
prefix_ void senf::SNDUPacketType::dump(packet p, std::ostream & os)
{
os << "SNDUPacket:\n"
+ << std::dec
<< " d_bit: " << p->d_bit() << "\n"
<< " length: " << unsigned(p->length()) << "\n"
+ << std::hex
+ << " type: 0x" << unsigned(p->type()) << "\n"
+ << std::dec
<< " crc: " << unsigned(p->crc()) << "\n";
}
boost::uint32_t calcCrc() const;
};
+
+ struct ULEExtHeaderTypes {
+ typedef boost::uint16_t key_t;
+ };
+
/** \brief ULE SNDU Packet
\par Packet type (typedef):
\ingroup protocolbundle_mpegdvb
*/
struct SNDUPacketType
- : public PacketTypeBase,
- public PacketTypeMixin<SNDUPacketType>
+ : public PacketTypeBase
+// public PacketTypeMixin<SNDUPacketType, ULEExtHeaderTypes>
{
- typedef PacketTypeMixin<SNDUPacketType> mixin;
+// typedef PacketTypeMixin<SNDUPacketType, ULEExtHeaderType> mixin;
typedef ConcretePacket<SNDUPacketType> packet;
typedef Parse_SNDUPacket parser;
- using mixin::nextPacketRange;
-// using mixin::nextPacketType;
- using mixin::init;
+// using mixin::nextPacketRange;
+// using mixin::nextPacketType;
+// using mixin::init;
+
+// static registry_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();
};
// Return the key in the registry under which the next packet
// header is to be found. This member must be given if a Registry argument is
// passed to the PacketTypeMixin template.
- return i.fields().typeField();
+ return p->typeField();
}
static void finalize(packet p)