// Custom includes
#include "EthernetPacket.hh"
-#include "IpV4Packet.hh"
+#include "IPv4Packet.hh"
#include "../../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
BOOST_CHECK_EQUAL(eth->type_length(), 0x8100u);
BOOST_CHECK_EQUAL(vlan->type(), 0u);
- senf::IpV4Packet ip (senf::IpV4Packet::createAfter(vlan));
+ senf::IPv4Packet ip (senf::IPv4Packet::createAfter(vlan));
eth.finalize();
BOOST_CHECK_EQUAL(vlan->type(), 0x0800u);
}
BOOST_CHECK_EQUAL( llcsnap->protocolId(), 0x000000u );
BOOST_CHECK_EQUAL( llcsnap->type(), 0u);
- senf::IpV4Packet ip (senf::IpV4Packet::createAfter(llcsnap));
+ senf::IPv4Packet ip (senf::IPv4Packet::createAfter(llcsnap));
eth.finalize();
BOOST_CHECK_EQUAL(llcsnap->type(), 0x0800u);
}
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV4Packet non-inline non-template implementation */
+ \brief IPv4Packet non-inline non-template implementation */
-#include "IpV4Packet.hh"
-//#include "IpV4Packet.ih"
+#include "IPv4Packet.hh"
+//#include "IPv4Packet.ih"
// Custom includes
#include <iomanip>
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IpV4Packet>
- registerIpV4Packet (0x0800);
+ senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv4Packet>
+ registerIPv4Packet (0x0800);
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IpV4Packet>
- regsiterIpV4Packet2 (4); // IP-in-IP encapsulation
+ senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv4Packet>
+ regsiterIPv4Packet2 (4); // IP-in-IP encapsulation
}
///////////////////////////////////////////////////////////////////////////
-// senf::Parse_IpV4
+// senf::Parse_IPv4
-prefix_ boost::uint16_t senf::Parse_IpV4::calcChecksum()
+prefix_ boost::uint16_t senf::Parse_IPv4::calcChecksum()
const
{
validate(bytes(*this));
}
///////////////////////////////////////////////////////////////////////////
-// senf::IpV4PacketType
+// senf::IPv4PacketType
-prefix_ void senf::IpV4PacketType::dump(packet p, std::ostream & os)
+prefix_ void senf::IPv4PacketType::dump(packet p, std::ostream & os)
{
boost::io::ios_all_saver ias(os);
os << "Internet protocol Version 4:\n"
<< " destination : " << p->destination() << "\n";
}
-prefix_ void senf::IpV4PacketType::finalize(packet p)
+prefix_ void senf::IPv4PacketType::finalize(packet p)
{
p->length() << p.size();
p->protocol() << key(p.next());
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV4Packet public header */
+ \brief IPv4Packet public header */
-#ifndef HH_IpV4Packet_
-#define HH_IpV4Packet_ 1
+#ifndef HH_IPv4Packet_
+#define HH_IPv4Packet_ 1
// Custom includes
#include "../../Socket/Protocols/INet/INet4Address.hh"
#include "../../Packets/Packets.hh"
-//#include "IpV4Packet.mpp"
+//#include "IPv4Packet.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
- /** \brief Parse in IpV4 address
+ /** \brief Parse in IPv4 address
\see INet4Address
*/
{ value(other); return *this; }
};
- /** \brief Parse an IpV4 packet
+ /** \brief Parse an IPv4 packet
- Parser implementing the IpV4 header.
+ Parser implementing the IPv4 header.
- \see IpV4PacketType \n
+ \see IPv4PacketType \n
<a href="http://tools.ietf.org/html/rfc791">RFC 791</a>
\todo Implement options
*/
- struct Parse_IpV4 : public PacketParserBase
+ struct Parse_IPv4 : public PacketParserBase
{
# include SENF_FIXED_PARSER()
ihl() = 5;
}
- SENF_PARSER_FINALIZE(Parse_IpV4);
+ SENF_PARSER_FINALIZE(Parse_IPv4);
boost::uint16_t calcChecksum() const;
typedef boost::uint16_t key_t;
};
- /** \brief IpV4 packet
+ /** \brief IPv4 packet
<table class="packet" cellpadding="5" cellspacing="1" border="1">
<tr>
<th width="12%">20</th> <th width="12%">24</th> <th width="6%">28</th>
<th style="text-align:right" width="6%">31</th>
</tr><tr>
- <td>\ref Parse_IpV4::version() "Version"</td>
- <td>\ref Parse_IpV4::ihl() "IHL"</td>
- <td colspan="2">\ref Parse_IpV4::tos() "TOS"</td>
- <td colspan="8">\ref Parse_IpV4::length() "Length"</td>
+ <td>\ref Parse_IPv4::version() "Version"</td>
+ <td>\ref Parse_IPv4::ihl() "IHL"</td>
+ <td colspan="2">\ref Parse_IPv4::tos() "TOS"</td>
+ <td colspan="8">\ref Parse_IPv4::length() "Length"</td>
</tr><tr>
- <td colspan="4">\ref Parse_IpV4::identifier() "Identifier"</td>
- <td>\ref Parse_IpV4::reserved() "R"</td>
- <td>\ref Parse_IpV4::df() "DF"</td>
- <td>\ref Parse_IpV4::mf() "MF"</td>
- <td colspan="5">\ref Parse_IpV4::frag() "Fragment Offset"</td>
+ <td colspan="4">\ref Parse_IPv4::identifier() "Identifier"</td>
+ <td>\ref Parse_IPv4::reserved() "R"</td>
+ <td>\ref Parse_IPv4::df() "DF"</td>
+ <td>\ref Parse_IPv4::mf() "MF"</td>
+ <td colspan="5">\ref Parse_IPv4::frag() "Fragment Offset"</td>
</tr><tr>
- <td colspan="2">\ref Parse_IpV4::ttl() "Time to Live (ttl)"</td>
- <td colspan="2">\ref Parse_IpV4::protocol() "Protocol"</td>
- <td colspan="8">\ref Parse_IpV4::checksum() "Header Checksum"</td>
+ <td colspan="2">\ref Parse_IPv4::ttl() "Time to Live (ttl)"</td>
+ <td colspan="2">\ref Parse_IPv4::protocol() "Protocol"</td>
+ <td colspan="8">\ref Parse_IPv4::checksum() "Header Checksum"</td>
</tr><tr>
- <td colspan="12">\ref Parse_IpV4::source() "Source Address"</td>
+ <td colspan="12">\ref Parse_IPv4::source() "Source Address"</td>
</tr><tr>
- <td colspan="12">\ref Parse_IpV4::destination() "Destination Address"</td>
+ <td colspan="12">\ref Parse_IPv4::destination() "Destination Address"</td>
</tr>
</table>
\par Packet type (typedef):
- \ref IpV4Packet
+ \ref IPv4Packet
\par Fields:
- \ref Parse_IpV4
+ \ref Parse_IPv4
\par Associated registries:
\ref IpTypes
\ingroup protocolbundle_default
*/
- struct IpV4PacketType
+ struct IPv4PacketType
: public PacketTypeBase,
- public PacketTypeMixin<IpV4PacketType, IpTypes>
+ public PacketTypeMixin<IPv4PacketType, IpTypes>
{
#ifndef DOXYGEN
- typedef PacketTypeMixin<IpV4PacketType, IpTypes> mixin;
- typedef ConcretePacket<IpV4PacketType> packet;
- typedef Parse_IpV4 parser;
+ typedef PacketTypeMixin<IPv4PacketType, IpTypes> mixin;
+ typedef ConcretePacket<IPv4PacketType> packet;
+ typedef Parse_IPv4 parser;
#endif
using mixin::nextPacketRange;
using mixin::nextPacketType;
static void finalize(packet p);
};
- /** \brief IpV4 packet typedef */
- typedef ConcretePacket<IpV4PacketType> IpV4Packet;
+ /** \brief IPv4 packet typedef */
+ typedef ConcretePacket<IPv4PacketType> IPv4Packet;
}
///////////////////////////////hh.e////////////////////////////////////////
#endif
#ifndef SENF_PACKETS_DECL_ONLY
-//#include IpV4Packet.cci"
-//#include "IpV4Packet.ct"
-//#include "IpV4Packet.cti"
+//#include IPv4Packet.cci"
+//#include "IPv4Packet.ct"
+//#include "IPv4Packet.cti"
#endif
\f
// Unit tests
-//#include "IpV4Packet.test.hh"
-//#include "IpV4Packet.test.ih"
+//#include "IPv4Packet.test.hh"
+//#include "IPv4Packet.test.ih"
// Custom includes
-#include "IpV4Packet.hh"
+#include "IPv4Packet.hh"
#include "UDPPacket.hh"
#include "../../Utils/auto_unit_test.hh"
0x15, 0x16, 0x17, 0x18
};
- senf::IpV4Packet p (senf::IpV4Packet::create(data));
+ senf::IPv4Packet p (senf::IPv4Packet::create(data));
BOOST_CHECK_EQUAL( p->version(), 0x00u );
BOOST_CHECK_EQUAL( p->ihl(), 0x01u );
BOOST_AUTO_UNIT_TEST(ipV4Packet_create)
{
- senf::IpV4Packet ip (senf::IpV4Packet::create());
+ senf::IPv4Packet ip (senf::IPv4Packet::create());
BOOST_CHECK_EQUAL( ip->version(), 4u );
BOOST_CHECK_EQUAL( ip->ihl(), 5u );
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV6Extensions non-inline non-template implementation */
+ \brief IPv6Extensions non-inline non-template implementation */
-#include "IpV6Extensions.hh"
-//#include "IpV6Extensions.ih"
+#include "IPv6Extensions.hh"
+//#include "IPv6Extensions.ih"
// Custom includes
-//#include "IpV6Extensions.mpp"
+//#include "IPv6Extensions.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IpV6Extension_Fragment>
- registerIpV6ExtensionType_Fragment (44);
+ senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6Extension_Fragment>
+ registerIPv6ExtensionType_Fragment (44);
}
-prefix_ void senf::IpV6ExtensionType_Fragment::dump(packet p, std::ostream & os)
+prefix_ void senf::IPv6ExtensionType_Fragment::dump(packet p, std::ostream & os)
{
os << "Internet protocol Version 6 fragment extension:\n"
<< " next header : " << unsigned(p->nextHeader()) << "\n"
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "IpV6Extensions.mpp"
+//#include "IPv6Extensions.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV6Extensions public header */
+ \brief IPv6Extensions public header */
-#ifndef HH_IpV6Extensions_
-#define HH_IpV6Extensions_ 1
+#ifndef HH_IPv6Extensions_
+#define HH_IPv6Extensions_ 1
// Custom includes
-#include "IpV6Packet.hh"
+#include "IPv6Packet.hh"
-//#include "IpV6Extensions.mpp"
+//#include "IPv6Extensions.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
- /** \brief Parse in IpV6 fragment extension header
+ /** \brief Parse in IPv6 fragment extension header
- Parser implementing the IpV6 fragment extension. The fields implemented are:
+ Parser implementing the IPv6 fragment extension. The fields implemented are:
- \see IpV6ExtensionType_Fragment \n
+ \see IPv6ExtensionType_Fragment \n
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
*/
- struct Parse_IpV6Extension_Fragment : public PacketParserBase
+ struct Parse_IPv6Extension_Fragment : public PacketParserBase
{
# include SENF_FIXED_PARSER()
SENF_PARSER_FIELD( id , Parse_UInt32 );
- SENF_PARSER_FINALIZE(Parse_IpV6Extension_Fragment);
+ SENF_PARSER_FINALIZE(Parse_IPv6Extension_Fragment);
};
- /** \brief IpV6 fragment extension
+ /** \brief IPv6 fragment extension
\par Packet type (typedef):
- \ref IpV6Extension_Fragment
+ \ref IPv6Extension_Fragment
\par Fields:
- \ref Parse_IpV6Extension_Fragment
+ \ref Parse_IPv6Extension_Fragment
\par Associated registries:
\par IpTypes
\ingroup protocolbundle_default
*/
- struct IpV6ExtensionType_Fragment
+ struct IPv6ExtensionType_Fragment
: public PacketTypeBase,
- public PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes>
+ public PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes>
{
#ifndef DOXYGEN
- typedef PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes> mixin;
- typedef ConcretePacket<IpV6ExtensionType_Fragment> packet;
- typedef Parse_IpV6Extension_Fragment parser;
+ typedef PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes> mixin;
+ typedef ConcretePacket<IPv6ExtensionType_Fragment> packet;
+ typedef Parse_IPv6Extension_Fragment parser;
#endif
using mixin::nextPacketRange;
using mixin::nextPacketType;
{ p->nextHeader() << key(p.next()); }
};
- /** \brief IpV6 fragment extension packet typedef */
- typedef ConcretePacket<IpV6ExtensionType_Fragment> IpV6Extension_Fragment;
+ /** \brief IPv6 fragment extension packet typedef */
+ typedef ConcretePacket<IPv6ExtensionType_Fragment> IPv6Extension_Fragment;
}
///////////////////////////////hh.e////////////////////////////////////////
#endif
#ifndef SENF_PACKETS_DECL_ONLY
-//#include "IpV6Extensions.cci"
-//#include "IpV6Extensions.ct"
-//#include "IpV6Extensions.cti"
+//#include "IPv6Extensions.cci"
+//#include "IPv6Extensions.ct"
+//#include "IPv6Extensions.cti"
#endif
\f
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV6Extensions.test unit tests */
+ \brief IPv6Extensions.test unit tests */
-//#include "IpV6Extensions.test.hh"
-//#include "IpV6Extensions.test.ih"
+//#include "IPv6Extensions.test.hh"
+//#include "IPv6Extensions.test.ih"
// Custom includes
-#include "IpV6Extensions.hh"
-#include "IpV6Packet.hh"
+#include "IPv6Extensions.hh"
+#include "IPv6Packet.hh"
#include "UDPPacket.hh"
#include "../../Socket/Protocols/INet/INetAddressing.hh"
0x11, 0x12, 0x13, 0x14
};
- senf::IpV6Packet p (senf::IpV6Packet::create(data));
+ senf::IPv6Packet p (senf::IPv6Packet::create(data));
BOOST_CHECK_EQUAL( p->version(), 6u );
BOOST_CHECK_EQUAL( p->length(), 20u );
BOOST_CHECK_EQUAL( p->nextHeader(), 44u );
BOOST_CHECK_EQUAL( p->source().value(), senf::INet6Address::from_string("2001::1") );
BOOST_CHECK_EQUAL( p->destination().value(), senf::INet6Address::from_string("2001::2") );
- BOOST_CHECK( p.next().is<senf::IpV6Extension_Fragment>() );
+ BOOST_CHECK( p.next().is<senf::IPv6Extension_Fragment>() );
- senf::IpV6Extension_Fragment f (p.next().as<senf::IpV6Extension_Fragment>());
+ senf::IPv6Extension_Fragment f (p.next().as<senf::IPv6Extension_Fragment>());
BOOST_CHECK_EQUAL( f->nextHeader(), 17u );
BOOST_CHECK_EQUAL( f->fragmentOffset(), 160u );
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV6Packet non-inline non-template implementation */
+ \brief IPv6Packet non-inline non-template implementation */
-#include "IpV6Packet.hh"
-//#include "IpV6Packet.ih"
+#include "IPv6Packet.hh"
+//#include "IPv6Packet.ih"
// Custom includes
#include <iomanip>
#include "EthernetPacket.hh"
#include "../../Socket/Protocols/INet/INetAddressing.hh"
-//#include "IpV6Packet.mpp"
+//#include "IPv6Packet.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IpV6Packet>
- registerIpV6Packet (0x86dd);
+ senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv6Packet>
+ registerIPv6Packet (0x86dd);
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IpV6Packet>
- registerIpV6Packet2 (41); // IP6-in-IP(6) encapsulation
+ senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6Packet>
+ registerIPv6Packet2 (41); // IP6-in-IP(6) encapsulation
senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::DataPacket>
registerNoNextHeader (59);
}
-prefix_ void senf::IpV6PacketType::dump(packet p, std::ostream & os)
+prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os)
{
boost::io::ios_all_saver ias(os);
os << "Internet protocol Version 6:\n"
<< " destination : " << p->destination() << "\n";
}
-prefix_ void senf::IpV6PacketType::finalize(packet p)
+prefix_ void senf::IPv6PacketType::finalize(packet p)
{
- p->length() << (p.size() - Parse_IpV6::fixed_bytes);
+ p->length() << (p.size() - Parse_IPv6::fixed_bytes);
p->nextHeader() << key(p.next());
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "IpV6Packet.mpp"
+//#include "IPv6Packet.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV6Packet public header */
+ \brief IPv6Packet public header */
-#ifndef HH_IpV6Packet_
-#define HH_IpV6Packet_ 1
+#ifndef HH_IPv6Packet_
+#define HH_IPv6Packet_ 1
// Custom includes
#include "../../Socket/Protocols/INet/INet6Address.hh"
#include "../../Packets/Packets.hh"
-#include "IpV4Packet.hh"
+#include "IPv4Packet.hh"
-//#include "IpV6Packet.mpp"
+//#include "IPv6Packet.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
- /** \brief Parse an IpV6 address
+ /** \brief Parse an IPv6 address
\see INet6Address
*/
{ value(other); return *this; }
};
- /** \brief Parse an IpV6 packet
+ /** \brief Parse an IPv6 packet
- \see IpV6PacketType \n
+ \see IPv6PacketType \n
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
*/
- struct Parse_IpV6 : public PacketParserBase
+ struct Parse_IPv6 : public PacketParserBase
{
# include SENF_FIXED_PARSER()
version() = 6;
}
- SENF_PARSER_FINALIZE(Parse_IpV6);
+ SENF_PARSER_FINALIZE(Parse_IPv6);
};
- /** \brief IpV6 packet
+ /** \brief IPv6 packet
\par Packet type (typedef):
- \ref IpV6Packet
+ \ref IPv6Packet
\par Fields:
- \ref Parse_IpV6
+ \ref Parse_IPv6
\par Associated registries:
\ref IpTypes
\ingroup protocolbundle_default
*/
- struct IpV6PacketType
+ struct IPv6PacketType
: public PacketTypeBase,
- public PacketTypeMixin<IpV6PacketType, IpTypes>
+ public PacketTypeMixin<IPv6PacketType, IpTypes>
{
#ifndef DOXYGEN
- typedef PacketTypeMixin<IpV6PacketType, IpTypes> mixin;
- typedef ConcretePacket<IpV6PacketType> packet;
- typedef Parse_IpV6 parser;
+ typedef PacketTypeMixin<IPv6PacketType, IpTypes> mixin;
+ typedef ConcretePacket<IPv6PacketType> packet;
+ typedef Parse_IPv6 parser;
#endif
using mixin::nextPacketRange;
using mixin::nextPacketType;
static void finalize(packet p);
};
- /** \brief IpV6 packet typedef */
- typedef ConcretePacket<IpV6PacketType> IpV6Packet;
+ /** \brief IPv6 packet typedef */
+ typedef ConcretePacket<IPv6PacketType> IPv6Packet;
///@}
}
///////////////////////////////hh.e////////////////////////////////////////
#endif
#ifndef SENF_PACKETS_DECL_ONLY
-//#include "IpV6Packet.cci"
-//#include "IpV6Packet.ct"
-//#include "IpV6Packet.cti"
+//#include "IPv6Packet.cci"
+//#include "IPv6Packet.ct"
+//#include "IPv6Packet.cti"
#endif
\f
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IpV6Packet unit tests */
+ \brief IPv6Packet unit tests */
-//#include "IpV6Packet.test.hh"
-//#include "IpV6Packet.test.ih"
+//#include "IPv6Packet.test.hh"
+//#include "IPv6Packet.test.ih"
// Custom includes
-#include "IpV6Packet.hh"
+#include "IPv6Packet.hh"
#include "../../Socket/Protocols/INet/INetAddressing.hh"
#include "../../Packets/DataPacket.hh"
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0xff };
- senf::IpV6Packet p (senf::IpV6Packet::create(data));
+ senf::IPv6Packet p (senf::IPv6Packet::create(data));
BOOST_CHECK_EQUAL( p->version(), 0x06u );
BOOST_CHECK_EQUAL( p->trafficClass(), 0x01u );
#include "UDPPacket.hh"
//#include "UDPPacket.ih"
-#include "IpV4Packet.hh"
+#include "IPv4Packet.hh"
// Custom includes
#include <iomanip>
#include <boost/io/ios_state.hpp>
#include "../../Packets/Packets.hh"
#include "../../Utils/IpChecksum.hh"
-#include "IpV4Packet.hh"
-#include "IpV6Packet.hh"
+#include "IPv4Packet.hh"
+#include "IPv6Packet.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
summer.feed( i()+checksum_offset+2, data().end() );
// Now on to the awkward part: the IP pseudo header
- IpV4Packet ipv4 (packet().prev<IpV4Packet>(nothrow));
+ IPv4Packet ipv4 (packet().prev<IPv4Packet>(nothrow));
if (ipv4) {
// Pseudo header defined in RFC768
summer.feed( ipv4->source().i(),
- ipv4->source().i() + Parse_IpV4::source_t::fixed_bytes );
- ///\fixme What about a hop-by-hop routing option? Which destination is used in IpV4 ?
+ ipv4->source().i() + Parse_IPv4::source_t::fixed_bytes );
+ ///\fixme What about a hop-by-hop routing option? Which destination is used in IPv4 ?
summer.feed( ipv4->destination().i(),
- ipv4->destination().i() + Parse_IpV4::destination_t::fixed_bytes );
+ ipv4->destination().i() + Parse_IPv4::destination_t::fixed_bytes );
summer.feed( 0u );
- ///\fixme May there be another header between the IpV4 header and UDP? if so, we
+ ///\fixme May there be another header between the IPv4 header and UDP? if so, we
/// need to hack the correct protocol number here ...
summer.feed( 17u );
summer.feed( i() + length_offset, i() + length_offset + 2 );
}
else {
// Pseudo header defined in RFC2460
- IpV6Packet ipv6 (packet().prev<IpV6Packet>(nothrow));
+ IPv6Packet ipv6 (packet().prev<IPv6Packet>(nothrow));
if (ipv6) {
summer.feed( ipv6->source().i(),
- ipv6->source().i() + Parse_IpV6::source_t::fixed_bytes );
+ ipv6->source().i() + Parse_IPv6::source_t::fixed_bytes );
///\todo Implement routing header support
// The destination used here must be the *final* destination ...
summer.feed( ipv6->destination().i(),
- ipv6->destination().i() + Parse_IpV6::destination_t::fixed_bytes );
+ ipv6->destination().i() + Parse_IPv6::destination_t::fixed_bytes );
/// This is a simplification. The value is really 32bit to support UDP Jumbograms
/// (RFC2147). However, skipping an even number of 0 bytes does not change the checksum
summer.feed( i() + length_offset, i() + length_offset + 2 );
// Custom includes
#include "UDPPacket.hh"
-#include "IpV4Packet.hh"
+#include "IPv4Packet.hh"
#include "../../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
0x00, 0x12, 0xfa, 0x6e, 0x54, 0x45, 0x53, 0x54,
0x2d, 0x57, 0x52, 0x49, 0x54, 0x45 };
- senf::IpV4Packet ip (senf::IpV4Packet::create());
+ senf::IPv4Packet ip (senf::IPv4Packet::create());
ip->source() = senf::INet4Address::Loopback;
ip->destination() = senf::INet4Address::Loopback;
ip->df() = true;
#define DTCPPACKET_HH_
#include "../../Packets/Packets.hh"
-#include "../../Packets/DefaultBundle/IpV4Packet.hh"
-#include "../../Packets/DefaultBundle/IpV6Packet.hh"
+#include "../../Packets/DefaultBundle/IPv4Packet.hh"
+#include "../../Packets/DefaultBundle/IPv6Packet.hh"
namespace senf {
//first we have to define some helpers
- struct DTCPIpV4AddressListParser : public PacketParserBase {
+ struct DTCPIPv4AddressListParser : public PacketParserBase {
# include SENF_PARSER()
SENF_PARSER_PRIVATE_FIELD ( num_of_fbips, Parse_UInt8 );
SENF_PARSER_PRIVATE_FIELD ( reserved , Parse_UInt8 ); //must be zero
SENF_PARSER_VEC_N ( fbiplist, num_of_fbips, Parse_INet4Address );
- SENF_PARSER_FINALIZE(DTCPIpV4AddressListParser);
+ SENF_PARSER_FINALIZE(DTCPIPv4AddressListParser);
};
- struct DTCPIpV6AddressListParser : public PacketParserBase {
+ struct DTCPIPv6AddressListParser : public PacketParserBase {
# include SENF_PARSER()
SENF_PARSER_PRIVATE_FIELD ( num_of_fbips, Parse_UInt8 );
SENF_PARSER_PRIVATE_FIELD ( reserved, Parse_UInt8 ); //must be zero
SENF_PARSER_VEC_N ( fbiplist, num_of_fbips, Parse_INet6Address );
- SENF_PARSER_FINALIZE(DTCPIpV6AddressListParser);
+ SENF_PARSER_FINALIZE(DTCPIPv6AddressListParser);
};
/** \brief Parse a DTCP packet
* (senf::VoidPacketParser) //1
* (senf::VoidPacketParser) //2
* (senf::VoidPacketParser) //3
- * (senf::Parse_ListB< IpV4Packet, num_of_fbips>) //4
+ * (senf::Parse_ListB< IPv4Packet, num_of_fbips>) //4
* (senf::VoidPacketParser) //5
- * (senf::Parse_ListB< IpV6Packet, num_of_fbips>) ); //6
+ * (senf::Parse_ListB< IPv6Packet, num_of_fbips>) ); //6
* This can't work for two reasons:
* -SENF_PARSER_PRIVATE_VARIANT only accepts 6 templates in types but you have to start from 0.
* -you NEVER can use templated Parsers in these macros since the macro-preprocessor won't recognize the <> brackets and will
};
SENF_PARSER_VARIANT_TRANS ( fbiplist, ip_version, ip_version_translator,
- (senf::DTCPIpV4AddressListParser) //IPv4
- (senf::DTCPIpV6AddressListParser) ); //IPv6
+ (senf::DTCPIPv4AddressListParser) //IPv4
+ (senf::DTCPIPv6AddressListParser) ); //IPv6
SENF_PARSER_FINALIZE(Parse_DTCPPacket);
};
+++ /dev/null
-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum NETwork research (NET)
-// David Wagner <david.wagner@fokus.fraunhofer.de>
-//
-#include "DtcpPacket.hh"
+++ /dev/null
-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum NETwork research (NET)
-// David Wagner <david.wagner@fokus.fraunhofer.de>
-//
-#ifndef DTCPPACKET_HH_
-#define DTCPPACKET_HH_
-
-#include "../../Packets/Packets.hh"
-#include "../../Packets/DefaultBundle/IpV4Packet.hh"
-#include "../../Packets/DefaultBundle/IpV6Packet.hh"
-
-namespace senf {
-
- //first we have to define some helpers
- struct DTCPIpV4AddressListParser : public PacketParserBase {
-# include SENF_PARSER()
- SENF_PARSER_PRIVATE_FIELD ( num_of_fbips, Parse_UInt8 );
- SENF_PARSER_PRIVATE_FIELD ( reserved , Parse_UInt8 ); //must be zero
- SENF_PARSER_VEC_N ( fbiplist, num_of_fbips, Parse_INet4Address );
-
- SENF_PARSER_FINALIZE(DTCPIpV4AddressListParser);
- };
-
- struct DTCPIpV6AddressListParser : public PacketParserBase {
-# include SENF_PARSER()
- SENF_PARSER_PRIVATE_FIELD ( num_of_fbips, Parse_UInt8 );
- SENF_PARSER_PRIVATE_FIELD ( reserved, Parse_UInt8 ); //must be zero
- SENF_PARSER_VEC_N ( fbiplist, num_of_fbips, Parse_INet6Address );
-
- SENF_PARSER_FINALIZE(DTCPIpV6AddressListParser);
- };
-
- /** \brief Parse a DTCP packet
-
- Parser implementing the DTCP packet according to RFC 3077
-
- \see DTCPPacketType
- */
- struct Parse_DTCPPacket : public PacketParserBase
- {
-# include SENF_PARSER()
-
- SENF_PARSER_BITFIELD ( version_number, 4, unsigned ); // =1 according to rfc3077
- SENF_PARSER_BITFIELD ( command, 4, unsigned ); // 1=JOIN 2=LEAVE
- SENF_PARSER_FIELD ( interval, Parse_UInt8 ); // 5 according to rfc3077
- SENF_PARSER_FIELD ( sequence_number, Parse_UInt16 );
- SENF_PARSER_PRIVATE_BITFIELD ( reserved, 3, unsigned );
- SENF_PARSER_BITFIELD ( receive_capable_feed, 1, bool ); // 0=send only, 1=receive_capable_feed
- SENF_PARSER_BITFIELD ( ip_version, 4, unsigned ); // 4=IPv4, 6=IPv6
- SENF_PARSER_FIELD ( tunnel_protocol, Parse_UInt8 );
- /* Please consider the following comments on the implementation given in this class:
- * 1. you could think of simply using SENF_PARSER_PRIVATE_VARIANT and List / Vectorparser like this:
- * SENF_PARSER_PRIVATE_VARIANT ( fbiplist, ip_version,
- * (senf::VoidPacketParser) //ip_version=0
- * (senf::VoidPacketParser) //1
- * (senf::VoidPacketParser) //2
- * (senf::VoidPacketParser) //3
- * (senf::Parse_ListB< IpV4Packet, num_of_fbips>) //4
- * (senf::VoidPacketParser) //5
- * (senf::Parse_ListB< IpV6Packet, num_of_fbips>) ); //6
- * This can't work for two reasons:
- * -SENF_PARSER_PRIVATE_VARIANT only accepts 6 templates in types but you have to start from 0.
- * -you NEVER can use templated Parsers in these macros since the macro-preprocessor won't recognize the <> brackets and will
- * interpret the ","
- *
- * The first problem is solved by using (actually inventing) SENF_PARSER_VARIANT_TRANS which has the same limitations
- * concerning the number of types but isn't limited to the values used. This is achieved by a translating function
- * as you can see.
- * The second problem is solved by introducing Helper-Parser which cover both the list and the number field. By that no
- * templates have to be used.
- */
-
- struct ip_version_translator {
- static unsigned fromChooser(ip_version_t::value_type in) {
- switch (in) {
- case 4: return 0;
- case 6: return 1;
- }
- }
- static ip_version_t::value_type toChooser(unsigned in) {
- switch (in) {
- case 0: return 4;
- case 1: return 6;
- }
- }
- };
-
- SENF_PARSER_VARIANT_TRANS ( fbiplist, ip_version, ip_version_translator,
- (senf::DTCPIpV4AddressListParser) //IPv4
- (senf::DTCPIpV6AddressListParser) ); //IPv6
-
- SENF_PARSER_FINALIZE(Parse_DTCPPacket);
- };
-
- /** \brief DTCP packet
-
- \par Packet type (typedef):
- \ref DTCPPacket
-
- \par Fields:
- \ref Parse_DTCPPacket
-
- \ingroup protocolbundle_mpegdvb
- */
- struct DTCPPacketType
- : public PacketTypeBase,
- public PacketTypeMixin<DTCPPacketType>
- {
- typedef PacketTypeMixin<DTCPPacketType> mixin;
- typedef ConcretePacket<DTCPPacketType> packet;
- typedef Parse_DTCPPacket parser;
-
- using mixin::nextPacketRange;
- using mixin::init;
- using mixin::initSize;
-
- static void dump(packet p, std::ostream & os);
- };
-
- /** \brief DTCP packet typedef */
- typedef DTCPPacketType::packet DTCPPacket;
-}
-
-#endif /*DTCPPACKET_HH_*/
\code
senf::EthernetPacket eth (senf::EthernetPacket::create());
- senf::IpV4Packet ip (senf::IpV4Packet ::createAfter(ethernet));
+ senf::IPv4Packet ip (senf::IPv4Packet ::createAfter(ethernet));
senf::UDPPacket udp (senf::UDPPacket ::createAfter(ip));
senf::DataPacket payload (senf::DataPacket ::createAfter(udp,
std::string("Hello, world!")));
\code
eth.next() == ip; // true
- eth.next().is<IpV4Packet>(); // true
+ eth.next().is<IPv4Packet>(); // true
eth.next().next() == udp; // true
eth.next().is<UDPPacket>(); // false
eth.next<UDPPacket>() == udp; // true
udp.next<UDPPacket>(); // throws InvalidPacketChainException
udp.next<UDPPacket>(senf::nothrow); // a senf::Packet testing as false
udp.findNext<UDPPacket()> == udp; // true
- udp.first<IpV4Packet>() == ip; // true
+ udp.first<IPv4Packet>() == ip; // true
udp.prev() == ip; // true
udp.prev<EthernetPacket>() == eth // true
template <class Parser, unsigned _>
struct ParserInitBytes_Choose
: public boost::integral_constant<PacketParserBase::size_type, Parser::init_bytes> {};
+ // ^^-- g++ error signaled here:
+ // error: 'fixed_bytes' is not a member of 'some-class-name'
+ //
+ // The 'some-class-name' class (as given in the error message) does not seem to be a parser at
+ // all (it has neither a 'fixed_bytes' nor an 'init_bytes' member).
+ //
+ // Either 'some-class-name' is not the class you wanted to use (it really is no parser) or you
+ // left out either 'init_bytes' or 'fixed_bytes' when defining the parser. This will also
+ // happen, if you forget to call 'SENF_PARSER_FINALIZE()' when defining a composite parser.
+ ///////////////////////////////////////////////////////////////////////////////////////////////
// If Parser::init_bytes is not defined, this specialization is chosen which instead uses
// 'Parser::fixed_bytes'
SENF_PARSER_PRIVATE_FIELD( size, senf::Parse_UInt8 );
SENF_PARSER_VEC_N( vec, size, senf::Parse_UInt16 );
-
+
SENF_PARSER_FINALIZE(MyVec);
};
}
This macro is a special helper to define a senf::Parse_Variant_Direct type field. This is a
variant field which chooses the sub-type by directly taking the value of some other field.
- This is a dynamically sized parser. Nevertheless, the chooser field \e must have a \e fixed
- distance to this field, the \a chooser must be a fixed-size value parser.
+ \warning
+ This is a dynamically sized parser. Nevertheless, the chooser field \e must have a
+ \e fixed distance to this field, the \a chooser must be a fixed-size value parser.
\code
struct SomeParser : public PacketParserBase
(senf::Parse_UInt24)
(senf::Parse_UInt32) );
- senf::Parse_UInt8 uint8() const { return content().get<1>(); }
+ senf::Parse_UInt8 uint8() const { return content().get<1>(); }
senf::Parse_UInt16 uint16() const { return content().get<2>(); }
senf::Parse_UInt24 uint24() const { return content().get<3>(); }
senf::Parse_UInt32 uint32() const { return content().get<4>(); }
default : return 2 ;
}
}
-
- static chooser_field_t::value_type foChooser(unsigned value) {
+ static chooser_field_t::value_type toChooser(unsigned value) {
static chooser_field_t::value_type table[] const = { 1, 5, 0 };
return table[value];
}