// $Id$
//
// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-//prefix_ boost::uint32_t senf::Parse_MPESection::calcCrc()
-// const
-//{
-// return std::for_each(
-// data().begin(),
-// boost::prior(data().end(), 4),
-// crc32_t() ).checksum();
-//}
+
+prefix_ boost::uint32_t senf::MPESectionParser::calcCrc()
+ const
+{
+ return std::for_each(
+ data().begin(),
+ boost::prior(data().end(), 4),
+ crc32_t() ).checksum();
+}
prefix_ void senf::MPESectionType::dump(packet p, std::ostream & os)
boost::io::ios_all_saver ias(os);
os << "MPE Section:\n"
<< std::hex
- << " table_id: 0x" << unsigned(p->table_id()) << "\n"
- << " section_syntax_indicator: " << p->section_syntax_indicator() << "\n"
- << " private_indicator: " << p->private_indicator() << "\n"
+ << " table_id : 0x" << unsigned(p->table_id()) << "\n"
+ << " section syntax indicator: " << p->section_syntax_indicator() << "\n"
+ << " private indicator : " << p->private_indicator() << "\n"
<< std::dec
- << " section_length: " << p->section_length() << "\n"
- << std::hex
- << " MAC_address_6: 0x" << unsigned(p->mac_addr_6()) << "\n"
- << " MAC_address_5: 0x" << unsigned(p->mac_addr_5()) << "\n"
- << " payload_scrambling_control: 0x" << p->payload_scrmbl_ctrl() << "\n"
- << " address_scrambling_control: 0x" << p-> addr_scrmbl_ctrl() << "\n"
- << " LLC_SNAP_flag: 0x" << p->llc_snap_flag() << "\n"
- << " current_next_indicator: 0x" << p->curr_next_indicator() << "\n"
- << " section_number: 0x" << unsigned(p->section_num()) << "\n"
- << " last_section_number: 0x" << unsigned(p->last_section_num()) << "\n"
- << " real_time_parameters: \n"
- << " delta_t: 0x" << unsigned(p->real_time_parameters().delta_t()) << "\n"
- << " table_boundary: 0x" << unsigned(p->real_time_parameters().table_boundary()) << "\n"
- << " frame_boundary: 0x" << unsigned(p->real_time_parameters().frame_boundary()) << "\n"
- << " address: 0x" << unsigned(p->real_time_parameters().address()) << "\n"
+ << " section length : " << p->section_length() << "\n"
+ << std::hex
+ << " MAC address 6 : 0x" << unsigned(p->mac_addr_6()) << "\n"
+ << " MAC address 5 : 0x" << unsigned(p->mac_addr_5()) << "\n"
+ << " payload scrambling ctrl : 0x" << p->payload_scrmbl_ctrl() << "\n"
+ << " address scrambling ctrl : 0x" << p-> addr_scrmbl_ctrl() << "\n"
+ << " LLC/SNAP flag : 0x" << p->llc_snap_flag() << "\n"
+ << " current next indicator : 0x" << p->curr_next_indicator() << "\n"
+ << " section number : 0x" << unsigned(p->section_num()) << "\n"
+ << " last section number : 0x" << unsigned(p->last_section_num()) << "\n"
+ << " real time parameters : \n"
+ << " delta_t : 0x" << unsigned(p->real_time_parameters().delta_t()) << "\n"
+ << " table boundary : 0x" << unsigned(p->real_time_parameters().table_boundary()) << "\n"
+ << " frame boundary : 0x" << unsigned(p->real_time_parameters().frame_boundary()) << "\n"
+ << " address : 0x" << unsigned(p->real_time_parameters().address()) << "\n"
<< std::dec
- << " CRC: " << unsigned(p->crc()) << "\n";
+ << " crc : " << unsigned(p->crc()) << "\n";
}
prefix_ senf::PacketParserBase::size_type senf::MPESectionType::initSize()
if (p->ip_datagram_version().value() == 4)
return IPv4Packet::factory();
if (p->ip_datagram_version().value() == 6)
- return IPv4Packet::factory();
+ return IPv6Packet::factory();
}
return no_factory();
}
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();
+ p->crc() = p->calcCrc();
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-\f
+
// Local Variables:
// mode: c++
// fill-column: 100