4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Thorsten Horstmann <tho@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief MPESection non-inline non-template implementation */
26 #include "MPESection.hh"
27 //#include "MPESection.ih"
31 #include <boost/io/ios_state.hpp>
32 #include "../../Packets/DefaultBundle/LlcSnapPacket.hh"
33 #include "../../Packets/DefaultBundle/IPv4Packet.hh"
34 #include "../../Packets/DefaultBundle/IPv6Packet.hh"
37 ///////////////////////////////cc.p////////////////////////////////////////
40 prefix_ boost::uint32_t senf::MPESectionParser::calcCrc()
45 boost::prior(data().end(), 4),
46 crc32_t() ).checksum();
50 prefix_ void senf::MPESectionType::dump(packet p, std::ostream & os)
52 boost::io::ios_all_saver ias(os);
53 os << "MPE Section:\n"
55 << " table_id : 0x" << unsigned(p->table_id()) << "\n"
56 << " section syntax indicator: " << p->section_syntax_indicator() << "\n"
57 << " private indicator : " << p->private_indicator() << "\n"
59 << " section length : " << p->section_length() << "\n"
61 << " MAC address 6 : 0x" << unsigned(p->mac_addr_6()) << "\n"
62 << " MAC address 5 : 0x" << unsigned(p->mac_addr_5()) << "\n"
63 << " payload scrambling ctrl : 0x" << p->payload_scrmbl_ctrl() << "\n"
64 << " address scrambling ctrl : 0x" << p-> addr_scrmbl_ctrl() << "\n"
65 << " LLC/SNAP flag : 0x" << p->llc_snap_flag() << "\n"
66 << " current next indicator : 0x" << p->curr_next_indicator() << "\n"
67 << " section number : 0x" << unsigned(p->section_num()) << "\n"
68 << " last section number : 0x" << unsigned(p->last_section_num()) << "\n"
69 << " real time parameters : \n"
70 << " delta_t : 0x" << unsigned(p->real_time_parameters().delta_t()) << "\n"
71 << " table boundary : 0x" << unsigned(p->real_time_parameters().table_boundary()) << "\n"
72 << " frame boundary : 0x" << unsigned(p->real_time_parameters().frame_boundary()) << "\n"
73 << " address : 0x" << unsigned(p->real_time_parameters().address()) << "\n"
75 << " crc : " << unsigned(p->crc()) << "\n";
78 prefix_ senf::PacketParserBase::size_type senf::MPESectionType::initSize()
80 return parser::fixed_bytes + 32/8;
83 prefix_ senf::PacketParserBase::size_type senf::MPESectionType::initHeadSize()
85 return parser::fixed_bytes;
88 prefix_ senf::PacketInterpreterBase::factory_t senf::MPESectionType::nextPacketType(packet p)
90 if (p.data().size() > initSize()+1) {
91 if (p->llc_snap_flag())
92 return LlcSnapPacket::factory();
93 if (p->ip_datagram_version().value() == 4)
94 return IPv4Packet::factory();
95 if (p->ip_datagram_version().value() == 6)
96 return IPv6Packet::factory();
101 prefix_ void senf::MPESectionType::finalize(packet p)
103 p->llc_snap_flag() = p.next(nothrow) && p.next().is<LlcSnapPacket>() ? 1 : 0;
104 p->section_length() = p.data().size() - 3;
105 p->crc() = p->calcCrc();
108 ///////////////////////////////cc.e////////////////////////////////////////
115 // c-file-style: "senf"
116 // indent-tabs-mode: nil
117 // ispell-local-dictionary: "american"
118 // compile-command: "scons -u test"
119 // comment-column: 40