X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FDefaultBundle%2FUDPPacket.hh;h=456b3259b2a8f0265168be192ba87a73615bb3fc;hb=8674fb1d184e7d620eb7c604957b5b4203df37a6;hp=f8814977aed45bc1adf809fe69dcabfbda6fbf64;hpb=54eed72c506b09ef5b4be0b62fecedfbc0e3f261;p=senf.git diff --git a/Packets/DefaultBundle/UDPPacket.hh b/Packets/DefaultBundle/UDPPacket.hh index f881497..456b325 100644 --- a/Packets/DefaultBundle/UDPPacket.hh +++ b/Packets/DefaultBundle/UDPPacket.hh @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // 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 @@ -23,8 +23,8 @@ /** \file \brief UDPPacket public header */ -#ifndef HH_UDPPacket_ -#define HH_UDPPacket_ 1 +#ifndef HH_SENF_Packets_DefaultBundle_UDPPacket_ +#define HH_SENF_Packets_DefaultBundle_UDPPacket_ 1 // Custom includes #include "../../Packets/Packets.hh" @@ -37,26 +37,30 @@ namespace senf { /** \brief Parse a UDP packet Parser implementing the UDP header. The fields implemented are: - - \see UDPPacketType + \image html UDPPacket.png + + \see UDPPacketType \n RFC 768 */ - struct Parse_UDP : public PacketParserBase + struct UDPPacketParser : public PacketParserBase { # include SENF_FIXED_PARSER() - SENF_PARSE_FIELD( source, senf::Parse_UInt16 ); - SENF_PARSE_FIELD( destination, senf::Parse_UInt16 ); - SENF_PARSE_FIELD( length, senf::Parse_UInt16 ); - SENF_PARSE_FIELD( checksum, senf::Parse_UInt16 ); + SENF_PARSER_FIELD( source, senf::UInt16Parser ); + SENF_PARSER_FIELD( destination, senf::UInt16Parser ); + SENF_PARSER_FIELD( length, senf::UInt16Parser ); + SENF_PARSER_FIELD( checksum, senf::UInt16Parser ); - SENF_PARSER_FINALIZE(Parse_UDP); - - boost::uint16_t calcChecksum() const; + SENF_PARSER_FINALIZE(UDPPacketParser); + boost::uint16_t calcChecksum() const; ///< calculate (pseudo-)header checksum + /**< calculate and return the checksum of the + (pseudo-)header \see \ref senf::IpChecksum */ bool validateChecksum() const { return checksum() == 0u || checksum() == calcChecksum(); - } + } ///< validate header checksum + /**< return \c true if the \ref checksum() "checksum" + field is equal to the \ref calcChecksum() "calculated checksum" */ }; /** \brief UDP packet @@ -65,7 +69,23 @@ namespace senf { \ref UDPPacket \par Fields: - \ref Parse_UDP + \ref UDPPacketParser + + + + + + + + + + + + +
0 8 1624 31
\ref UDPPacketParser::source() "Source Port"\ref UDPPacketParser::destination() "Destination Port"
\ref UDPPacketParser::length() "Length"\ref UDPPacketParser::checksum() "Checksum"
+ + \par Finalize action: + \copydetails finalize() \ingroup protocolbundle_default */ @@ -73,28 +93,33 @@ namespace senf { : public PacketTypeBase, public PacketTypeMixin { +#ifndef DOXYGEN typedef PacketTypeMixin mixin; - typedef ConcretePacket packet; - typedef Parse_UDP parser; +#endif + typedef ConcretePacket packet; ///< UDP packet typedef + typedef UDPPacketParser parser; ///< typedef to the parser of UDP packet using mixin::nextPacketRange; using mixin::initSize; using mixin::init; + /** \brief Dump given UDPPacket in readable form to given output stream */ static void dump(packet p, std::ostream & os); - - static void finalize(packet p); + + static void finalize(packet p); ///< Finalize packet. + /**< \li set \ref UDPPacketParser::length() "length" from + payload size + \li calculate and set \ref UDPPacketParser::checksum() + "checksum" */ }; /** \brief UDP packet typedef */ - typedef UDPPacketType::packet UDPPacket; + typedef ConcretePacket UDPPacket; } ///////////////////////////////hh.e//////////////////////////////////////// -#endif -#ifndef SENF_PACKETS_DECL_ONLY -//#include UDPPacket.cci" +//#include "UDPPacket.cci" //#include "UDPPacket.ct" //#include "UDPPacket.cti" #endif