X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv4Packet.hh;h=819e080234e23898f789820e023617485fc83e7c;hb=4d90b955bf3590e215488395d1c9cec827476e07;hp=259a815012ba334506fa4d070fa1ff4c9772b4f1;hpb=26610f603ebdd465307b9621f532c1fe19fd5571;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv4Packet.hh b/senf/Packets/DefaultBundle/IPv4Packet.hh index 259a815..819e080 100644 --- a/senf/Packets/DefaultBundle/IPv4Packet.hh +++ b/senf/Packets/DefaultBundle/IPv4Packet.hh @@ -52,16 +52,16 @@ namespace senf { void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); } operator value_type() const { return value(); } byte & operator[](size_type index) const { return *boost::next(i(),index); } - INet4AddressParser const & operator= (value_type const & other) + INet4AddressParser const & operator= (value_type const & other) { value(other); return *this; } }; /** \brief Parse an IPv4 packet Parser implementing the IPv4 header. - + \image html IPv4Packet.png - + \see IPv4PacketType \n RFC 791 @@ -96,7 +96,7 @@ namespace senf { } SENF_PARSER_FINALIZE(IPv4PacketParser); - + boost::uint16_t calcChecksum() const; ///< calculate header checksum /**< calculate and return the checksum of the header \see \ref senf::IpChecksum */ @@ -104,8 +104,8 @@ namespace senf { bool validateChecksum() const { return checksum() == calcChecksum(); } ///< validate header checksum - /**< return \c true if the \ref checksum() "checksum" - field is equal to the \ref calcChecksum() + /**< return \c true if the \ref checksum() "checksum" + field is equal to the \ref calcChecksum() "calculated checksum" */ }; @@ -117,11 +117,11 @@ namespace senf { PacketRegistry */ struct IpTypes { - typedef boost::uint16_t key_t; + typedef boost::uint8_t key_t; }; /** \brief IPv4 packet - + \par Packet type (typedef): \ref IPv4Packet @@ -139,7 +139,7 @@ namespace senf { \ref IPv4PacketParser::version() "Version" \ref IPv4PacketParser::ihl() "IHL" \ref IPv4PacketParser::tos() "TOS" - \ref IPv4PacketParser::length() "Length" + \ref IPv4PacketParser::length() "Length" \ref IPv4PacketParser::identifier() "Identifier" R @@ -162,7 +162,7 @@ namespace senf { \par Finalize action: \copydetails finalize() - + \ingroup protocolbundle_default */ struct IPv4PacketType @@ -180,22 +180,24 @@ namespace senf { using mixin::initSize; using mixin::init; - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->protocol(); } - + /** \brief Dump given IPv4Packet in readable form to given output stream */ - static void dump(packet p, std::ostream & os); - + static void dump(packet p, std::ostream & os); + static void finalize(packet p); ///< Finalize packet. - /**< \li set \ref IPv4PacketParser::length() "length" + /**< \li set \ref IPv4PacketParser::length() "length" from payload size - \li set \ref IPv4PacketParser::protocol() "protocol" + \li set \ref IPv4PacketParser::protocol() "protocol" from type of next packet if found in \ref IpTypes - \li calculate and set + \li calculate and set \ref IPv4PacketParser::checksum() "checksum" */ }; - /** \brief IPv4 packet typedef */ + /** \brief IPv4 packet typedef + \ingroup protocolbundle_default + */ typedef ConcretePacket IPv4Packet; }