Packets/80221Bundle: set messageId on finalize
tho [Wed, 8 Jul 2009 12:10:22 +0000 (12:10 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1260 270642c3-0616-0410-b53a-bc976706d245

Packets/80221Bundle/MIHPacket.cc

index f2e6124..e221b59 100644 (file)
@@ -50,7 +50,6 @@ prefix_ void senf::MIHFId_TLVParser::setString(std::string const &id)
     std::copy( id.begin(), id.end(), si);
 }
 
-
 prefix_ senf::MACAddress senf::MIHFId_TLVParser::asMACAddress()
     const
 {
@@ -91,47 +90,45 @@ prefix_ void senf::MIHFId_TLVParser::setINet6Address(senf::INet6Address const &a
     std::copy( addr.begin(), addr.end(), getNAIEncodedOutputIterator(si));
 }
 
-
 prefix_ void senf::MIHPacketType::dump(packet p, std::ostream &os)
 {
     boost::io::ios_all_saver ias(os);
     os << "MIH Packet:\n"
        << "  protocol header:\n"
-       << "    Version:         "  << unsigned( p->version()) << "\n"
-       << "    Ack-Request:     "  << p->ackRequest() << "\n"
-       << "    Ack-Response:    "  << p->ackResponse() << "\n"
-       << "    UIR:             "  << p->uir() << "\n"
-       << "    more fragment:   "  << p->moreFragment() << "\n"
-       << "    fragment number: "  << p->fragmentNr() << "\n"
+       << "    Version:          " << unsigned( p->version()) << "\n"
+       << "    Ack-Request:      " << p->ackRequest() << "\n"
+       << "    Ack-Response:     " << p->ackResponse() << "\n"
+       << "    UIR:              " << p->uir() << "\n"
+       << "    more fragment:    " << p->moreFragment() << "\n"
+       << "    fragment number:  " << p->fragmentNr() << "\n"
        << "    message ID (MID): " << unsigned( p->messageId()) << "\n"
-       << "      SID:           "  << unsigned( p->sid()) << "\n"        
-       << "      Opcode:        "  << unsigned( p->opcode()) << "\n"
-       << "      AID:           "  << unsigned( p->aid()) << "\n"      
-       << "    Transaction ID:  "  << unsigned( p->transactionId()) << "\n"
-       << "    payload length:  "  << unsigned( p->payloadLength()) << "\n"
+       << "      SID:            " << unsigned( p->sid()) << "\n"        
+       << "      Opcode:         " << unsigned( p->opcode()) << "\n"
+       << "      AID:            " << unsigned( p->aid()) << "\n"      
+       << "    Transaction ID:   " << unsigned( p->transactionId()) << "\n"
+       << "    payload length:   " << unsigned( p->payloadLength()) << "\n"
        << "  source MIHF_Id TLV:\n"
-       << "    type:            "  << unsigned (p->src_mihfId().type()) << "\n"
-       << "    length:          "  << unsigned (p->src_mihfId().length()) << "\n"
+       << "    type:             " << unsigned (p->src_mihfId().type()) << "\n"
+       << "    length:           " << unsigned (p->src_mihfId().length()) << "\n"
        << "    value:\n";
     std::string src_mihfId (p->src_mihfId().asString());
     hexdump(src_mihfId.begin(), src_mihfId.end(), os);
     os << "  destination MIHF_Id TLV:\n"
-       << "    type:            "  << unsigned (p->dst_mihfId().type()) << "\n"
-       << "    length:          "  << unsigned (p->dst_mihfId().length()) << "\n"
+       << "    type:             " << unsigned (p->dst_mihfId().type()) << "\n"
+       << "    length:           " << unsigned (p->dst_mihfId().length()) << "\n"
        << "    value:\n";
     std::string dst_mihfId (p->dst_mihfId().asString());
     hexdump(dst_mihfId.begin(), dst_mihfId.end(), os);
 }
 
-
 prefix_ void senf::MIHPacketType::finalize(packet p)
 {
     p->src_mihfId().shrinkLength();
     p->dst_mihfId().shrinkLength();
     p->payloadLength_() << p.size() - 8;
+    p->messageId() << key(p.next(nothrow));
 }
 
-
 prefix_ senf::PacketInterpreterBase::factory_t senf::MIHPacketType::nextPacketType(packet p)
 {
     if (p.data().size() < initSize())
@@ -140,7 +137,6 @@ prefix_ senf::PacketInterpreterBase::factory_t senf::MIHPacketType::nextPacketTy
     return e ? e->factory() : MIHPayloadPacket::factory();
 }
 
-
 prefix_ void senf::MIHPayloadPacketType::dump(packet p, std::ostream &os)
 {
     boost::io::ios_all_saver ias(os);
@@ -148,7 +144,6 @@ prefix_ void senf::MIHPayloadPacketType::dump(packet p, std::ostream &os)
        << "  ToDo!\n";
 }
 
-
 #undef prefix_
 
 \f