// Definition of non-inline non-template functions
-#include <string>
-#include <iostream>
-#include <iomanip>
-#include <algorithm>
-#include <sys/ioctl.h>
-#include <linux/sockios.h>
-#include <linux/dvb/dmx.h>
+#include "ULEdec.hh"
-#include "Scheduler/Scheduler.hh"
-#include "Packets/DefaultBundle/EthernetPacket.hh"
-#include "Packets/MPEGDVBBundle/TransportPacket.hh"
-#include "Packets/MPEGDVBBundle/SNDUPacket.hh"
-#include "Utils/membind.hh"
-#include "Utils/hexdump.hh"
-#include "Socket/Protocols/DVB/DVBDemuxHandles.hh"
-#include "Packets/ParseInt.hh"
-#include "Packets/Packet.hh"
#include "Packets/PacketData.hh"
-#include "Packets/ParseInt.hh"
-
-#include "ULEdec.hh"
+#include "Utils/hexdump.hh"
+#include "Utils/membind.hh"
#define PID 271
#define TS_SYNC 0x47
iterator payload_start = payloadData.begin();
iterator payload_end = payloadData.end();
+ std::cout << "New TS Packet:\n"
+ << "----------------------------------------------------------------------------\n";
senf::hexdump(payload_start, payload_end, std::cout);
+ std::cout << "----------------------------------------------------------------------------\n";
// Synchronize continuity counter
this->priv_tscc = ts_packet->continuity_counter();
case 1:
return;
default:
- if ( (*payload_start++ | *payload_start++) != ULE_END_INDICATOR )
+ if ( (*payload_start++ << 8 | *payload_start++) != ULE_END_INDICATOR )
std::cerr << "delimiting error 1\n";
} else {
BOOST_ASSERT( std::distance( payload_start, payload_end ) == 0 );
this->receiver_state = Idle;
} while (std::distance(payload_start, payload_end) < 2 );
}
+
} // end pusi-switch
-
}
switch (std::distance(i_start, i_end)) {
case 1:
this->priv_sndu_type_1 = true;
- this->snduPacket->type() = *i_start++;
+ this->snduPacket->type() = *i_start++ << 8;
this->snduPacketData_iter++;
case 0:
break;
default:
- this->snduPacket->type() = *i_start++ | *i_start++;
+ this->snduPacket->type() = *i_start++ << 8 | *i_start++;
this->snduPacketData_iter += 2;
i_start = readRawSNDUPacketData(i_start, i_end);
}
void ULEdec::handleSNDUPacket()
{
this->snduPacket.dump(std::cout);
+ std::cout << " calculated CRC: " << this->snduPacket->calcCrc() << "\n";
+ std::cout << "----------------------------------------------------------------------------\n\n";
}
// $Id: ULEdec.cc 355 2007-07-26 14:17:02Z tho $
//
-// Copyright (C) 2006
+// Copyright (C) 2007
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
#include <iostream>
#include <iomanip>
#include <sys/ioctl.h>
-#include <linux/sockios.h>
#include <linux/dvb/dmx.h>
#include "Scheduler/Scheduler.hh"
-#include "Packets/DefaultBundle/EthernetPacket.hh"
#include "Packets/MPEGDVBBundle/TransportPacket.hh"
#include "Packets/MPEGDVBBundle/SNDUPacket.hh"
-#include "Utils/membind.hh"
#include "Socket/Protocols/DVB/DVBDemuxHandles.hh"
-#include "Packets/ParseInt.hh"
-#include "Packets/Packet.hh"
-#include "Packets/PacketData.hh"
-#include "Packets/ParseInt.hh"
class ULEdec
// Custom includes
#include <iomanip>
+#include "Utils/hexdump.hh"
+#include "Packets/PacketData.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
return 2 + 2 + 4 + 6; // + 6 Byte NPA destination address
}
+prefix_ boost::uint32_t senf::Parse_SNDUPacket::calcCrc()
+ const
+{
+ ule_crc32 result;
+ senf::PacketData::iterator i (data().begin());
+ senf::PacketData::iterator const i_end(boost::prior(data().end(),4));
+ for (; i!=i_end; ++i)
+ result.process_byte(*i);
+ return result.checksum();
+}
+
prefix_ void senf::SNDUPacketType::dump(packet p, std::ostream & os)
{
os << "SNDUPacket:\n"
-// $Id:DSMCCSection.hh 327 2007-07-20 10:03:44Z tho $
+// $Id$
//
// Copyright (C) 2007
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Custom includes
#include <algorithm>
+#include <boost/crc.hpp>
#include "Packets/PacketType.hh"
#include "Packets/ParseInt.hh"
#include "Packets/PacketRegistry.hh"
PacketParserBase::size_type bytes() const;
static const size_type init_bytes = 2+2+4; // D-Bit + 15 bits length + 16 bits type field + 32 bits crc
+
+ boost::uint32_t calcCrc() const;
};
/** \brief ULE SNDU Packet
};
typedef SNDUPacketType::packet SNDUPacket;
+
+ typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> ule_crc32;
+
/*!
\def ULE_END_INDICATOR